Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/index.html

Issue 4895499043733504: Issue 510 - [Typed objects] Don`t hardcode script load order in unit tests (Closed)
Patch Set: Using generators to produce responses Created Feb. 5, 2015, 2:49 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/common.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/index.html
===================================================================
--- a/test/index.html
+++ b/test/index.html
@@ -1,44 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="qunit.css"/>
- <script>
- var js17supported = false;
- </script>
- <script type="text/javascript;version=1.7">
- js17supported = true;
- </script>
-
<script src="jquery-1.7.1.min.js"></script>
<script src="qunit.js"></script>
<script src="common.js"></script>
<script>
- var libs = [
- "typedObjects/utils.js",
- "typedObjects/hash.js",
- "typedObjects/arrayTypes.js",
- "typedObjects/dictionaryTypes.js",
- "typedObjects/primitiveTypes.js",
- "typedObjects/references.js",
- "typedObjects/objectTypes.js",
- "typedObjects/stringType.js",
- "typedObjects.js"
- ];
- for (var i = 0; i < libs.length; i++)
- addScript("/lib/" + libs[i]);
+ var evalScript = function(source)
+ {
+ return eval(source);
+ };
+ var evalModule = function(source)
+ {
+ var result = {};
+ new Function("exports", source)(result);
+ return result;
+ };
+ var js17supported = false;
+ </script>
- var tests = [
- "typedObjects.js"
- ];
- for (var i = 0; i < tests.length; i++)
- addScript("/tests/" + tests[i]);
+ <script type="text/javascript;version=1.7">
+ evalScript = function(source)
+ {
+ return eval(source);
+ };
+ evalModule = function(source)
+ {
+ var result = {};
+ new Function("exports", source)(result);
+ return result;
+ };
+ js17supported = true;
+ </script>
+
+ <script>
+ addScript("/lib.js");
+ addScript("/tests.js");
+
+ window.addEventListener("load", function()
+ {
+ for (var i = 0; i < tests.length; i++)
+ evalScript(tests[i]);
+ }, false);
</script>
</head>
<body>
<h1 id="qunit-header">Adblock Plus unit tests</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
« no previous file with comments | « test/common.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld