Home page Forum Wiki Mail Jabber Devel NIX-FILES

AltLUG Git

Git-repositories of Altai Linux User Group

Introducing #qunit-fixture element, deprecating the (never documented) #main element...
authorjzaefferer <joern.zaefferer@gmail.com>
Wed, 28 Jul 2010 08:03:52 +0000 (10:03 +0200)
committerjzaefferer <joern.zaefferer@gmail.com>
Wed, 28 Jul 2010 08:03:52 +0000 (10:03 +0200)
qunit/qunit.css
qunit/qunit.js
test/index.html
test/test.js

index 47da512..ff140e0 100644 (file)
@@ -140,4 +140,10 @@ strong b.fail{
 }
 strong b.pass{
        color:#5E740B;
-}
\ No newline at end of file
+}
+
+#qunit-fixture {
+       position: absolute;
+       top: -10000px;
+       left: -10000px;
+}
index 64b62bd..a8b0967 100644 (file)
@@ -328,8 +328,9 @@ var QUnit = {
         * Resets the test setup. Useful for tests that modify the DOM.
         */
        reset: function() {
-               if ( window.jQuery ) {
-                       jQuery("#main").html( config.fixture );
+               var main = id('main') || id('qunit-fixture');
+               if ( main ) {
+                       main.innerHTML = config.fixture;
                }
        }
 };
@@ -548,7 +549,7 @@ addEvent(window, "load", function() {
                toolbar.appendChild( label );
        }
 
-       var main = id('main');
+       var main = id('main') || id('qunit-fixture');
        if ( main ) {
                config.fixture = main.innerHTML;
        }
index 8a9f865..7713ac8 100644 (file)
@@ -13,5 +13,6 @@
        <div id="qunit-testrunner-toolbar"></div>
        <h2 id="qunit-userAgent"></h2>
        <ol id="qunit-tests"></ol>
+       <div id="qunit-fixture">test markup</div>
 </body>
 </html>
index aa06d9b..2e059a5 100644 (file)
@@ -227,3 +227,11 @@ test("raises", function() {
        raises(thrower2, 'Type!', 'throwing TypeError instance');
        raises(thrower3, 'Custom!', 'throwing custom object');
 });
+
+module("fixture");
+test("setup", function() {
+       document.getElementById("qunit-fixture").innerHTML = "foobar";
+});
+test("basics", function() {
+       equal( document.getElementById("qunit-fixture").innerHTML, "test markup", "automatically reset" );
+});

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