X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fmediawiki%2Fmediawiki.util.test.js;h=6b316e5558e142607b4036aa60683c15f83eb539;hb=9097f95ecc3c45f9265779e0051658ed9e2d2c91;hp=673cb15cf08be65a50bce50f413a87433053237f;hpb=fc2a88f66642590dda149590bdb72c5fc9ab5795;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js index 673cb15cf0..6b316e5558 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js @@ -80,6 +80,7 @@ }, teardown: function () { $.fn.updateTooltipAccessKeys.setTestMode( false ); + mw.util.resetOptionsForTest(); }, messages: { // Used by accessKeyLabel in test for addPortletLink @@ -114,7 +115,7 @@ // Distant future: no legacy fallbacks [ allNew, text, html5Encoded ] ].forEach( function ( testCase ) { - mw.config.set( 'wgFragmentMode', testCase[ 0 ] ); + mw.util.setOptionsForTest( { FragmentMode: testCase[ 0 ] } ); assert.strictEqual( util.escapeIdForAttribute( testCase[ 1 ] ), testCase[ 2 ] ); } ); @@ -141,7 +142,7 @@ // Distant future: no legacy fallbacks [ allNew, text, html5Encoded ] ].forEach( function ( testCase ) { - mw.config.set( 'wgFragmentMode', testCase[ 0 ] ); + mw.util.setOptionsForTest( { FragmentMode: testCase[ 0 ] } ); assert.strictEqual( util.escapeIdForLink( testCase[ 1 ] ), testCase[ 2 ] ); } ); @@ -150,7 +151,7 @@ QUnit.test( 'wikiUrlencode', function ( assert ) { assert.strictEqual( util.wikiUrlencode( 'Test:A & B/Here' ), 'Test:A_%26_B/Here' ); // See also wfUrlencodeTest.php#provideURLS - // eslint-disable-next-line no-restricted-properties + // eslint-disable-next-line no-jquery/no-each-util $.each( { '+': '%2B', '&': '%26', @@ -210,22 +211,22 @@ href = util.getUrl( '#Fragment', { action: 'edit' } ); assert.strictEqual( href, '/w/index.php?action=edit#Fragment', 'empty title with query string and fragment' ); - mw.config.set( 'wgFragmentMode', [ 'legacy' ] ); + mw.util.setOptionsForTest( { FragmentMode: [ 'legacy' ] } ); href = util.getUrl( 'Foo:Sandbox \xC4#Fragment \xC4', { action: 'edit' } ); assert.strictEqual( href, '/w/index.php?title=Foo:Sandbox_%C3%84&action=edit#Fragment_.C3.84', 'title with query string, fragment, and special characters' ); - mw.config.set( 'wgFragmentMode', [ 'html5' ] ); + mw.util.setOptionsForTest( { FragmentMode: [ 'html5' ] } ); href = util.getUrl( 'Foo:Sandbox \xC4#Fragment \xC4', { action: 'edit' } ); assert.strictEqual( href, '/w/index.php?title=Foo:Sandbox_%C3%84&action=edit#Fragment_Ä', 'title with query string, fragment, and special characters' ); href = util.getUrl( 'Foo:%23#Fragment', { action: 'edit' } ); assert.strictEqual( href, '/w/index.php?title=Foo:%2523&action=edit#Fragment', 'title containing %23 (#), fragment, and a query string' ); - mw.config.set( 'wgFragmentMode', [ 'legacy' ] ); + mw.util.setOptionsForTest( { FragmentMode: [ 'legacy' ] } ); href = util.getUrl( '#+&=:;@$-_.!*/[]<>\'§', { action: 'edit' } ); assert.strictEqual( href, '/w/index.php?action=edit#.2B.26.3D:.3B.40.24-_..21.2A.2F.5B.5D.3C.3E.27.C2.A7', 'fragment with various characters' ); - mw.config.set( 'wgFragmentMode', [ 'html5' ] ); + mw.util.setOptionsForTest( { FragmentMode: [ 'html5' ] } ); href = util.getUrl( '#+&=:;@$-_.!*/[]<>\'§', { action: 'edit' } ); assert.strictEqual( href, '/w/index.php?action=edit#+&=:;@$-_.!*/[]<>\'§', 'fragment with various characters' ); } );