/*jshint multistr:true, quotmark:false */
var fireNative, originaljQuery, original$,
+ baseURL = "",
supportjQuery = this.jQuery,
// see RFC 2606
externalHost = "example.com";
* @result "data/test.php?foo=bar&10538358345554"
*/
function url( value ) {
- return 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
test( title, function() {
var iframe;
+ // Expect one assertion, but allow overrides
+ expect( 1 );
+
stop();
window.iframeCallback = function() {
var self = this,
start();
}, 0 );
};
- iframe = jQuery( "<div/>" ).append(
- jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName ) )
- ).appendTo( "body" );
+ iframe = jQuery( "<div/>" ).css({ position: "absolute", width: "500px", left: "-600px" })
+ .append( jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName ) ) )
+ .appendTo( "#qunit-fixture" );
});
};
-this.iframeCallback = undefined;
+window.iframeCallback = undefined;
// Tests are always loaded async
QUnit.config.autostart = false;
* @param {String} url Test folder location
* @param {RegExp} risTests To filter script sources
*/
-function testSubproject( label, url, risTests, complete ) {
+function testSubproject( label, subProjectURL, risTests, complete ) {
var sub, fixture, fixtureHTML,
fixtureReplaced = false;
// Load tests and fixture from subproject
// Test order matters, so we must be synchronous and throw an error on load failure
- supportjQuery.ajax( url, {
+ supportjQuery.ajax( subProjectURL, {
async: false,
dataType: "html",
error: function( jqXHR, status ) {
- throw new Error( "Could not load: " + url + " (" + status + ")" );
+ throw new Error( "Could not load: " + subProjectURL + " (" + status + ")" );
},
success: function( data, status, jqXHR ) {
var sources = [],
(function loadDep() {
var dep = sources.shift();
if ( dep ) {
- require( [ url + dep ], loadDep );
+ require( [ subProjectURL + dep ], loadDep );
} else if ( complete ) {
complete();
}
return;
}
+ // Update helper function behavior
+ baseURL = subProjectURL;
+
// Replace the current fixture, including content outside of #qunit-fixture
var oldFixture = supportjQuery("#qunit-fixture");
while ( oldFixture.length && !oldFixture.prevAll("[id='qunit']").length ) {