mediawiki.util: Simplify test-only setOptions methods
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 8 Jul 2019 21:54:53 +0000 (22:54 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 8 Jul 2019 21:56:15 +0000 (22:56 +0100)
commit720dab42d9dbe9c97f3526f16ef2cb0b934aa7a9
treefaf842e9a549490bb5dc6d346b4d51e5cb312ca0
parent35a327526d8d0175fe5bb7c2b882423647b12bbe
mediawiki.util: Simplify test-only setOptions methods

Follows-up 1c7c9bdf1f.

* Define the method only in test context, instead of
  a run-time check.

* Return the old value, and re-use function for restoring
  the result afterwards.

* Make the test define its options by default, so at to not
  rely on local-wiki defaults in any way.

Change-Id: I71e92d5b9ee789b594e6e64ca3e425583fc1ee1c
resources/src/mediawiki.util.js
tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js