Tests: Remove Sizzle intergration tests

Fixes #14818

Conflicts:
	test/data/testrunner.js
This commit is contained in:
Oleg Gaidarenko
2014-02-18 19:49:24 +04:00
parent d5399193d4
commit 6cd81b8802
2 changed files with 27 additions and 176 deletions

View File

@@ -131,8 +131,8 @@ fireNative = document.createEvent ?
* @result "data/test.php?foo=bar&10538358345554"
*/
function url( value ) {
return baseURL + value + (/\?/.test(value) ? "&" : "?") +
new Date().getTime() + "" + parseInt(Math.random() * 100000, 10);
return baseURL + value + (/\?/.test( value ) ? "&" : "?") +
new Date().getTime() + "" + parseInt( Math.random() * 100000, 10 );
}
// Ajax testing helper
@@ -203,19 +203,17 @@ this.ajaxTest = function( title, expect, options ) {
this.testIframe = function( fileName, name, fn ) {
test(name, function() {
// pause execution for now
stop();
asyncTest(name, function() {
// load fixture in iframe
var iframe = loadFixture(),
win = iframe.contentWindow,
interval = setInterval( function() {
interval = setInterval(function() {
if ( win && win.jQuery && win.jQuery.isReady ) {
clearInterval( interval );
// continue
start();
// call actual tests passing the correct jQuery instance to use
fn.call( this, win.jQuery, win, win.document );
document.body.removeChild( iframe );
@@ -225,9 +223,10 @@ this.testIframe = function( fileName, name, fn ) {
});
function loadFixture() {
var src = url("./data/" + fileName + ".html"),
iframe = jQuery("<iframe />").appendTo("body")[0];
var src = url( "./data/" + fileName + ".html" ),
iframe = jQuery( "<iframe />" ).appendTo( "body" )[ 0 ];
iframe.style.cssText = "width: 500px; height: 500px; position: absolute; top: -600px; left: -600px; visibility: hidden;";
iframe.contentWindow.location = src;
return iframe;
}
@@ -265,11 +264,12 @@ QUnit.config.autostart = false;
this.loadTests = function() {
var loadSwarm,
url = window.location.search;
url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + "swarmURL=".length ) );
loadSwarm = url && url.indexOf("http") === 0;
url = decodeURIComponent( url.slice( url.indexOf( "swarmURL=" ) + "swarmURL=".length ) );
loadSwarm = url && url.indexOf( "http" ) === 0;
// Get testSubproject from testrunner first
require([ "data/testrunner.js" ], function( testSubproject ) {
require([ "data/testrunner.js" ], function() {
var tests = [
"unit/core.js",
"unit/callbacks.js",
@@ -294,39 +294,26 @@ this.loadTests = function() {
// Ensure load order (to preserve test numbers)
(function loadDep() {
var dep = tests.shift();
if ( dep ) {
require( [ dep ], loadDep );
} else {
QUnit.load();
/**
* Run in noConflict mode
*/
jQuery.noConflict();
// Subproject tests must be last because they replace our test fixture
testSubproject( "Sizzle", "../src/sizzle/test/", /^unit\/.*\.js$/, function() {
// Call load to build module filter select element
QUnit.load();
/**
* Run in noConflict mode
*/
jQuery.noConflict();
// Expose Sizzle for Sizzle's selector tests
// We remove Sizzle's globalization in jQuery
window.Sizzle = window.Sizzle || jQuery.find;
// For checking globals pollution despite auto-created globals in various environments
supportjQuery.each( [ jQuery.expando, "getInterface", "Packages", "java", "netscape" ], function( i, name ) {
window[ name ] = window[ name ];
});
// Load the TestSwarm listener if swarmURL is in the address.
if ( loadSwarm ) {
require( [ "http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() ], function() {
QUnit.start();
});
} else {
// Load the TestSwarm listener if swarmURL is in the address.
if ( loadSwarm ) {
require( [ "http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() ], function() {
QUnit.start();
}
});
});
} else {
QUnit.start();
}
}
})();
});