| 1 | <!-- A local source file that allows dygraph developers to test locally. --> |
| 2 | <html> |
| 3 | <head> |
| 4 | <!-- Standard Dygraph scripts --> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9"> |
| 6 | <!--[if IE]> |
| 7 | <script type="text/javascript" src="../../excanvas.js"></script> |
| 8 | <![endif]--> |
| 9 | <script type="text/javascript" src="../../dygraph-dev.js"></script> |
| 10 | |
| 11 | <!-- Scripts for automated tests --> |
| 12 | <script type="text/javascript" src="../lib/jquery-1.4.2.js"></script> |
| 13 | <script type="text/javascript" src="../lib/Asserts.js"></script> |
| 14 | <script type="text/javascript" src="fake-jstestdriver.js"></script> |
| 15 | <script type="text/javascript" src="../tests/MoreAsserts.js"></script> |
| 16 | <script type="text/javascript" src="../tests/Proxy.js"></script> |
| 17 | <script type="text/javascript" src="../tests/CanvasAssertions.js"></script> |
| 18 | <script type="text/javascript" src="../tests/DygraphOps.js"></script> |
| 19 | <script type="text/javascript" src="../tests/sanity.js"></script> |
| 20 | <script type="text/javascript" src="../tests/simple_drawing.js"></script> |
| 21 | <script type="text/javascript" src="../tests/range_tests.js"></script> |
| 22 | <script type="text/javascript" src="../tests/axis_labels.js"></script> |
| 23 | <script type="text/javascript" src="../tests/multi_csv.js"></script> |
| 24 | <script type="text/javascript" src="../tests/to_dom_coords.js"></script> |
| 25 | <script type="text/javascript" src="../tests/interaction_model.js"></script> |
| 26 | <script type="text/javascript" src="../tests/scrolling_div.js"></script> |
| 27 | <script type="text/javascript" src="../tests/custom_bars.js"></script> |
| 28 | <script type="text/javascript" src="../tests/css.js"></script> |
| 29 | <script type="text/javascript" src="../tests/selection.js"></script> |
| 30 | <script type="text/javascript" src="../tests/update_options.js"></script> |
| 31 | |
| 32 | |
| 33 | <script type="text/javascript"> |
| 34 | var tc = null; |
| 35 | function processVariables() { |
| 36 | var splitVariables = function() { // http://www.idealog.us/2006/06/javascript_to_p.html |
| 37 | var query = window.location.search.substring(1); |
| 38 | var args = {}; |
| 39 | var vars = query.split("&"); |
| 40 | for (var i = 0;i < vars.length; i++) { |
| 41 | var pair = vars[i].split("="); |
| 42 | args[pair[0]] = pair[1]; |
| 43 | } |
| 44 | return args; |
| 45 | } |
| 46 | |
| 47 | var args = splitVariables(); |
| 48 | var test = args.test; |
| 49 | var command = args.command; |
| 50 | |
| 51 | if (args.testCase) { |
| 52 | eval("tc = new " + args.testCase + "()"); |
| 53 | if (args.command) { |
| 54 | if (args.command == "runAllTests") { |
| 55 | console.log("Running all tests for " + args.testCase); |
| 56 | tc.runAllTests(); |
| 57 | } |
| 58 | if (args.command == "runTest") { |
| 59 | console.log("Running test " + args.testCase + "." + args.test); |
| 60 | tc.runTest(args.test); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | </script> |
| 66 | </head> |
| 67 | <body> |
| 68 | <div id='graph'></div> |
| 69 | This file is really nothing more than all the tests coalesced into a single |
| 70 | HTML file. To run a test, open a Javascript console and execute, for |
| 71 | instance,<br> |
| 72 | <code>tc = new SimpleDrawingTestCase() ;<br> |
| 73 | tc.runTest("testDrawSimpleRangePlusOne")</code> (execution method #1, by string) </br> |
| 74 | <code>tc.runTest(tc.testDrawSimpleRangePlusOne)</code> (execution method #2, by function reference) |
| 75 | |
| 76 | <p>Alternatively you can use query args: <ul> |
| 77 | <li>testCase - for the name of the test case |
| 78 | <li>test - for the name of the test (use command=runTest) |
| 79 | <li>command - either runTest or runAllTests. |
| 80 | </ul> |
| 81 | Example: <code>local.html?testCase=ScrollingDivTestCase&test=testNestedDiv_Scrolled&command=runTest</code> |
| 82 | </body> |
| 83 | <script> |
| 84 | processVariables(); |
| 85 | </script> |
| 86 | </html> |