| 1 | <html> |
| 2 | <head> |
| 3 | <meta charset="utf-8"> |
| 4 | <title>dygraphs tests</title> |
| 5 | <link rel="stylesheet" href="../node_modules/mocha/mocha.css" /> |
| 6 | <link rel="stylesheet" href="../css/dygraph.css" /> |
| 7 | </head> |
| 8 | <body> |
| 9 | <div id="graph"></div> |
| 10 | <div id="mocha"></div> |
| 11 | |
| 12 | <!-- Polyfills for PhantomJS --> |
| 13 | <script src="../node_modules/babel-core/browser-polyfill.js"></script> |
| 14 | |
| 15 | <!-- Mocha --> |
| 16 | <script src="../node_modules/mocha/mocha.js"></script> |
| 17 | <script src="../node_modules/chai/chai.js"></script> |
| 18 | <script> |
| 19 | if (window.initMochaPhantomJS) { |
| 20 | window.initMochaPhantomJS(); |
| 21 | } |
| 22 | </script> |
| 23 | |
| 24 | <script> |
| 25 | var expect = chai.expect; |
| 26 | var assert = chai.assert; |
| 27 | function cleanupAfterEach() { |
| 28 | // Clean up the DOM before each test. |
| 29 | // This makes debugging easier than cleaning up after each test, since the |
| 30 | // DOM stays on the screen after a failure. |
| 31 | beforeEach(function() { |
| 32 | var graph = document.getElementById('graph'); |
| 33 | graph.innerHTML = ''; |
| 34 | graph.setAttribute('style', ''); |
| 35 | }); |
| 36 | } |
| 37 | function useProxyCanvas(utils, Proxy) { |
| 38 | var _origFunc = utils.getContext; |
| 39 | beforeEach(function() { |
| 40 | utils.getContext = function(canvas) { |
| 41 | return new Proxy(_origFunc(canvas)); |
| 42 | } |
| 43 | }); |
| 44 | |
| 45 | afterEach(function() { |
| 46 | utils.getContext = _origFunc; |
| 47 | }); |
| 48 | } |
| 49 | </script> |
| 50 | <script>mocha.setup('bdd')</script> |
| 51 | |
| 52 | <!-- Test data --> |
| 53 | <script src="data/data.js"></script> |
| 54 | |
| 55 | <!-- Bundled tests --> |
| 56 | <script src="../dist/tests.js"></script> |
| 57 | |
| 58 | <script> |
| 59 | mocha.checkLeaks(); |
| 60 | if (window.mochaPhantomJS) { |
| 61 | mochaPhantomJS.run(); |
| 62 | } else { |
| 63 | mocha.run(); |
| 64 | } |
| 65 | </script> |
| 66 | </body> |
| 67 | </html> |