Fomafix has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404073 )

Change subject: mediawiki.util.test: Set wgFragmentMode before using getUrl
......................................................................

mediawiki.util.test: Set wgFragmentMode before using getUrl

The result of mw.util.getUrl() depends on wgFragmentMode.
This change sets wgFragmentMode before testing mw.util.getUrl() and
tests the modes 'legacy' and 'html5'.

This change fixed errors on Special:JavaScriptTest when $wgFragmentMode
is set in LocalSettings.php.

Change-Id: Ifc65faacfcddb7d1bb4b298a0940c8f0208a23d7
---
M tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/73/404073/1

diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js 
b/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js
index ef894a9..5e573e9 100644
--- a/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js
+++ b/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js
@@ -248,14 +248,23 @@
                href = util.getUrl( '#Fragment', { action: 'edit' } );
                assert.equal( href, '/w/index.php?action=edit#Fragment', 'empty 
title with query string and fragment' );
 
+               mw.config.set( 'wgFragmentMode', [ 'legacy' ] );
                href = util.getUrl( 'Foo:Sandbox \xC4#Fragment \xC4', { action: 
'edit' } );
                assert.equal( 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' ] );
+               href = util.getUrl( 'Foo:Sandbox \xC4#Fragment \xC4', { action: 
'edit' } );
+               assert.equal( 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.equal( href, 
'/w/index.php?title=Foo:%2523&action=edit#Fragment', 'title containing %23 (#), 
fragment, and a query string' );
 
+               mw.config.set( 'wgFragmentMode', [ 'legacy' ] );
                href = util.getUrl( '#+&=:;@$-_.!*/[]<>\'§', { action: 'edit' } 
);
                assert.equal( 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' ] );
+               href = util.getUrl( '#+&=:;@$-_.!*/[]<>\'§', { action: 'edit' } 
);
+               assert.equal( href, 
'/w/index.php?action=edit#+&=:;@$-_.!*/[]<>\'§', 'fragment with various 
characters' );
        } );
 
        QUnit.test( 'wikiScript', function ( assert ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/404073
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc65faacfcddb7d1bb4b298a0940c8f0208a23d7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Fomafix <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to