mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-22 15:14:44 +00:00
async test library load helper
This commit is contained in:
parent
66a818223a
commit
34dcbe2aa7
1 changed files with 28 additions and 0 deletions
|
|
@ -4,6 +4,34 @@
|
|||
|
||||
(function( $ ) {
|
||||
$.testHelper = {
|
||||
asyncLoad: function( opts ) {
|
||||
var baseUrl = opts.baseUrl || "../../../js";
|
||||
|
||||
// stop qunit from running the tests until everything is in the page
|
||||
QUnit.config.autostart = false;
|
||||
|
||||
// set the baseUrl to the js dir or the default
|
||||
require({
|
||||
baseUrl: baseUrl
|
||||
});
|
||||
|
||||
// require the libs required to pass the test suite
|
||||
require( opts.libs, function() {
|
||||
|
||||
// init the mobile library
|
||||
require( ["jquery.mobile.init"], function() {
|
||||
|
||||
// reset the base dir to the current directory for including the test libs
|
||||
require({
|
||||
baseUrl: location.pathname
|
||||
});
|
||||
|
||||
// after everything is inplace start the test suite
|
||||
require( opts.testLibs, QUnit.start);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
excludeFileProtocol: function(callback){
|
||||
var message = "Tests require script reload and cannot be run via file: protocol";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue