Merge "Type hint against LinkTarget in WatchedItemStore"
[lhc/web/wiklou.git] / resources / src / mediawiki.util.js
index 56bfc42..36a0195 100644 (file)
@@ -2,8 +2,7 @@
        'use strict';
 
        var util,
-               config = require( './config.json' ),
-               origConfig = config;
+               config = require( './config.json' );
 
        /**
         * Encode the string like PHP's rawurlencode
         */
        util = {
 
-               /* 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
                 *
                        $portlet.removeClass( 'emptyPortlet' );
 
                        // Setup the list item (and a span if $portlet is a Vector tab)
+                       // eslint-disable-next-line no-jquery/no-class-state
                        if ( $portlet.hasClass( 'vectorTabs' ) ) {
                                item = $( '<li>' ).append( $( '<span>' ).append( link )[ 0 ] )[ 0 ];
                        } else {
                }
        };
 
+       // Not allowed outside unit tests
+       if ( window.QUnit ) {
+               util.setOptionsForTest = function ( opts ) {
+                       var oldConfig = config;
+                       config = $.extend( {}, config, opts );
+                       return oldConfig;
+               };
+       }
+
        /**
         * Initialisation of mw.util.$content
         */