"use strict"; ( typeof global != "undefined" ? global : window ).TestManager = { /** * Load a version of a file based on URL parameters. * * dev Uncompressed development version: source files in the project /dist dir * esmodules Non-combined dev version: source files from the project /src dir * min Minified version in the project /dist dir * VER Version from code.jquery.com, e.g.: git, 1.8.2.min or 1.7rc1 * else Full or relative path to be used for script src */ loadProject: function( projectName, defaultVersion, isSelf ) { var file, urlTag = this.projects[ projectName ].urlTag, matcher = new RegExp( "\\b" + urlTag + "=([^&]+)" ), projectRoot = this.baseURL + ( isSelf ? "../.." : "../../../" + projectName ), version = ( matcher.exec( document.location.search ) || {} )[ 1 ] || defaultVersion; // The esmodules mode requires the browser to support ES modules // so it won't run in IE. if ( version === "esmodules" ) { // This is the main source file that imports all the others. file = projectRoot + "/src/migrate.js"; } else if ( version === "dev" ) { file = projectRoot + "/dist/" + projectName + ".js"; } else if ( version === "min" ) { file = projectRoot + "/dist/" + projectName + ".min.js"; } else if ( version.indexOf( "git" ) === 0 || version.indexOf( "3.x-git" ) === 0 ) { file = "https://releases.jquery.com/git/" + projectName + "-" + version + ".js"; } else if ( /^[\w\.\-]+$/.test( version ) ) { file = "https://code.jquery.com/" + projectName + "-" + version + ".js"; } else { file = version; } this.loaded.push( { projectName: projectName, tag: version, file: file } ); if ( version === "esmodules" ) { document.write( "" ); } else { document.write( "" ); } }, /** * Load jQuery Migrate tests. In esmodules mode it loads all tests as * ES modules so that they get executed in the correct order. */ loadTests: function() { var esmodules = QUnit.config.plugin === "esmodules" || QUnit.urlParams.plugin === "esmodules", testFiles = [ "data/test-utils.js", "unit/migrate.js", "unit/jquery/core.js", "unit/jquery/ajax.js", "unit/jquery/attributes.js", "unit/jquery/css.js", "unit/jquery/data.js", "unit/jquery/effects.js", "unit/jquery/event.js", "unit/jquery/manipulation.js", "unit/jquery/offset.js", "unit/jquery/serialize.js", "unit/jquery/traversing.js", "unit/jquery/deferred.js" ]; testFiles.forEach( function( testFile ) { document.write( "" ); } ); document.write( "" ); }, /** * Iframe tests that require setup not covered in the standard unit test * * Note that options passed into the standard unit tests will also be passed to * the iframe, but the iframe html page is responsible for processing them * as appropriate (for example by calling TestManager.loadProject) */ runIframeTest: function( title, url, func ) { var that = this, esmodules = QUnit.config.plugin === "esmodules" || QUnit.urlParams.plugin === "esmodules"; // Skip iframe tests in esmodules mode as that mode is not compatible with how // they are written. if ( esmodules ) { QUnit.skip( title ); return; } QUnit.test( title, function( assert ) { var iframe, query = window.location.search.slice( 1 ), done = assert.async(); that.iframeCallback = function() { var args = Array.prototype.slice.call( arguments ); args.unshift( assert ); setTimeout( function() { that.iframeCallback = undefined; func.apply( this, args ); func = function() {}; iframe.remove(); done(); } ); }; iframe = jQuery( "
" ) .css( { position: "absolute", width: "500px", left: "-600px" } ) .append( jQuery( "