Home page Forum Wiki Mail Jabber Devel NIX-FILES

AltLUG Git

Git-repositories of Altai Linux User Group

Add a test for loading tests asynchronously
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Sun, 14 Oct 2012 20:29:12 +0000 (16:29 -0400)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Sun, 14 Oct 2012 20:29:12 +0000 (16:29 -0400)
grunt.js
test/async.html [new file with mode: 0644]
test/async.js [new file with mode: 0644]

index cb5f95d..ad60639 100644 (file)
--- a/grunt.js
+++ b/grunt.js
@@ -12,7 +12,8 @@ grunt.initConfig({
                        'addons/canvas/canvas.html',
                        'addons/close-enough/close-enough.html',
                        'addons/composite/composite-demo-test.html'
-               ]
+               ],
+               async: 'test/async.html'
        },
        lint: {
                qunit: 'qunit/qunit.js',
diff --git a/test/async.html b/test/async.html
new file mode 100644 (file)
index 0000000..a6dcd8d
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta charset="UTF-8">
+       <title>QUnit Test Suite</title>
+       <link rel="stylesheet" href="../qunit/qunit.css">
+</head>
+<body>
+       <div id="qunit"></div>
+       <div id="qunit-fixture">test markup</div>
+       <script src="../qunit/qunit.js"></script>
+       <script>
+       QUnit.config.autostart = false;
+       setTimeout(function() {
+               // Simulate a delay in retrieving the tests, as when they are loaded
+               // asynchronously using requirejs, steal, etc.
+               var script = document.createElement( "script" );
+               script.src = "async.js";
+               document.getElementsByTagName( "head" )[0].appendChild( script );
+       }, 1000);
+       </script>
+</body>
+</html>
\ No newline at end of file
diff --git a/test/async.js b/test/async.js
new file mode 100644 (file)
index 0000000..e6136fe
--- /dev/null
@@ -0,0 +1,6 @@
+QUnit.start();
+
+test("just a test", function() {
+       expect(1);
+       ok(true);
+});
\ No newline at end of file

Hosting is provided AltSPAHow to use Git
Please direct any questions on jabber alex.wolf@jabber.ru

Valid HTML 4.0 Transitional Valid CSS!

Designer Alexander Wolf