Skip to content

Commit 7e8b854

Browse files
Krinkledmethvin
authored andcommitted
Test: Clean up and fix misc issues
* Clean up testinit and testrunner * Uncomment isLocal (at least make sure it is declared) * Rephrase environment assertions to make sense if one reads them when they pass. * Optimise an expensive loop that might be the cause of this in IE6: http://cl.ly/image/3f20053m112n
1 parent bb38f70 commit 7e8b854

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

test/data/testinit.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
/*jshint multistr:true*/
1+
/*jshint multistr:true */
22

33
var jQuery = this.jQuery || "jQuery", // For testing .noConflict()
44
$ = this.$ || "$",
55
originaljQuery = jQuery,
66
original$ = $,
77
hasPHP = true,
8+
// Disable Ajax tests to reduce network strain
9+
// Re-enabled (at least the variable should be declared)
10+
isLocal = window.location.protocol === "file:",
811
amdDefined;
912

1013
/**
@@ -123,7 +126,7 @@ if ( document.createEvent ) {
123126
* @result "data/test.php?foo=bar&10538358345554"
124127
*/
125128
function url( value ) {
126-
return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
129+
return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random() * 100000, 10);
127130
}
128131

129132
(function () {
@@ -226,7 +229,7 @@ function url( value ) {
226229
jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName ) )
227230
).appendTo( "body" );
228231
});
229-
}
232+
};
230233
}());
231234

232235
// Sandbox start for great justice

test/data/testrunner.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function testSubproject( label, url, risTests ) {
123123
}
124124

125125
fnTest.apply( this, arguments );
126-
}
126+
};
127127
}
128128
}
129129

@@ -167,8 +167,5 @@ QUnit.config.testTimeout = 20 * 1000; // 20 seconds
167167
return;
168168
}
169169

170-
// (Temporarily) Disable Ajax tests to reduce network strain
171-
// isLocal = QUnit.isLocal = true;
172-
173170
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "ipt>");
174171
})();

test/unit/core.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ module("core", { teardown: moduleTeardown });
22

33
test("Unit Testing Environment", function () {
44
expect(2);
5-
ok( hasPHP, "Running Unit tests without PHP is unsupported! The AJAX tests won't run without it and don't expect all tests to pass without it!" );
6-
ok( !isLocal, "Unit tests shouldn't be run from file://, especially in Chrome. If you must test from file:// with Chrome, run it with the --allow-file-access-from-files flag!" );
5+
ok( hasPHP, "Running in an environment with PHP support. The AJAX tests only run if the environment supports PHP!" );
6+
ok( !isLocal, "Unit tests are not ran from file:// (especially in Chrome. If you must test from file:// with Chrome, run it with the --allow-file-access-from-files flag!)" );
77
});
88

99
test("Basic requirements", function() {
@@ -644,12 +644,12 @@ test("jQuery('html')", function() {
644644
var li = "<li>very large html string</li>";
645645
var html = ["<ul>"];
646646
for ( i = 0; i < 50000; i += 1 ) {
647-
html.push(li);
647+
html[html.length] = li;
648648
}
649-
html.push("</ul>");
649+
html[html.length] = "</ul>";
650650
html = jQuery(html.join(""))[0];
651-
equal( html.nodeName.toUpperCase(), "UL");
652-
equal( html.firstChild.nodeName.toUpperCase(), "LI");
651+
equal( html.nodeName.toLowerCase(), "ul");
652+
equal( html.firstChild.nodeName.toLowerCase(), "li");
653653
equal( html.childNodes.length, 50000 );
654654
});
655655

0 commit comments

Comments
 (0)