From: jenkins-bot Date: Fri, 11 Jul 2014 21:15:47 +0000 (+0000) Subject: Merge "QUnit: Detect unfinished jQuery effects or ajax requests in teardown" X-Git-Tag: 1.31.0-rc.0~14987 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=a6a93bb87c03fd6813564888591c4b2785326e1d;hp=0676b7ffd5be7bbb28c69a5a74e250acb63fa4a8;p=lhc%2Fweb%2Fwiklou.git Merge "QUnit: Detect unfinished jQuery effects or ajax requests in teardown" --- diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index 50e89da8bc..f3f884a49a 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -240,6 +240,18 @@ // As a convenience feature, automatically restore warnings if they're // still suppressed by the end of the test. restoreWarnings(); + + // Check for (and clean up, if possible) incomplete animations/requests/etc. + if ( $.timers && $.timers.length !== 0 ) { + // Test may need to use fake timers, wait for animations or + // call $.fx.stop(). + throw new Error( 'Unfinished animations: ' + $.timers.length ); + } + if ( $.active !== undefined && $.active !== 0 ) { + // Test may need to use fake XHR, wait for requests or + // call abort(). + throw new Error( 'Unfinished AJAX requests: ' + $.active ); + } } }; };