Index: trunk/parsers/wikidom/tests/hype/index.html |
— | — | @@ -8,8 +8,10 @@ |
9 | 9 | <body> |
10 | 10 | <h1 id="qunit-header">Hype Tests</h1> |
11 | 11 | <h2 id="qunit-banner"></h2> |
| 12 | + <div id="qunit-testrunner-toolbar"></div> |
12 | 13 | <h2 id="qunit-userAgent"></h2> |
13 | 14 | <ol id="qunit-tests"></ol> |
| 15 | + <div id="qunit-fixture">test markup</div> |
14 | 16 | <script src="../../lib/jquery.js"></script> |
15 | 17 | <script src="../../lib/qunit.js"></script> |
16 | 18 | <script src="../../lib/hype/es.js"></script> |
Index: trunk/parsers/wikidom/tests/transactions/index.html |
— | — | @@ -8,8 +8,10 @@ |
9 | 9 | <body> |
10 | 10 | <h1 id="qunit-header">Transaction Tests</h1> |
11 | 11 | <h2 id="qunit-banner"></h2> |
| 12 | + <div id="qunit-testrunner-toolbar"></div> |
12 | 13 | <h2 id="qunit-userAgent"></h2> |
13 | 14 | <ol id="qunit-tests"></ol> |
| 15 | + <div id="qunit-fixture">test markup</div> |
14 | 16 | <script src="../../lib/es/es.js"></script> |
15 | 17 | <script src="../../lib/es/es.EventEmitter.js"></script> |
16 | 18 | <script src="../../lib/es/es.Content.js"></script> |
Index: trunk/parsers/wikidom/tests/serializers/index.html |
— | — | @@ -8,8 +8,10 @@ |
9 | 9 | <body> |
10 | 10 | <h1 id="qunit-header">Wikidom Tests</h1> |
11 | 11 | <h2 id="qunit-banner"></h2> |
| 12 | + <div id="qunit-testrunner-toolbar"></div> |
12 | 13 | <h2 id="qunit-userAgent"></h2> |
13 | 14 | <ol id="qunit-tests"></ol> |
| 15 | + <div id="qunit-fixture">test markup</div> |
14 | 16 | <script src="../../lib/qunit.js"></script> |
15 | 17 | <script src="../../lib/jquery.js"></script> |
16 | 18 | <script src="../../lib/es/es.js"></script> |
Index: trunk/parsers/wikidom/tests/annotations/index.html |
— | — | @@ -8,8 +8,10 @@ |
9 | 9 | <body> |
10 | 10 | <h1 id="qunit-header">Wikidom Tests</h1> |
11 | 11 | <h2 id="qunit-banner"></h2> |
| 12 | + <div id="qunit-testrunner-toolbar"></div> |
12 | 13 | <h2 id="qunit-userAgent"></h2> |
13 | 14 | <ol id="qunit-tests"></ol> |
| 15 | + <div id="qunit-fixture">test markup</div> |
14 | 16 | <script src="../../lib/es/es.js"></script> |
15 | 17 | <script src="../../lib/es/es.EventEmitter.js"></script> |
16 | 18 | <script src="../../lib/es/es.Content.js"></script> |
Index: trunk/parsers/wikidom/lib/qunit.css |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * QUnit 1.1.0pre - A JavaScript Unit Testing Framework |
| 3 | + * QUnit 1.2.0pre - A JavaScript Unit Testing Framework |
4 | 4 | * |
5 | 5 | * http://docs.jquery.com/QUnit |
6 | 6 | * |
Index: trunk/parsers/wikidom/lib/qunit.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * QUnit 1.1.0pre - A JavaScript Unit Testing Framework |
| 3 | + * QUnit 1.2.0pre - A JavaScript Unit Testing Framework |
4 | 4 | * |
5 | 5 | * http://docs.jquery.com/QUnit |
6 | 6 | * |
— | — | @@ -21,7 +21,9 @@ |
22 | 22 | })() |
23 | 23 | }; |
24 | 24 | |
25 | | -var testId = 0; |
| 25 | +var testId = 0, |
| 26 | + toString = Object.prototype.toString, |
| 27 | + hasOwn = Object.prototype.hasOwnProperty; |
26 | 28 | |
27 | 29 | var Test = function(name, testName, expected, testEnvironmentArg, async, callback) { |
28 | 30 | this.name = name; |
— | — | @@ -91,6 +93,7 @@ |
92 | 94 | } |
93 | 95 | }, |
94 | 96 | run: function() { |
| 97 | + config.current = this; |
95 | 98 | if ( this.async ) { |
96 | 99 | QUnit.stop(); |
97 | 100 | } |
— | — | @@ -109,11 +112,12 @@ |
110 | 113 | |
111 | 114 | // Restart the tests if they're blocking |
112 | 115 | if ( config.blocking ) { |
113 | | - start(); |
| 116 | + QUnit.start(); |
114 | 117 | } |
115 | 118 | } |
116 | 119 | }, |
117 | 120 | teardown: function() { |
| 121 | + config.current = this; |
118 | 122 | try { |
119 | 123 | this.testEnvironment.teardown.call(this.testEnvironment); |
120 | 124 | checkPollution(); |
— | — | @@ -122,7 +126,8 @@ |
123 | 127 | } |
124 | 128 | }, |
125 | 129 | finish: function() { |
126 | | - if ( this.expected && this.expected != this.assertions.length ) { |
| 130 | + config.current = this; |
| 131 | + if ( this.expected != null && this.expected != this.assertions.length ) { |
127 | 132 | QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); |
128 | 133 | } |
129 | 134 | |
— | — | @@ -245,7 +250,7 @@ |
246 | 251 | if (bad) { |
247 | 252 | run(); |
248 | 253 | } else { |
249 | | - synchronize(run); |
| 254 | + synchronize(run, true); |
250 | 255 | }; |
251 | 256 | } |
252 | 257 | |
— | — | @@ -262,7 +267,7 @@ |
263 | 268 | asyncTest: function(testName, expected, callback) { |
264 | 269 | if ( arguments.length === 2 ) { |
265 | 270 | callback = expected; |
266 | | - expected = 0; |
| 271 | + expected = null; |
267 | 272 | } |
268 | 273 | |
269 | 274 | QUnit.test(testName, expected, callback, true); |
— | — | @@ -410,11 +415,11 @@ |
411 | 416 | } |
412 | 417 | |
413 | 418 | config.blocking = false; |
414 | | - process(); |
| 419 | + process(true); |
415 | 420 | }, 13); |
416 | 421 | } else { |
417 | 422 | config.blocking = false; |
418 | | - process(); |
| 423 | + process(true); |
419 | 424 | } |
420 | 425 | }, |
421 | 426 | |
— | — | @@ -607,8 +612,7 @@ |
608 | 613 | return "null"; |
609 | 614 | } |
610 | 615 | |
611 | | - var type = Object.prototype.toString.call( obj ) |
612 | | - .match(/^\[object\s(.*)\]$/)[1] || ''; |
| 616 | + var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || ''; |
613 | 617 | |
614 | 618 | switch (type) { |
615 | 619 | case 'Number': |
— | — | @@ -670,6 +674,9 @@ |
671 | 675 | var querystring = "?", |
672 | 676 | key; |
673 | 677 | for ( key in params ) { |
| 678 | + if ( !hasOwn.call( params, key ) ) { |
| 679 | + continue; |
| 680 | + } |
674 | 681 | querystring += encodeURIComponent( key ) + "=" + |
675 | 682 | encodeURIComponent( params[ key ] ) + "&"; |
676 | 683 | } |
— | — | @@ -782,6 +789,17 @@ |
783 | 790 | |
784 | 791 | addEvent(window, "load", QUnit.load); |
785 | 792 | |
| 793 | +// addEvent(window, "error") gives us a useless event object |
| 794 | +window.onerror = function( message, file, line ) { |
| 795 | + if ( QUnit.config.current ) { |
| 796 | + ok( false, message + ", " + file + ":" + line ); |
| 797 | + } else { |
| 798 | + test( "global failure", function() { |
| 799 | + ok( false, message + ", " + file + ":" + line ); |
| 800 | + }); |
| 801 | + } |
| 802 | +}; |
| 803 | + |
786 | 804 | function done() { |
787 | 805 | config.autorun = true; |
788 | 806 | |
— | — | @@ -896,26 +914,30 @@ |
897 | 915 | }); |
898 | 916 | } |
899 | 917 | |
900 | | -function synchronize( callback ) { |
| 918 | +function synchronize( callback, last ) { |
901 | 919 | config.queue.push( callback ); |
902 | 920 | |
903 | 921 | if ( config.autorun && !config.blocking ) { |
904 | | - process(); |
| 922 | + process(last); |
905 | 923 | } |
906 | 924 | } |
907 | 925 | |
908 | | -function process() { |
909 | | - var start = (new Date()).getTime(); |
| 926 | +function process( last ) { |
| 927 | + var start = new Date().getTime(); |
| 928 | + config.depth = config.depth ? config.depth + 1 : 1; |
910 | 929 | |
911 | 930 | while ( config.queue.length && !config.blocking ) { |
912 | | - if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) { |
| 931 | + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { |
913 | 932 | config.queue.shift()(); |
914 | 933 | } else { |
915 | | - window.setTimeout( process, 13 ); |
| 934 | + window.setTimeout( function(){ |
| 935 | + process( last ); |
| 936 | + }, 13 ); |
916 | 937 | break; |
917 | 938 | } |
918 | 939 | } |
919 | | - if (!config.blocking && !config.queue.length) { |
| 940 | + config.depth--; |
| 941 | + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { |
920 | 942 | done(); |
921 | 943 | } |
922 | 944 | } |
— | — | @@ -925,6 +947,9 @@ |
926 | 948 | |
927 | 949 | if ( config.noglobals ) { |
928 | 950 | for ( var key in window ) { |
| 951 | + if ( !hasOwn.call( window, key ) ) { |
| 952 | + continue; |
| 953 | + } |
929 | 954 | config.pollution.push( key ); |
930 | 955 | } |
931 | 956 | } |
— | — | @@ -975,7 +1000,9 @@ |
976 | 1001 | for ( var prop in b ) { |
977 | 1002 | if ( b[prop] === undefined ) { |
978 | 1003 | delete a[prop]; |
979 | | - } else { |
| 1004 | + |
| 1005 | + // Avoid "Member not found" error in IE8 caused by setting window.constructor |
| 1006 | + } else if ( prop !== "constructor" || a !== window ) { |
980 | 1007 | a[prop] = b[prop]; |
981 | 1008 | } |
982 | 1009 | } |
— | — | @@ -1268,10 +1295,13 @@ |
1269 | 1296 | type = "document"; |
1270 | 1297 | } else if (obj.nodeType) { |
1271 | 1298 | type = "node"; |
1272 | | - } else if (Object.prototype.toString.call( obj ) == "[object Array]") { |
| 1299 | + } else if ( |
| 1300 | + // native arrays |
| 1301 | + toString.call( obj ) === "[object Array]" || |
| 1302 | + // NodeList objects |
| 1303 | + ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) |
| 1304 | + ) { |
1273 | 1305 | type = "array"; |
1274 | | - } else if (Object.prototype.toString.call( obj ) == "[object NodeList]") { |
1275 | | - type = "array"; |
1276 | 1306 | } else { |
1277 | 1307 | type = typeof obj; |
1278 | 1308 | } |
— | — | @@ -1452,6 +1482,9 @@ |
1453 | 1483 | } |
1454 | 1484 | |
1455 | 1485 | for (var i in ns) { |
| 1486 | + if ( !hasOwn.call( ns, i ) ) { |
| 1487 | + continue; |
| 1488 | + } |
1456 | 1489 | if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) { |
1457 | 1490 | n[ns[i].rows[0]] = { |
1458 | 1491 | text: n[ns[i].rows[0]], |