From 95f722fd30d068bc1a0484e5d09baaf098f9440e Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 20 May 2014 16:40:55 +0200 Subject: [PATCH] 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 --- .../qunit/suites/resources/mediawiki/mediawiki.toc.test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.20.1