From: Timo Tijhof Date: Tue, 20 May 2014 14:40:55 +0000 (+0200) Subject: mediawiki.toc.test: Stub $.cookie to avoid test pollution X-Git-Tag: 1.31.0-rc.0~15637^2 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=95f722fd30d068bc1a0484e5d09baaf098f9440e;p=lhc%2Fweb%2Fwiklou.git mediawiki.toc.test: Stub $.cookie to avoid test pollution When running the tests locally the mediawiki.toc tests often fail because where it asserts hidden it is visible, and where it asserts visible it is hidden (this happens if you've ever closed a "toc" section on your local wiki, causes the tests to be one-off). Change-Id: Idc5e7123f3be3e11dac50d76d13089a2fabcfdb5 --- diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js index 3f856b96ba..e43516b0f2 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js @@ -1,5 +1,10 @@ ( function ( mw, $ ) { - QUnit.module( 'mediawiki.toc', QUnit.newMwEnvironment() ); + QUnit.module( 'mediawiki.toc', QUnit.newMwEnvironment( { + setup: function () { + // Prevent live cookies like mw_hidetoc=1 from interferring with the test + this.stub( $, 'cookie' ).returns( null ); + } + } ) ); QUnit.asyncTest( 'toggleToc', 4, function ( assert ) { var tocHtml, $toggleLink, $tocList;