( function () {
'use strict';
- var util;
+ var util,
+ config = require( './config.json' ),
+ origConfig = config;
/**
* Encode the string like PHP's rawurlencode
/* Main body */
+ setOptionsForTest: function ( opts ) {
+ if ( !window.QUnit ) {
+ throw new Error( 'Modifying options not allowed outside unit tests' );
+ }
+ config = $.extend( {}, config, opts );
+ },
+
+ resetOptionsForTest: function () {
+ if ( !window.QUnit ) {
+ throw new Error( 'Resetting options not allowed outside unit tests' );
+ }
+ config = origConfig;
+ },
+
/**
* Encode the string like PHP's rawurlencode
*
* @return {string} Encoded string
*/
escapeIdForAttribute: function ( str ) {
- var mode = mw.config.get( 'wgFragmentMode' )[ 0 ];
+ var mode = config.FragmentMode[ 0 ];
return escapeIdInternal( str, mode );
},
* @return {string} Encoded string
*/
escapeIdForLink: function ( str ) {
- var mode = mw.config.get( 'wgFragmentMode' )[ 0 ];
+ var mode = config.FragmentMode[ 0 ];
return escapeIdInternal( str, mode );
},