Skip to content
This repository was archived by the owner on Aug 14, 2021. It is now read-only.

Commit f2a57ba

Browse files
committed
Update to Unit-Composite 2.0.0
1 parent c3fca95 commit f2a57ba

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

lib/qunit-composite.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
factory( QUnit );
1515
}
1616
}(function( QUnit ) {
17-
var iframe, hasBound,
17+
var iframe, hasBound, resumeTests, suiteAssert,
1818
modules = 1,
1919
executingComposite = false;
2020

@@ -48,7 +48,9 @@ function runSuite( suite ) {
4848
path = suite;
4949
}
5050

51-
QUnit.asyncTest( suite, function() {
51+
QUnit.test( suite, function( assert ) {
52+
resumeTests = assert.async();
53+
suiteAssert = assert;
5254
iframe.setAttribute( "src", path );
5355
// QUnit.start is called from the child iframe's QUnit.done hook.
5456
});
@@ -90,13 +92,13 @@ function initIframe() {
9092
}
9193
// Pass all test details through to the main page
9294
var message = ( moduleName ? moduleName + ": " : "" ) + testName + ": " + ( data.message || ( data.result ? "okay" : "failed" ) );
93-
expect( ++count );
94-
QUnit.push( data.result, data.actual, data.expected, message );
95+
suiteAssert.expect( ++count );
96+
suiteAssert.push( data.result, data.actual, data.expected, message );
9597
});
9698

9799
// Continue the outer test when the iframe's test is done
98100
iframeWin.QUnit.done(function() {
99-
QUnit.start();
101+
resumeTests();
100102
});
101103
}
102104

@@ -177,7 +179,7 @@ QUnit.testSuites = function( name, suites ) {
177179
}
178180

179181
QUnit.module( name, {
180-
setup: function () {
182+
beforeEach: function () {
181183
executingComposite = true;
182184
}
183185
});
@@ -193,16 +195,8 @@ QUnit.testDone(function( data ) {
193195
}
194196

195197
var i, len,
196-
testId = data.testId || QUnit.config.current.testId || data.testNumber || QUnit.config.current.testNumber,
197-
current = testId ?
198-
(
199-
// QUnit @^1.16.0
200-
document.getElementById( "qunit-test-output-" + testId ) ||
201-
// QUnit @1.15.x
202-
document.getElementById( "qunit-test-output" + testId )
203-
) :
204-
// QUnit @<1.15.0
205-
document.getElementById( QUnit.config.current.id ),
198+
testId = data.testId,
199+
current = document.getElementById( "qunit-test-output-" + testId ),
206200
children = current && current.children,
207201
src = iframe.src;
208202

@@ -231,4 +225,4 @@ QUnit.testDone(function( data ) {
231225
current.getElementsByTagName( "a" )[ 0 ].href = src;
232226
});
233227

234-
}));
228+
}));

0 commit comments

Comments
 (0)