From: Timo Tijhof Date: Wed, 5 Feb 2014 20:32:01 +0000 (-0800) Subject: qunit: Preserve context in QUnit module environment override X-Git-Tag: 1.31.0-rc.0~17002^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=3dbfd49793a479efb2fb8b968ccb7f4902287b67;p=lhc%2Fweb%2Fwiklou.git qunit: Preserve context in QUnit module environment override They were being called as properties of localEnv, which is a shallow copy of the real one. When other callbacks add properties to the object, they weren't visible in the local "this" of the module teardown/setup. Change-Id: I01e2031e1e2bfcedc7aa3480ce7d9915c8fff7f1 --- diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index 5bdd37f552..50e6014c0a 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -150,14 +150,14 @@ mw.config.values = freshConfigCopy( localEnv.config ); mw.messages.values = freshMessagesCopy( localEnv.messages ); - localEnv.setup(); + localEnv.setup.call( this ); }, teardown: function () { log( 'MwEnvironment> TEARDOWN for "' + QUnit.config.current.module + ': ' + QUnit.config.current.testName + '"' ); - localEnv.teardown(); + localEnv.teardown.call( this ); // Farewell, mock environment! mw.config.values = liveConfig;