@@ -192,138 +192,4 @@ window.Globals = (function() {
192192 } ;
193193} ) ( ) ;
194194
195- /**
196- * Test a subproject with its own fixture
197- * @param {String } label Project name
198- * @param {String } url Test folder location
199- * @param {RegExp } risTests To filter script sources
200- */
201- function testSubproject ( label , subProjectURL , risTests , complete ) {
202- var sub , fixture , fixtureHTML ,
203- fixtureReplaced = false ;
204-
205- // Don't let subproject tests jump the gun
206- QUnit . config . reorder = false ;
207-
208- // Create module
209- module ( label ) ;
210-
211- // Duckpunch QUnit
212- // TODO restore parent fixture on teardown to support reordering
213- module = QUnit . module = function ( name ) {
214- var args = arguments ;
215-
216- // Remember subproject-scoped module name
217- sub = name ;
218-
219- // Override
220- args [ 0 ] = label ;
221- return qunitModule . apply ( this , args ) ;
222- } ;
223- test = function ( name ) {
224- var args = arguments ,
225- i = args . length - 1 ;
226-
227- // Prepend subproject-scoped module name to test name
228- args [ 0 ] = sub + ": " + name ;
229-
230- // Find test function and wrap to require subproject fixture
231- for ( ; i >= 0 ; i -- ) {
232- if ( supportjQuery . isFunction ( args [ i ] ) ) {
233- args [ i ] = requireFixture ( args [ i ] ) ;
234- break ;
235- }
236- }
237-
238- return qunitTest . apply ( this , args ) ;
239- } ;
240-
241- // Load tests and fixture from subproject
242- // Test order matters, so we must be synchronous and throw an error on load failure
243- supportjQuery . ajax ( subProjectURL , {
244- async : false ,
245- dataType : "html" ,
246- error : function ( jqXHR , status ) {
247- throw new Error ( "Could not load: " + subProjectURL + " (" + status + ")" ) ;
248- } ,
249- success : function ( data , status , jqXHR ) {
250- var sources = [ ] ,
251- page = supportjQuery . parseHTML (
252- // replace html/head with dummy elements so they are represented in the DOM
253- ( data || "" ) . replace ( / < \/ ? ( ( ! D O C T Y P E | h t m l | h e a d ) \b .* ?) > / gi, "[$1]" ) ,
254- document ,
255- true
256- ) ;
257-
258- if ( ! page || ! page . length ) {
259- this . error ( jqXHR , "no data" ) ;
260- }
261- page = supportjQuery ( page ) ;
262-
263- // Include subproject tests
264- page . filter ( "script[src]" ) . add ( page . find ( "script[src]" ) ) . map ( function ( ) {
265- var src = supportjQuery ( this ) . attr ( "src" ) ;
266- if ( risTests . test ( src ) ) {
267- sources . push ( src ) ;
268- }
269- } ) ;
270-
271- // Ensure load order
272- ( function loadDep ( ) {
273- var dep = sources . shift ( ) ;
274- if ( dep ) {
275- require ( [ subProjectURL + dep ] , loadDep ) ;
276- } else if ( complete ) {
277- complete ( ) ;
278- }
279- } ) ( ) ;
280-
281- // Get the fixture, including content outside of #qunit-fixture
282- fixture = page . find ( "[id='qunit-fixture']" ) ;
283- fixtureHTML = fixture . html ( ) ;
284- fixture . empty ( ) ;
285- while ( fixture . length && ! fixture . prevAll ( "[id='qunit']" ) . length ) {
286- fixture = fixture . parent ( ) ;
287- }
288- fixture = fixture . add ( fixture . nextAll ( ) ) ;
289- }
290- } ) ;
291-
292- function requireFixture ( fn ) {
293- return function ( ) {
294- if ( ! fixtureReplaced ) {
295- // Make sure that we retrieved a fixture for the subproject
296- if ( ! fixture . length ) {
297- ok ( false , "Found subproject fixture" ) ;
298- return ;
299- }
300-
301- // Update helper function behavior
302- baseURL = subProjectURL ;
303-
304- // Replace the current fixture, including content outside of #qunit-fixture
305- var oldFixture = supportjQuery ( "#qunit-fixture" ) ;
306- while ( oldFixture . length && ! oldFixture . prevAll ( "[id='qunit']" ) . length ) {
307- oldFixture = oldFixture . parent ( ) ;
308- }
309- oldFixture . nextAll ( ) . remove ( ) ;
310- oldFixture . replaceWith ( fixture ) ;
311-
312- // WARNING: UNDOCUMENTED INTERFACE
313- QUnit . config . fixture = fixtureHTML ;
314- reset ( ) ;
315- if ( supportjQuery ( "#qunit-fixture" ) . html ( ) !== fixtureHTML ) {
316- ok ( false , "Copied subproject fixture" ) ;
317- return ;
318- }
319- fixtureReplaced = true ;
320- }
321-
322- fn . apply ( this , arguments ) ;
323- } ;
324- }
325- }
326-
327- return testSubproject ;
328-
329195} ) ;
0 commit comments