Added code to make tests easier to repeat by specifying them as part of the URL.
[dygraphs.git] / auto_tests / misc / local.html
CommitLineData
7165f97b 1<!-- A local source file that allows dygraph developers to test locally. -->
644eff8b
RK
2<html>
3<head>
7165f97b
RK
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]-->
8d3d15af 9 <script type="text/javascript" src="../../dygraph-dev.js"></script>
7165f97b
RK
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>
72a74f04 15 <script type="text/javascript" src="../tests/MoreAsserts.js"></script>
7165f97b
RK
16 <script type="text/javascript" src="../tests/Proxy.js"></script>
17 <script type="text/javascript" src="../tests/CanvasAssertions.js"></script>
72a74f04 18 <script type="text/javascript" src="../tests/DygraphOps.js"></script>
7165f97b
RK
19 <script type="text/javascript" src="../tests/sanity.js"></script>
20 <script type="text/javascript" src="../tests/simple_drawing.js"></script>
72a74f04 21 <script type="text/javascript" src="../tests/range_tests.js"></script>
f3cbe61e
DV
22 <script type="text/javascript" src="../tests/axis_labels.js"></script>
23 <script type="text/javascript" src="../tests/multi_csv.js"></script>
063e83ba 24 <script type="text/javascript" src="../tests/to_dom_coords.js"></script>
9c831431 25 <script type="text/javascript" src="../tests/interaction_model.js"></script>
6788e30b
RK
26 <script type="text/javascript" src="../tests/scrolling_div.js"></script>
27 <script type="text/javascript">
28 var tc = null;
29 function processVariables() {
30 var splitVariables = function() { // http://www.idealog.us/2006/06/javascript_to_p.html
31 var query = window.location.search.substring(1);
32 var args = {};
33 var vars = query.split("&");
34 for (var i = 0;i < vars.length; i++) {
35 var pair = vars[i].split("=");
36 args[pair[0]] = pair[1];
37 }
38 return args;
39 }
40
41 var args = splitVariables();
42 var test = args.test;
43 var command = args.command;
44
45 if (args.testCase) {
46 eval("tc = new " + args.testCase + "()");
47 if (args.command) {
48 if (args.command == "runAllTests") {
49 console.log("Running all tests for " + args.testCase);
50 tc.runAllTests();
51 }
52 if (args.command == "runTest") {
53 console.log("Running test " + args.testCase + "." + args.test);
54 tc.runTest(args.test);
55 }
56 }
57 }
58 }
59 </script>
644eff8b
RK
60</head>
61<body>
62 <div id='graph'></div>
63 This file is really nothing more than all the tests coalesced into a single
64 HTML file. To run a test, open a Javascript console and execute, for
65 instance,<br>
66 <code>tc = new SimpleDrawingTestCase() ;<br>
67 tc.runTest("testDrawSimpleRangePlusOne")</code>
6788e30b
RK
68
69 <p>Alternatively you can use query args: <ul>
70 <li>testCase - for the name of the test case
71 <li>test - for the name of the test (use command=runTest)
72 <li>command - either runTest or runAllTests.
73 </ul>
74 Example: <code>local.html?testCase=ScrollingDivTestCase&test=testNestedDiv_Scrolled&command=runTest</code>
644eff8b 75</body>
6788e30b
RK
76<script>
77processVariables();
78</script>
644eff8b 79</html>