qunit: Remove redundant testCount expectation
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 21 Feb 2017 02:36:36 +0000 (18:36 -0800)
committerKrinkle <krinklemail@gmail.com>
Wed, 22 Feb 2017 01:25:52 +0000 (01:25 +0000)
QUnit used to have bad state management (a few years ago) at which point it
became useful to verify the number of assertions in case an asynchronous
failure happened, as it would likely go unnoticed.

* Errors outside testStart/testEnd weren't caught.
  QUnit now monitors window.onerror.

* Assertions could be attributed to the wrong test.
  QUnit no longer does this since the assert object is associated with
  the current test through lexical scope.

* assert.async()/done() replaced global semaphore (QUnit.start).

* A test could forget to be marked as async and make no assertions.
  QUnit now marks a test as failed if it makes  0 assertions.
  QUnit also has built-in async tracking for promises.

If a test is not reaching all assertions for some reason, this
will cause an error of some sort that is tracked. If in some
specific scenario this isn't the case, assert.expect() can still
be called (e.g. when expecting 0 assertions), but it'd be worthwhile
to file an upstream bug report in that case.

Follows-up 7c363752, which removed 'QUnit.config.requireExpects' from
our test configuration.

Follows-up c4c7007de6 and various other commits that already removed
the test counts from a subset tests. This commit removes the remainder.

Change-Id: Ie58396ba9c83d27220508481cb97c0fa74487756

46 files changed:
tests/qunit/data/generateJqueryMsgData.php
tests/qunit/data/testrunner.js
tests/qunit/suites/resources/jquery/jquery.accessKeyLabel.test.js
tests/qunit/suites/resources/jquery/jquery.autoEllipsis.test.js
tests/qunit/suites/resources/jquery/jquery.byteLength.test.js
tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js
tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js
tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js
tests/qunit/suites/resources/jquery/jquery.hidpi.test.js
tests/qunit/suites/resources/jquery/jquery.highlightText.test.js
tests/qunit/suites/resources/jquery/jquery.localize.test.js
tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js
tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js
tests/qunit/suites/resources/jquery/jquery.placeholder.test.js
tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js
tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js
tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.ForeignApi.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.category.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.messages.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.upload.test.js
tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.RegExp.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.Title.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.Uri.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.cldr.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.cookie.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.errorLogger.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.experiments.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.html.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.language.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.messagePoster.factory.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.template.mustache.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.template.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.viewport.test.js
tests/qunit/suites/resources/startup.test.js

index 5a96dc3..5d1f1cd 100644 (file)
@@ -16,7 +16,7 @@
 /*
  * @example QUnit
  * <code>
-       QUnit.test( 'Output matches PHP parser', mw.libs.phpParserData.tests.length, function ( assert ) {
+       QUnit.test( 'Output matches PHP parser', function ( assert ) {
                mw.messages.set( mw.libs.phpParserData.messages );
                $.each( mw.libs.phpParserData.tests, function ( i, test ) {
                        QUnit.stop();
index 0b28684..683dc1d 100644 (file)
                }
        } ) );
 
-       QUnit.test( 'Setup', 3, function ( assert ) {
+       QUnit.test( 'Setup', function ( assert ) {
                assert.equal( mw.html.escape( 'foo' ), 'mocked', 'setup() callback was ran.' );
                assert.equal( mw.config.get( 'testVar' ), 'foo', 'config object applied' );
                assert.equal( mw.messages.get( 'testMsg' ), 'Foo.', 'messages object applied' );
                mw.messages.set( 'testMsg', 'Bar.' );
        } );
 
-       QUnit.test( 'Teardown', 2, function ( assert ) {
+       QUnit.test( 'Teardown', function ( assert ) {
                assert.equal( mw.config.get( 'testVar' ), 'foo', 'config object restored and re-applied after test()' );
                assert.equal( mw.messages.get( 'testMsg' ), 'Foo.', 'messages object restored and re-applied after test()' );
        } );
 
-       QUnit.test( 'Loader status', 2, function ( assert ) {
+       QUnit.test( 'Loader status', function ( assert ) {
                var i, len, state,
                        modules = mw.loader.getModuleNames(),
                        error = [],
                assert.deepEqual( missing, [], 'Modules in missing state' );
        } );
 
-       QUnit.test( 'htmlEqual', 8, function ( assert ) {
+       QUnit.test( 'htmlEqual', function ( assert ) {
                assert.htmlEqual(
                        '<div><p class="some classes" data-length="10">Child paragraph with <a href="http://example.com">A link</a></p>Regular text<span>A span</span></div>',
                        '<div><p data-length=\'10\'  class=\'some classes\'>Child paragraph with <a href=\'http://example.com\' >A link</a></p>Regular text<span>A span</span></div>',
 
        QUnit.module( 'test.mediawiki.qunit.testrunner-after', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'Teardown', 3, function ( assert ) {
+       QUnit.test( 'Teardown', function ( assert ) {
                assert.equal( mw.html.escape( '<' ), '&lt;', 'teardown() callback was ran.' );
                assert.equal( mw.config.get( 'testVar' ), null, 'config object restored to live in next module()' );
                assert.equal( mw.messages.get( 'testMsg' ), null, 'messages object restored to live in next module()' );
index 0fb7d9a..9af443d 100644 (file)
@@ -46,7 +46,7 @@
                return '<input title="' + title + '" ' + ( accessKey ? 'accessKey="' + accessKey + '" ' : '' ) + ' />';
        }
 
-       QUnit.test( 'getAccessKeyPrefix', getAccessKeyPrefixTestData.length, function ( assert ) {
+       QUnit.test( 'getAccessKeyPrefix', function ( assert ) {
                var i;
                for ( i = 0; i < getAccessKeyPrefixTestData.length; i++ ) {
                        assert.equal( $.fn.updateTooltipAccessKeys.getAccessKeyPrefix( {
@@ -56,7 +56,7 @@
                }
        } );
 
-       QUnit.test( 'updateTooltipAccessKeys - current browser', 2, function ( assert ) {
+       QUnit.test( 'updateTooltipAccessKeys - current browser', function ( assert ) {
                var title = $( makeInput( 'Title', 'a' ) ).updateTooltipAccessKeys().prop( 'title' ),
                        // The new title should be something like "Title [alt-a]", but the exact label will depend on the browser.
                        // The "a" could be capitalized, and the prefix could be anything, e.g. a simple "^" for ctrl-
@@ -66,7 +66,7 @@
                assert.notEqual( result[ 1 ], 'test-', 'Prefix used for testing shouldn\'t be used in production.' );
        } );
 
-       QUnit.test( 'updateTooltipAccessKeys - no access key', updateTooltipAccessKeysTestData.length, function ( assert ) {
+       QUnit.test( 'updateTooltipAccessKeys - no access key', function ( assert ) {
                var i, oldTitle, $input, newTitle;
                for ( i = 0; i < updateTooltipAccessKeysTestData.length; i++ ) {
                        oldTitle = 'Title' + updateTooltipAccessKeysTestData[ i ];
@@ -77,7 +77,7 @@
                }
        } );
 
-       QUnit.test( 'updateTooltipAccessKeys - with access key', updateTooltipAccessKeysTestData.length, function ( assert ) {
+       QUnit.test( 'updateTooltipAccessKeys - with access key', function ( assert ) {
                $.fn.updateTooltipAccessKeys.setTestMode( true );
                var i, oldTitle, $input, newTitle;
                for ( i = 0; i < updateTooltipAccessKeysTestData.length; i++ ) {
@@ -90,7 +90,7 @@
                $.fn.updateTooltipAccessKeys.setTestMode( false );
        } );
 
-       QUnit.test( 'updateTooltipAccessKeys with label element', 2, function ( assert ) {
+       QUnit.test( 'updateTooltipAccessKeys with label element', function ( assert ) {
                $.fn.updateTooltipAccessKeys.setTestMode( true );
                var html = '<label for="testInput" title="Title">Label</label><input id="testInput" accessKey="a" />',
                        $label, $input;
                $.fn.updateTooltipAccessKeys.setTestMode( false );
        } );
 
-       QUnit.test( 'updateTooltipAccessKeys with label element as parent', 2, function ( assert ) {
+       QUnit.test( 'updateTooltipAccessKeys with label element as parent', function ( assert ) {
                $.fn.updateTooltipAccessKeys.setTestMode( true );
                var html = '<label title="Title">Label<input id="testInput" accessKey="a" /></label>',
                $label, $input;
index a1b2e5c..c3521ba 100644 (file)
@@ -17,7 +17,7 @@
                return i;
        }
 
-       QUnit.test( 'Position right', 4, function ( assert ) {
+       QUnit.test( 'Position right', function ( assert ) {
                // We need this thing to be visible, so append it to the DOM
                var $span, spanText, d, spanTextNew,
                        origText = 'This is a really long random string and there is no way it fits in 100 pixels.',
index e6aa3aa..558e641 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( $ ) {
        QUnit.module( 'jquery.byteLength', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'Simple text', 5, function ( assert ) {
+       QUnit.test( 'Simple text', function ( assert ) {
                var azLc = 'abcdefghijklmnopqrstuvwxyz',
                        azUc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                        num = '0123456789',
@@ -16,7 +16,7 @@
 
        } );
 
-       QUnit.test( 'Special text', 4, function ( assert ) {
+       QUnit.test( 'Special text', function ( assert ) {
                // https://en.wikipedia.org/wiki/UTF-8
                var u0024 = '$',
                        // Cent symbol
index 5c2a06c..804d1ca 100644 (file)
                expected: ''
        } );
 
-       QUnit.test( 'Confirm properties and attributes set', 4, function ( assert ) {
+       QUnit.test( 'Confirm properties and attributes set', function ( assert ) {
                var $el, $elA, $elB;
 
                $el = $( '<input>' ).attr( 'type', 'text' )
                $el.byteLimit();
        } );
 
-       QUnit.test( 'Trim from insertion when limit exceeded', 2, function ( assert ) {
+       QUnit.test( 'Trim from insertion when limit exceeded', function ( assert ) {
                var $el;
 
                // Use a new <input /> because the bug only occurs on the first time
index 00de895..d6208e9 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( $ ) {
        QUnit.module( 'jquery.colorUtil', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'getRGB', 18, function ( assert ) {
+       QUnit.test( 'getRGB', function ( assert ) {
                assert.strictEqual( $.colorUtil.getRGB(), undefined, 'No arguments' );
                assert.strictEqual( $.colorUtil.getRGB( '' ), undefined, 'Empty string' );
                assert.deepEqual( $.colorUtil.getRGB( [ 0, 100, 255 ] ), [ 0, 100, 255 ], 'Parse array of rgb values' );
@@ -26,7 +26,7 @@
                assert.strictEqual( $.colorUtil.getRGB( 'mediaWiki' ), undefined, 'Inexisting color name' );
        } );
 
-       QUnit.test( 'rgbToHsl', 1, function ( assert ) {
+       QUnit.test( 'rgbToHsl', function ( assert ) {
                var hsl, ret;
 
                // Cross-browser differences in decimals...
@@ -42,7 +42,7 @@
                assert.deepEqual( ret, [ 0.33, 0.73, 0.75 ], 'rgb(144, 238, 144): hsl(0.33, 0.73, 0.75)' );
        } );
 
-       QUnit.test( 'hslToRgb', 1, function ( assert ) {
+       QUnit.test( 'hslToRgb', function ( assert ) {
                var rgb, ret;
                rgb = $.colorUtil.hslToRgb( 0.3, 0.7, 0.8 );
 
@@ -52,7 +52,7 @@
                assert.deepEqual( ret, [ 183, 240, 168 ], 'hsl(0.3, 0.7, 0.8): rgb(183, 240, 168)' );
        } );
 
-       QUnit.test( 'getColorBrightness', 2, function ( assert ) {
+       QUnit.test( 'getColorBrightness', function ( assert ) {
                var a, b;
                a = $.colorUtil.getColorBrightness( 'red', +0.1 );
                assert.equal( a, 'rgb(255,50,50)', 'Start with named color "red", brighten 10%' );
index ca3f418..2878999 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( $ ) {
        QUnit.module( 'jquery.getAttrs', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'getAttrs()', 1, function ( assert ) {
+       QUnit.test( 'getAttrs()', function ( assert ) {
                var attrs = {
                                foo: 'bar',
                                'class': 'lorem',
index 8c62876..2f9e960 100644 (file)
@@ -1,17 +1,17 @@
 ( function ( $ ) {
        QUnit.module( 'jquery.hidpi', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'devicePixelRatio', 1, function ( assert ) {
+       QUnit.test( 'devicePixelRatio', function ( assert ) {
                var devicePixelRatio = $.devicePixelRatio();
                assert.equal( typeof devicePixelRatio, 'number', '$.devicePixelRatio() returns a number' );
        } );
 
-       QUnit.test( 'bracketedDevicePixelRatio', 1, function ( assert ) {
+       QUnit.test( 'bracketedDevicePixelRatio', function ( assert ) {
                var devicePixelRatio = $.devicePixelRatio();
                assert.equal( typeof devicePixelRatio, 'number', '$.bracketedDevicePixelRatio() returns a number' );
        } );
 
-       QUnit.test( 'bracketDevicePixelRatio', 8, function ( assert ) {
+       QUnit.test( 'bracketDevicePixelRatio', function ( assert ) {
                assert.equal( $.bracketDevicePixelRatio( 0.75 ), 1, '0.75 gives 1' );
                assert.equal( $.bracketDevicePixelRatio( 1 ), 1, '1 gives 1' );
                assert.equal( $.bracketDevicePixelRatio( 1.25 ), 1.5, '1.25 gives 1.5' );
@@ -22,7 +22,7 @@
                assert.equal( $.bracketDevicePixelRatio( 3 ), 2, '3 gives 2' );
        } );
 
-       QUnit.test( 'matchSrcSet', 6, function ( assert ) {
+       QUnit.test( 'matchSrcSet', function ( assert ) {
                var srcset = 'onefive.png 1.5x, two.png 2x';
 
                // Nice exact matches
index e1fb96d..9f87596 100644 (file)
                                expected: '<span class="highlight">بو</span>ل إيردوس'
                        }
                ];
-               QUnit.expect( cases.length );
 
                $.each( cases, function ( i, item ) {
                        $fixture = $( '<p>' ).text( item.text ).highlightText( item.highlight );
index c503fc9..1b68809 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( $, mw ) {
        QUnit.module( 'jquery.localize', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'Handle basic replacements', 4, function ( assert ) {
+       QUnit.test( 'Handle basic replacements', function ( assert ) {
                var html, $lc;
                mw.messages.set( 'basic', 'Basic stuff' );
 
@@ -30,7 +30,7 @@
                assert.strictEqual( $lc.attr( 'placeholder' ), 'Basic stuff', 'Attribute: placeholder-msg' );
        } );
 
-       QUnit.test( 'Proper escaping', 2, function ( assert ) {
+       QUnit.test( 'Proper escaping', function ( assert ) {
                var html, $lc;
                mw.messages.set( 'properfoo', '<proper esc="test">' );
 
@@ -50,7 +50,7 @@
                assert.strictEqual( $lc.attr( 'title' ), mw.msg( 'properfoo' ), 'Attributes are not inserted raw.' );
        } );
 
-       QUnit.test( 'Options', 7, function ( assert ) {
+       QUnit.test( 'Options', function ( assert ) {
                mw.messages.set( {
                        'foo-lorem': 'Lorem',
                        'foo-ipsum': 'Ipsum',
                assert.strictEqual( $lc.attr( 'title' ), 'Read more about bazz at Wikipedia (last modified: 3 minutes ago)', 'Combination of options prefix, params and keys - attr' );
        } );
 
-       QUnit.test( 'Handle data text', 2, function ( assert ) {
+       QUnit.test( 'Handle data text', function ( assert ) {
                var html, $lc;
                mw.messages.set( 'option-one', 'Item 1' );
                mw.messages.set( 'option-two', 'Item 2' );
                assert.strictEqual( $lc.eq( 1 ).text(), mw.msg( 'option-two' ), 'data-msg-text becomes text of options' );
        } );
 
-       QUnit.test( 'Handle data html', 2, function ( assert ) {
+       QUnit.test( 'Handle data html', function ( assert ) {
                var html, $lc;
                mw.messages.set( 'html', 'behold... there is a <a>link</a> here!!' );
                html = '<div><div data-msg-html="html"></div></div>';
index 9c7660f..b80af4c 100644 (file)
@@ -11,7 +11,7 @@
        }
 
        // This test is first because if it fails, then almost all of the latter tests are meaningless.
-       QUnit.test( 'testing hooks/triggers', 4, function ( assert ) {
+       QUnit.test( 'testing hooks/triggers', function ( assert ) {
                var test = this,
                        $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>'
@@ -44,7 +44,7 @@
                $toggle.trigger( 'click' );
        } );
 
-       QUnit.test( 'basic operation (<div>)', 5, function ( assert ) {
+       QUnit.test( 'basic operation (<div>)', function ( assert ) {
                var test = this,
                        $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>'
@@ -70,7 +70,7 @@
                $toggle.trigger( 'click' );
        } );
 
-       QUnit.test( 'basic operation (<table>)', 7, function ( assert ) {
+       QUnit.test( 'basic operation (<table>)', function ( assert ) {
                var test = this,
                        $collapsible = prepareCollapsible(
                                '<table class="mw-collapsible">' +
                $toggle.trigger( 'click' );
        }
 
-       QUnit.test( 'basic operation (<table> with caption)', 10, function ( assert ) {
+       QUnit.test( 'basic operation (<table> with caption)', function ( assert ) {
                tableWithCaptionTest( prepareCollapsible(
                        '<table class="mw-collapsible">' +
                                '<caption>' + loremIpsum + '</caption>' +
                ), this, assert );
        } );
 
-       QUnit.test( 'basic operation (<table> with caption and <thead>)', 10, function ( assert ) {
+       QUnit.test( 'basic operation (<table> with caption and <thead>)', function ( assert ) {
                tableWithCaptionTest( prepareCollapsible(
                        '<table class="mw-collapsible">' +
                                '<caption>' + loremIpsum + '</caption>' +
                $toggle.trigger( 'click' );
        }
 
-       QUnit.test( 'basic operation (<ul>)', 7, function ( assert ) {
+       QUnit.test( 'basic operation (<ul>)', function ( assert ) {
                listTest( 'ul', this, assert );
        } );
 
-       QUnit.test( 'basic operation (<ol>)', 7, function ( assert ) {
+       QUnit.test( 'basic operation (<ol>)', function ( assert ) {
                listTest( 'ol', this, assert );
        } );
 
-       QUnit.test( 'basic operation when synchronous (options.instantHide)', 2, function ( assert ) {
+       QUnit.test( 'basic operation when synchronous (options.instantHide)', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>',
                                { instantHide: true }
                assert.assertTrue( $content.is( ':hidden' ), 'after collapsing: content is hidden' );
        } );
 
-       QUnit.test( 'mw-made-collapsible data added', 1, function ( assert ) {
+       QUnit.test( 'mw-made-collapsible data added', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div>' + loremIpsum + '</div>'
                        );
                assert.equal( $collapsible.data( 'mw-made-collapsible' ), true, 'mw-made-collapsible data present' );
        } );
 
-       QUnit.test( 'mw-collapsible added when missing', 1, function ( assert ) {
+       QUnit.test( 'mw-collapsible added when missing', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div>' + loremIpsum + '</div>'
                        );
                assert.assertTrue( $collapsible.hasClass( 'mw-collapsible' ), 'mw-collapsible class present' );
        } );
 
-       QUnit.test( 'mw-collapsed added when missing', 1, function ( assert ) {
+       QUnit.test( 'mw-collapsed added when missing', function ( assert ) {
                var $collapsible = prepareCollapsible(
                        '<div>' + loremIpsum + '</div>',
                                { collapsed: true }
                assert.assertTrue( $collapsible.hasClass( 'mw-collapsed' ), 'mw-collapsed class present' );
        } );
 
-       QUnit.test( 'initial collapse (mw-collapsed class)', 2, function ( assert ) {
+       QUnit.test( 'initial collapse (mw-collapsed class)', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible mw-collapsed">' + loremIpsum + '</div>'
                        ),
                $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
        } );
 
-       QUnit.test( 'initial collapse (options.collapsed)', 2, function ( assert ) {
+       QUnit.test( 'initial collapse (options.collapsed)', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>',
                                { collapsed: true }
                $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
        } );
 
-       QUnit.test( 'clicks on links inside toggler pass through (options.linksPassthru)', 2, function ( assert ) {
+       QUnit.test( 'clicks on links inside toggler pass through (options.linksPassthru)', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' +
                                        '<div class="mw-collapsible-toggle">' +
                assert.assertTrue( $content.is( ':hidden' ), 'click event on non-link inside toggle toggles content' );
        } );
 
-       QUnit.test( 'collapse/expand text (data-collapsetext, data-expandtext)', 2, function ( assert ) {
+       QUnit.test( 'collapse/expand text (data-collapsetext, data-expandtext)', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible" data-collapsetext="Collapse me!" data-expandtext="Expand me!">' +
                                        loremIpsum +
                $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
        } );
 
-       QUnit.test( 'collapse/expand text (options.collapseText, options.expandText)', 2, function ( assert ) {
+       QUnit.test( 'collapse/expand text (options.collapseText, options.expandText)', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>',
                                { collapseText: 'Collapse me!', expandText: 'Expand me!' }
                $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
        } );
 
-       QUnit.test( 'cloned collapsibles can be made collapsible again', 2, function ( assert ) {
+       QUnit.test( 'cloned collapsibles can be made collapsible again', function ( assert ) {
                var test = this,
                        $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>'
index 029edd5..aeda516 100644 (file)
@@ -10,7 +10,7 @@
                }
        } ) );
 
-       QUnit.test( 'String functions', 7, function ( assert ) {
+       QUnit.test( 'String functions', function ( assert ) {
                assert.equal( $.trimLeft( '  foo bar  ' ), 'foo bar  ', 'trimLeft' );
                assert.equal( $.trimRight( '  foo bar  ' ), '  foo bar', 'trimRight' );
                assert.equal( $.ucFirst( 'foo' ), 'Foo', 'ucFirst' );
@@ -24,7 +24,7 @@
                assert.equal( $.escapeRE( '0123456789' ), '0123456789', 'escapeRE - Leave numbers alone' );
        } );
 
-       QUnit.test( 'isDomElement', 6, function ( assert ) {
+       QUnit.test( 'isDomElement', function ( assert ) {
                assert.strictEqual( $.isDomElement( document.createElement( 'div' ) ), true,
                        'isDomElement: HTMLElement' );
                assert.strictEqual( $.isDomElement( document.createTextNode( '' ) ), true,
@@ -39,7 +39,7 @@
                        'isDomElement: Plain Object' );
        } );
 
-       QUnit.test( 'isEmpty', 7, function ( assert ) {
+       QUnit.test( 'isEmpty', function ( assert ) {
                assert.strictEqual( $.isEmpty( 'string' ), false, 'isEmpty: "string"' );
                assert.strictEqual( $.isEmpty( '0' ), true, 'isEmpty: "0"' );
                assert.strictEqual( $.isEmpty( '' ), true, 'isEmpty: ""' );
@@ -51,7 +51,7 @@
                assert.strictEqual( $.isEmpty( { length: 0 } ), true, 'isEmpty: { length: 0 }' );
        } );
 
-       QUnit.test( 'Comparison functions', 5, function ( assert ) {
+       QUnit.test( 'Comparison functions', function ( assert ) {
                assert.ok( $.compareArray( [ 0, 'a', [], [ 2, 'b' ] ], [ 0, 'a', [], [ 2, 'b' ] ] ),
                        'compareArray: Two deep arrays that are excactly the same' );
                assert.ok( !$.compareArray( [ 1 ], [ 2 ] ), 'compareArray: Two different arrays (false)' );
index 5d0ddeb..73e4313 100644 (file)
@@ -2,7 +2,7 @@
 
        QUnit.module( 'jquery.placeholder', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'caches results of feature tests', 2, function ( assert ) {
+       QUnit.test( 'caches results of feature tests', function ( assert ) {
                assert.strictEqual( typeof $.fn.placeholder.input, 'boolean', '$.fn.placeholder.input' );
                assert.strictEqual( typeof $.fn.placeholder.textarea, 'boolean', '$.fn.placeholder.textarea' );
        } );
                $el.placeholder( placeholder );
        };
 
-       QUnit.test( 'emulates placeholder for <input type=text>', 22, function ( assert ) {
+       QUnit.test( 'emulates placeholder for <input type=text>', function ( assert ) {
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
                testElement( $( '#input-type-text' ), assert );
        } );
 
-       QUnit.test( 'emulates placeholder for <input type=search>', 22, function ( assert ) {
+       QUnit.test( 'emulates placeholder for <input type=search>', function ( assert ) {
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
                testElement( $( '#input-type-search' ), assert );
        } );
 
-       QUnit.test( 'emulates placeholder for <input type=email>', 22, function ( assert ) {
+       QUnit.test( 'emulates placeholder for <input type=email>', function ( assert ) {
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
                testElement( $( '#input-type-email' ), assert );
        } );
 
-       QUnit.test( 'emulates placeholder for <input type=url>', 22, function ( assert ) {
+       QUnit.test( 'emulates placeholder for <input type=url>', function ( assert ) {
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
                testElement( $( '#input-type-url' ), assert );
        } );
 
-       QUnit.test( 'emulates placeholder for <input type=tel>', 22, function ( assert ) {
+       QUnit.test( 'emulates placeholder for <input type=tel>', function ( assert ) {
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
                testElement( $( '#input-type-tel' ), assert );
        } );
 
-       QUnit.test( 'emulates placeholder for <input type=password>', 13, function ( assert ) {
+       QUnit.test( 'emulates placeholder for <input type=password>', function ( assert ) {
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
 
                var selector = '#input-type-password',
 
        } );
 
-       QUnit.test( 'emulates placeholder for <textarea></textarea>', 22, function ( assert ) {
+       QUnit.test( 'emulates placeholder for <textarea></textarea>', function ( assert ) {
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
                testElement( $( '#textarea' ), assert );
        } );
index 1213793..ec3539b 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( $ ) {
        QUnit.module( 'jquery.tabIndex', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'firstTabIndex', 2, function ( assert ) {
+       QUnit.test( 'firstTabIndex', function ( assert ) {
                var html, $testA, $testB;
                html = '<form>' +
                        '<input tabindex="7" />' +
@@ -17,7 +17,7 @@
                assert.strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' );
        } );
 
-       QUnit.test( 'lastTabIndex', 2, function ( assert ) {
+       QUnit.test( 'lastTabIndex', function ( assert ) {
                var html, $testA, $testB;
                html = '<form>' +
                        '<input tabindex="7" />' +
index 01ff45f..97b2c0e 100644 (file)
@@ -54,7 +54,7 @@
         * @param {function($table)} callback something to do before we start the testcase
         */
        function parserTest( msg, parserId, data, callback ) {
-               QUnit.test( msg, data.length * 2, function ( assert ) {
+               QUnit.test( msg, function ( assert ) {
                        var extractedR, extractedF, parser;
 
                        if ( callback !== undefined ) {
@@ -73,7 +73,7 @@
                } );
        }
 
-       text  = [
+       text = [
                [ 'Mars', true, 'mars', 'Simple text' ],
                [ 'Mẘas', true, 'mẘas', 'Non ascii character' ],
                [ 'A sentence', true, 'a sentence', 'A sentence with space chars' ]
index dffd67a..6f84945 100644 (file)
                        $table.find( '.headerSort:eq(1)' ).trigger( event );
                }
        );
-       QUnit.test( 'Reset sorting making table appear unsorted', 3, function ( assert ) {
+       QUnit.test( 'Reset sorting making table appear unsorted', function ( assert ) {
                var $table = tableCreate( header, simple );
                $table.tablesorter(
                        { sortList: [
                }
        );
 
-       QUnit.test( 'Basic planet table: one unsortable column', 3, function ( assert ) {
+       QUnit.test( 'Basic planet table: one unsortable column', function ( assert ) {
                var $table = tableCreate( header, planets ),
                        $cell;
                $table.find( 'tr:eq(0) > th:eq(0)' ).addClass( 'unsortable' );
                }
        );
 
-       QUnit.test( 'Rowspan not exploded on init', 1, function ( assert ) {
+       QUnit.test( 'Rowspan not exploded on init', function ( assert ) {
                var $table = tableCreate( header, planets );
 
                // Modify the table to have a multiple-row-spanning cell:
                }
        );
 
-       QUnit.test( 'Test detection routine', 1, function ( assert ) {
+       QUnit.test( 'Test detection routine', function ( assert ) {
                var $table;
                $table = $(
                        '<table class="sortable">' +
        } );
 
        /** FIXME: the diff output is not very readeable. */
-       QUnit.test( 'T34047 - caption must be before thead', 1, function ( assert ) {
+       QUnit.test( 'T34047 - caption must be before thead', function ( assert ) {
                var $table;
                $table = $(
                        '<table class="sortable">' +
                );
        } );
 
-       QUnit.test( 'data-sort-value attribute, when available, should override sorting position', 3, function ( assert ) {
+       QUnit.test( 'data-sort-value attribute, when available, should override sorting position', function ( assert ) {
                var $table, data;
 
                // Example 1: All cells except one cell without data-sort-value,
        );
        // TODO add numbers sorting tests for T10115 with a different language
 
-       QUnit.test( 'T34888 - Tables inside a tableheader cell', 2, function ( assert ) {
+       QUnit.test( 'T34888 - Tables inside a tableheader cell', function ( assert ) {
                var $table;
                $table = $(
                        '<table class="sortable" id="mw-bug-32888">' +
                }
        );
 
-       QUnit.test( 'Sorting images using alt text', 1, function ( assert ) {
+       QUnit.test( 'Sorting images using alt text', function ( assert ) {
                var $table = $(
                        '<table class="sortable">' +
                                '<tr><th>THEAD</th></tr>' +
                );
        } );
 
-       QUnit.test( 'Sorting images using alt text (complex)', 1, function ( assert ) {
+       QUnit.test( 'Sorting images using alt text (complex)', function ( assert ) {
                var $table = $(
                        '<table class="sortable">' +
                                '<tr><th>THEAD</th></tr>' +
                );
        } );
 
-       QUnit.test( 'Sorting images using alt text (with format autodetection)', 1, function ( assert ) {
+       QUnit.test( 'Sorting images using alt text (with format autodetection)', function ( assert ) {
                var $table = $(
                        '<table class="sortable">' +
                                '<tr><th>THEAD</th></tr>' +
                );
        } );
 
-       QUnit.test( 'T40911 - The row with the largest amount of columns should receive the sort indicators', 3, function ( assert ) {
+       QUnit.test( 'T40911 - The row with the largest amount of columns should receive the sort indicators', function ( assert ) {
                var $table = $(
                        '<table class="sortable">' +
                                '<thead>' +
                );
        } );
 
-       QUnit.test( 'rowspans in table headers should prefer the last row when rows are equal in length', 2, function ( assert ) {
+       QUnit.test( 'rowspans in table headers should prefer the last row when rows are equal in length', function ( assert ) {
                var $table = $(
                        '<table class="sortable">' +
                                '<thead>' +
                );
        } );
 
-       QUnit.test( 'holes in the table headers should not throw JS errors', 2, function ( assert ) {
+       QUnit.test( 'holes in the table headers should not throw JS errors', function ( assert ) {
                var $table = $(
                        '<table class="sortable">' +
                                '<thead>' +
        } );
 
        // T55527
-       QUnit.test( 'td cells in thead should not be taken into account for longest row calculation', 2, function ( assert ) {
+       QUnit.test( 'td cells in thead should not be taken into account for longest row calculation', function ( assert ) {
                var $table = $(
                        '<table class="sortable">' +
                                '<thead>' +
 
        // T55211 - exploding rowspans in more complex cases
        QUnit.test(
-               'Rowspan exploding with row headers and colspans', 1, function ( assert ) {
+               'Rowspan exploding with row headers and colspans', function ( assert ) {
                        var $table = $( '<table class="sortable">' +
                                '<thead><tr><th rowspan="2">n</th><th colspan="2">foo</th><th rowspan="2">baz</th></tr>' +
                                '<tr><th>foo</th><th>bar</th></tr></thead>' +
                ]
        );
 
-       QUnit.test( 'T105731 - incomplete rows in table body', 3, function ( assert ) {
+       QUnit.test( 'T105731 - incomplete rows in table body', function ( assert ) {
                var $table, parsers;
                $table = $(
                        '<table class="sortable">' +
                );
        } );
 
-       QUnit.test( 'bug T114721 - use of expand-child class', 2, function ( assert ) {
+       QUnit.test( 'bug T114721 - use of expand-child class', function ( assert ) {
                var $table, parsers;
                $table = $(
                        '<table class="sortable">' +
index c28d3ce..3ab8428 100644 (file)
                }, opt.after );
 
                QUnit.test( opt.description, function ( assert ) {
-                       var $textarea, start, end, options, text, selected,
-                               tests = 1;
-                       if ( opt.after.selected !== null ) {
-                               tests++;
-                       }
-                       QUnit.expect( tests );
+                       var $textarea, start, end, options, text, selected;
 
                        $textarea = $( '<textarea>' );
 
        } );
 
        function caretTest( options ) {
-               QUnit.test( options.description, 2, function ( assert ) {
+               QUnit.test( options.description, function ( assert ) {
                        var pos,
                                $textarea = $( '<textarea>' ).text( options.text );
 
index 1676130..69ab797 100644 (file)
@@ -6,7 +6,7 @@
                }
        } ) );
 
-       QUnit.test( 'origin is included in GET requests', 1, function ( assert ) {
+       QUnit.test( 'origin is included in GET requests', function ( assert ) {
                var api = new mw.ForeignApi( '//localhost:4242/w/api.php' );
 
                this.server.respond( function ( request ) {
@@ -17,7 +17,7 @@
                return api.get( {} );
        } );
 
-       QUnit.test( 'origin is included in POST requests', 2, function ( assert ) {
+       QUnit.test( 'origin is included in POST requests', function ( assert ) {
                var api = new mw.ForeignApi( '//localhost:4242/w/api.php' );
 
                this.server.respond( function ( request ) {
index a79bff6..8ad1290 100644 (file)
@@ -6,7 +6,7 @@
                }
        } ) );
 
-       QUnit.test( '.getCategoriesByPrefix()', 1, function ( assert ) {
+       QUnit.test( '.getCategoriesByPrefix()', function ( assert ) {
                this.server.respondWith( [ 200, { 'Content-Type': 'application/json' },
                        '{ "query": { "allpages": [ ' +
                                '{ "title": "Category:Food" },' +
index d8b5db8..7282b3f 100644 (file)
@@ -6,7 +6,7 @@
                }
        } ) );
 
-       QUnit.test( '.getMessages()', 1, function ( assert ) {
+       QUnit.test( '.getMessages()', function ( assert ) {
                this.server.respondWith( /ammessages=foo%7Cbaz/, [
                        200,
                        { 'Content-Type': 'application/json' },
index 7ed1875..f3d29c9 100644 (file)
@@ -6,7 +6,7 @@
                }
        } ) );
 
-       QUnit.test( 'saveOption', 2, function ( assert ) {
+       QUnit.test( 'saveOption', function ( assert ) {
                var api = new mw.Api(),
                        stub = this.sandbox.stub( mw.Api.prototype, 'saveOptions' );
 
@@ -16,7 +16,7 @@
                assert.deepEqual( stub.getCall( 0 ).args, [ { foo: 'bar' } ], '#saveOptions called correctly' );
        } );
 
-       QUnit.test( 'saveOptions without Unit Separator', 13, function ( assert ) {
+       QUnit.test( 'saveOptions without Unit Separator', function ( assert ) {
                var api = new mw.Api( { useUS: false } );
 
                // We need to respond to the request for token first, otherwise the other requests won't be sent
@@ -74,7 +74,7 @@
                );
        } );
 
-       QUnit.test( 'saveOptions with Unit Separator', 14, function ( assert ) {
+       QUnit.test( 'saveOptions with Unit Separator', function ( assert ) {
                var api = new mw.Api( { useUS: true } );
 
                // We need to respond to the request for token first, otherwise the other requests won't be sent
index 44d2209..6629f5c 100644 (file)
                }
        } );
 
-       QUnit.test( '#abort', 3, function ( assert ) {
+       QUnit.test( '#abort', function ( assert ) {
                this.api.get( {
                        a: 1
                } );
index b1bd12b..bfaf7f2 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( mw, $ ) {
        QUnit.module( 'mediawiki.api.upload', QUnit.newMwEnvironment( {} ) );
 
-       QUnit.test( 'Basic functionality', 2, function ( assert ) {
+       QUnit.test( 'Basic functionality', function ( assert ) {
                var api = new mw.Api();
                assert.ok( api.upload );
                assert.throws( function () {
@@ -9,7 +9,7 @@
                } );
        } );
 
-       QUnit.test( 'Set up iframe upload', 5, function ( assert ) {
+       QUnit.test( 'Set up iframe upload', function ( assert ) {
                var $iframe, $form, $input,
                        api = new mw.Api();
 
index edc2716..35b6b71 100644 (file)
@@ -3,7 +3,7 @@
 
        // TODO: verify checkboxes == [ 'nsassociated', 'nsinvert' ]
 
-       QUnit.test( '"all" namespace disable checkboxes', 8, function ( assert ) {
+       QUnit.test( '"all" namespace disable checkboxes', function ( assert ) {
                var selectHtml, $env, $options,
                        rc = require( 'mediawiki.special.recentchanges' );
 
index 2388497..97c82fb 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( mw, $ ) {
        QUnit.module( 'mediawiki.RegExp' );
 
-       QUnit.test( 'escape', 16, function ( assert ) {
+       QUnit.test( 'escape', function ( assert ) {
                var specials, normal;
 
                specials = [
index 31a1a28..ca15185 100644 (file)
                }
        } ) );
 
-       QUnit.test( 'constructor', cases.invalid.length, function ( assert ) {
+       QUnit.test( 'constructor', function ( assert ) {
                var i, title;
                for ( i = 0; i < cases.valid.length; i++ ) {
                        title = new mw.Title( cases.valid[ i ] );
                }
        } );
 
-       QUnit.test( 'newFromText', cases.valid.length + cases.invalid.length, function ( assert ) {
+       QUnit.test( 'newFromText', function ( assert ) {
                var i;
                for ( i = 0; i < cases.valid.length; i++ ) {
                        assert.equal(
                }
        } );
 
-       QUnit.test( 'makeTitle', 6, function ( assert ) {
+       QUnit.test( 'makeTitle', function ( assert ) {
                var cases, i, title, expected,
                        NS_MAIN = 0,
                        NS_TALK = 1,
                }
        } );
 
-       QUnit.test( 'Basic parsing', 21, function ( assert ) {
+       QUnit.test( 'Basic parsing', function ( assert ) {
                var title;
                title = new mw.Title( 'File:Foo_bar.JPG' );
 
                assert.equal( title.getPrefixedText(), '.foo' );
        } );
 
-       QUnit.test( 'Transformation', 12, function ( assert ) {
+       QUnit.test( 'Transformation', function ( assert ) {
                var title;
 
                title = new mw.Title( 'File:quux pif.jpg' );
                assert.equal( title.getFragment(), ' foo bar baz', 'Fragment' );
        } );
 
-       QUnit.test( 'Namespace detection and conversion', 10, function ( assert ) {
+       QUnit.test( 'Namespace detection and conversion', function ( assert ) {
                var title;
 
                title = new mw.Title( 'File:User:Example' );
                assert.equal( title.toString(), 'Penguins:Flightless_yet_cute.jpg' );
        } );
 
-       QUnit.test( 'Throw error on invalid title', 1, function ( assert ) {
+       QUnit.test( 'Throw error on invalid title', function ( assert ) {
                assert.throws( function () {
                        return new mw.Title( '' );
                }, 'Throw error on empty string' );
        } );
 
-       QUnit.test( 'Case-sensivity', 5, function ( assert ) {
+       QUnit.test( 'Case-sensivity', function ( assert ) {
                var title;
 
                // Default config
                assert.equal( title.toString(), 'User:John', '$wgCapitalLinks=false: User namespace is insensitive, first-letter becomes uppercase' );
        } );
 
-       QUnit.test( 'toString / toText', 2, function ( assert ) {
+       QUnit.test( 'toString / toText', function ( assert ) {
                var title = new mw.Title( 'Some random page' );
 
                assert.equal( title.toString(), title.getPrefixedDb() );
                assert.equal( title.toText(), title.getPrefixedText() );
        } );
 
-       QUnit.test( 'getExtension', 7, function ( assert ) {
+       QUnit.test( 'getExtension', function ( assert ) {
                function extTest( pagename, ext, description ) {
                        var title = new mw.Title( pagename );
                        assert.equal( title.getExtension(), ext, description || pagename );
                // extTest( '.NET', null, 'Leading dot is (or is not?) an extension' );
        } );
 
-       QUnit.test( 'exists', 3, function ( assert ) {
+       QUnit.test( 'exists', function ( assert ) {
                var title;
 
                // Empty registry, checks default to null
 
        } );
 
-       QUnit.test( 'getUrl', 4, function ( assert ) {
+       QUnit.test( 'getUrl', function ( assert ) {
                var title;
                mw.config.set( {
                        wgScript: '/w/index.php',
                assert.equal( title.getUrl( { meme: true } ), '/w/index.php?title=User_talk:John_Cena&meme=true#And_His_Name_Is', 'title with fragment and query parameter' );
        } );
 
-       QUnit.test( 'newFromImg', 44, function ( assert ) {
+       QUnit.test( 'newFromImg', function ( assert ) {
                var title, i, thisCase, prefix,
                        cases = [
                                {
                }
        } );
 
-       QUnit.test( 'getRelativeText', 5, function ( assert ) {
+       QUnit.test( 'getRelativeText', function ( assert ) {
                var i, thisCase, title,
                        cases = [
                                {
                }
        } );
 
-       QUnit.test( 'normalizeExtension', 5, function ( assert ) {
+       QUnit.test( 'normalizeExtension', function ( assert ) {
                var extension, i, thisCase, prefix,
                        cases = [
                                {
                }
        } );
 
-       QUnit.test( 'newFromUserInput', 12, function ( assert ) {
+       QUnit.test( 'newFromUserInput', function ( assert ) {
                var title, i, thisCase, prefix,
                        cases = [
                                {
                }
        } );
 
-       QUnit.test( 'newFromFileName', 54, function ( assert ) {
+       QUnit.test( 'newFromFileName', function ( assert ) {
                var title, i, thisCase, prefix,
                        cases = [
                                {
index ef0d5e5..e20fc4c 100644 (file)
@@ -11,7 +11,7 @@
        } ) );
 
        $.each( [ true, false ], function ( i, strictMode ) {
-               QUnit.test( 'Basic construction and properties (' + ( strictMode ? '' : 'non-' ) + 'strict mode)', 2, function ( assert ) {
+               QUnit.test( 'Basic construction and properties (' + ( strictMode ? '' : 'non-' ) + 'strict mode)', function ( assert ) {
                        var uriString, uri;
                        uriString = 'http://www.ietf.org/rfc/rfc2396.txt';
                        uri = new mw.Uri( uriString, {
@@ -59,7 +59,7 @@
                } );
        } );
 
-       QUnit.test( 'Constructor( String[, Object ] )', 11, function ( assert ) {
+       QUnit.test( 'Constructor( String[, Object ] )', function ( assert ) {
                var uri;
 
                uri = new mw.Uri( 'http://www.example.com/dir/?m=foo&m=bar&n=1', {
                /*jshint +W001 */
        } );
 
-       QUnit.test( 'Constructor( Object )', 3, function ( assert ) {
+       QUnit.test( 'Constructor( Object )', function ( assert ) {
                var uri = new mw.Uri( {
                        protocol: 'http',
                        host: 'www.foo.local',
                );
        } );
 
-       QUnit.test( 'Constructor( empty[, Object ] )', 5, function ( assert ) {
+       QUnit.test( 'Constructor( empty[, Object ] )', function ( assert ) {
                var testuri, MyUri, uri;
 
                testuri = 'http://example.org/w/index.php?a=1&a=2';
                assert.deepEqual( uri.query, { a: '2' }, 'null, with options' );
        } );
 
-       QUnit.test( 'Properties', 8, function ( assert ) {
+       QUnit.test( 'Properties', function ( assert ) {
                var uriBase, uri;
 
                uriBase = new mw.Uri( 'http://en.wiki.local/w/api.php' );
                assert.ok( uri.toString().indexOf( 'pif=paf' ) >= 0, 'extend query arguments' );
        } );
 
-       QUnit.test( '.getQueryString()', 2, function ( assert ) {
+       QUnit.test( '.getQueryString()', function ( assert ) {
                var uri = new mw.Uri( 'http://search.example.com/?q=uri' );
 
                assert.deepEqual(
 
        } );
 
-       QUnit.test( '.clone()', 6, function ( assert ) {
+       QUnit.test( '.clone()', function ( assert ) {
                var original, clone;
 
                original = new mw.Uri( 'http://foo.example.org/index.php?one=1&two=2' );
                );
        } );
 
-       QUnit.test( '.toString() after query manipulation', 8, function ( assert ) {
+       QUnit.test( '.toString() after query manipulation', function ( assert ) {
                var uri;
 
                uri = new mw.Uri( 'http://www.example.com/dir/?m=foo&m=bar&n=1', {
                assert.equal( uri.toString(), 'http://www.example.com/dir/', 'empty array value is ommitted' );
        } );
 
-       QUnit.test( 'Variable defaultUri', 2, function ( assert ) {
+       QUnit.test( 'Variable defaultUri', function ( assert ) {
                var uri,
                        href = 'http://example.org/w/index.php#here',
                        UriClass = mw.UriRelative( function () {
                );
        } );
 
-       QUnit.test( 'Advanced URL', 11, function ( assert ) {
+       QUnit.test( 'Advanced URL', function ( assert ) {
                var uri, queryString, relativePath;
 
                uri = new mw.Uri( 'http://auth@www.example.com:81/dir/dir.2/index.htm?q1=0&&test1&test2=value+%28escaped%29#top' );
                assert.ok( relativePath.indexOf( uri.fragment ) >= 0, 'fragment in relative path' );
        } );
 
-       QUnit.test( 'Parse a uri with an @ symbol in the path and query', 1, function ( assert ) {
+       QUnit.test( 'Parse a uri with an @ symbol in the path and query', function ( assert ) {
                var uri = new mw.Uri( 'http://www.example.com/test@test?x=@uri&y@=uri&z@=@' );
 
                assert.deepEqual(
                );
        } );
 
-       QUnit.test( 'Handle protocol-relative URLs', 5, function ( assert ) {
+       QUnit.test( 'Handle protocol-relative URLs', function ( assert ) {
                var UriRel, uri;
 
                UriRel = mw.UriRelative( 'glork://en.wiki.local/foo.php' );
                assert.equal( uri.toString(), 'http://en.wiki.local/foo.com', 'handle absolute paths by supplying host from document in strict mode' );
        } );
 
-       QUnit.test( 'T37658', 2, function ( assert ) {
+       QUnit.test( 'T37658', function ( assert ) {
                var testProtocol, testServer, testPort, testPath, UriClass, uri, href;
 
                testProtocol = 'https://';
index 399db91..02212cb 100644 (file)
@@ -62,7 +62,7 @@
        };
 
        function pluralTest( langCode, tests ) {
-               QUnit.test( 'Plural Test for ' + langCode, tests.length, function ( assert ) {
+               QUnit.test( 'Plural Test for ' + langCode, function ( assert ) {
                        for ( var i = 0; i < tests.length; i++ ) {
                                assert.equal(
                                        mw.language.convertPlural( tests[ i ][ 0 ], tests[ i ][ 1 ] ),
index 7a13f0f..59bf737 100644 (file)
@@ -20,7 +20,7 @@
                }
        } ) );
 
-       QUnit.test( 'set( key, value )', 7, function ( assert ) {
+       QUnit.test( 'set( key, value )', function ( assert ) {
                var call;
 
                // Simple case
@@ -53,7 +53,7 @@
                assert.strictEqual( call[ 1 ], '0', '0 is value' );
        } );
 
-       QUnit.test( 'set( key, value, expires )', 6, function ( assert ) {
+       QUnit.test( 'set( key, value, expires )', function ( assert ) {
                var date, options;
 
                date = new Date();
@@ -91,7 +91,7 @@
                assert.strictEqual( options.expires, date, 'custom expiration (with wgCookieExpiration=0)' );
        } );
 
-       QUnit.test( 'set( key, value, options )', 4, function ( assert ) {
+       QUnit.test( 'set( key, value, options )', function ( assert ) {
                var date, call;
 
                mw.cookie.set( 'foo', 'bar', {
                }, 'Options (incl. expires)' );
        } );
 
-       QUnit.test( 'get( key ) - no values', 6, function ( assert ) {
+       QUnit.test( 'get( key ) - no values', function ( assert ) {
                var key, value;
 
                mw.cookie.get( 'foo' );
                assert.strictEqual( value, 'bar', 'Custom default value' );
        } );
 
-       QUnit.test( 'get( key ) - with value', 1, function ( assert ) {
+       QUnit.test( 'get( key ) - with value', function ( assert ) {
                var value;
 
                $.cookie.returns( 'bar' );
                assert.strictEqual( value, 'bar', 'Return value of cookie' );
        } );
 
-       QUnit.test( 'get( key, prefix )', 1, function ( assert ) {
+       QUnit.test( 'get( key, prefix )', function ( assert ) {
                var key;
 
                mw.cookie.get( 'foo', 'bar' );
index 587c893..bc0ef40 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( $, mw ) {
        QUnit.module( 'mediawiki.errorLogger', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'installGlobalHandler', 7, function ( assert ) {
+       QUnit.test( 'installGlobalHandler', function ( assert ) {
                var w = {},
                        errorMessage = 'Foo',
                        errorUrl = 'http://example.com',
index 774b205..177c358 100644 (file)
@@ -17,7 +17,7 @@
 
        QUnit.module( 'mediawiki.experiments' );
 
-       QUnit.test( 'getBucket( experiment, token )', 4, function ( assert ) {
+       QUnit.test( 'getBucket( experiment, token )', function ( assert ) {
                var experiment = createExperiment(),
                        token = '123457890';
 
index b4028ec..16f8cf3 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( mw ) {
        QUnit.module( 'mediawiki.html' );
 
-       QUnit.test( 'escape', 2, function ( assert ) {
+       QUnit.test( 'escape', function ( assert ) {
                assert.throws(
                        function () {
                                mw.html.escape();
@@ -17,7 +17,7 @@
                );
        } );
 
-       QUnit.test( 'element()', 1, function ( assert ) {
+       QUnit.test( 'element()', function ( assert ) {
                assert.equal(
                        mw.html.element(),
                        '<undefined/>',
                );
        } );
 
-       QUnit.test( 'element( tagName )', 1, function ( assert ) {
+       QUnit.test( 'element( tagName )', function ( assert ) {
                assert.equal( mw.html.element( 'div' ), '<div/>', 'DIV' );
        } );
 
-       QUnit.test( 'element( tagName, attrs )', 2, function ( assert ) {
+       QUnit.test( 'element( tagName, attrs )', function ( assert ) {
                assert.equal( mw.html.element( 'div', {} ), '<div/>', 'DIV' );
 
                assert.equal(
@@ -43,7 +43,7 @@
                );
        } );
 
-       QUnit.test( 'element( tagName, attrs, content )', 8, function ( assert ) {
+       QUnit.test( 'element( tagName, attrs, content )', function ( assert ) {
 
                assert.equal( mw.html.element( 'div', {}, '' ), '<div></div>', 'DIV with empty attributes and content' );
 
index f848f3e..eff990c 100644 (file)
                next();
        }
 
-       QUnit.test( 'Replace', 15, function ( assert ) {
+       QUnit.test( 'Replace', function ( assert ) {
                mw.messages.set( 'simple', 'Foo $1 baz $2' );
 
                assert.equal( formatParse( 'simple' ), 'Foo $1 baz $2', 'Replacements with no substitutes' );
                );
        } );
 
-       QUnit.test( 'Plural', 9, function ( assert ) {
+       QUnit.test( 'Plural', function ( assert ) {
                assert.equal( formatParse( 'plural-msg', 0 ), 'Found 0 items', 'Plural test for english with zero as count' );
                assert.equal( formatParse( 'plural-msg', 1 ), 'Found 1 item', 'Singular test for english' );
                assert.equal( formatParse( 'plural-msg', 2 ), 'Found 2 items', 'Plural test for english' );
                assert.equal( formatParse( 'plural-empty-explicit-form', 2 ), 'There is me and other people.' );
        } );
 
-       QUnit.test( 'Gender', 15, function ( assert ) {
+       QUnit.test( 'Gender', function ( assert ) {
                var originalGender = mw.user.options.get( 'gender' );
 
                // TODO: These tests should be for mw.msg once mw.msg integrated with mw.jqueryMsg
                mw.user.options.set( 'gender', originalGender );
        } );
 
-       QUnit.test( 'Case changing', 8, function ( assert ) {
+       QUnit.test( 'Case changing', function ( assert ) {
                mw.messages.set( 'to-lowercase', '{{lc:thIS hAS MEsSed uP CapItaliZatiON}}' );
                assert.equal( formatParse( 'to-lowercase' ), 'this has messed up capitalization', 'To lowercase' );
 
                assert.equal( formatParse( 'all-caps-except-first' ), 'tHIS HAS MESSED UP CAPITALIZATION', 'To opposite sentence case' );
        } );
 
-       QUnit.test( 'Grammar', 2, function ( assert ) {
+       QUnit.test( 'Grammar', function ( assert ) {
                assert.equal( formatParse( 'grammar-msg' ), 'Przeszukaj Wiki', 'Grammar Test with sitename' );
 
                mw.messages.set( 'grammar-msg-wrong-syntax', 'Przeszukaj {{GRAMMAR:grammar_case_xyz}}' );
                assert.equal( formatParse( 'grammar-msg-wrong-syntax' ), 'Przeszukaj ', 'Grammar Test with wrong grammar template syntax' );
        } );
 
-       QUnit.test( 'Match PHP parser', mw.libs.phpParserData.tests.length, function ( assert ) {
+       QUnit.test( 'Match PHP parser', function ( assert ) {
                mw.messages.set( mw.libs.phpParserData.messages );
                var tasks = $.map( mw.libs.phpParserData.tests, function ( test ) {
                        var done = assert.async();
                process( tasks );
        } );
 
-       QUnit.test( 'Links', 15, function ( assert ) {
+       QUnit.test( 'Links', function ( assert ) {
                var testCases,
                        expectedDisambiguationsText,
                        expectedMultipleBars,
                } );
        } );
 
-       QUnit.test( 'Replacements in links', 14, function ( assert ) {
+       QUnit.test( 'Replacements in links', function ( assert ) {
                var testCases = [
                        [
                                'extlink-param-href-full',
        } );
 
        // Tests that {{-transformation vs. general parsing are done as requested
-       QUnit.test( 'Curly brace transformation', 16, function ( assert ) {
+       QUnit.test( 'Curly brace transformation', function ( assert ) {
                var oldUserLang = mw.config.get( 'wgUserLanguage' );
 
                assertBothModes( assert, [ 'gender-msg', 'Bob', 'male' ], 'Bob: blue', 'gender is resolved' );
                mw.config.set( 'wgUserLanguage', oldUserLang );
        } );
 
-       QUnit.test( 'Int', 4, function ( assert ) {
+       QUnit.test( 'Int', function ( assert ) {
                var newarticletextSource = 'You have followed a link to a page that does not exist yet. To create the page, start typing in the box below (see the [[{{Int:Foobar}}|foobar]] for more info). If you are here by mistake, click your browser\'s back button.',
                        expectedNewarticletext,
                        helpPageTitle = 'Help:Foobar';
                );
        } );
 
-       QUnit.test( 'Ns', 4, function ( assert ) {
+       QUnit.test( 'Ns', function ( assert ) {
                mw.messages.set( 'ns-template-talk', '{{ns:Template talk}}' );
                assert.equal(
                        formatParse( 'ns-template-talk' ),
 
        // Tests that getMessageFunction is used for non-plain messages with curly braces or
        // square brackets, but not otherwise.
-       QUnit.test( 'mw.Message.prototype.parser monkey-patch', 22, function ( assert ) {
+       QUnit.test( 'mw.Message.prototype.parser monkey-patch', function ( assert ) {
                var oldGMF, outerCalled, innerCalled;
 
                mw.messages.set( {
                }
        ];
 
-       QUnit.test( 'formatnum', formatnumTests.length, function ( assert ) {
+       QUnit.test( 'formatnum', function ( assert ) {
                mw.messages.set( 'formatnum-msg', '{{formatnum:$1}}' );
                mw.messages.set( 'formatnum-msg-int', '{{formatnum:$1|R}}' );
                var queue = $.map( formatnumTests, function ( test ) {
        } );
 
        // HTML in wikitext
-       QUnit.test( 'HTML', 33, function ( assert ) {
+       QUnit.test( 'HTML', function ( assert ) {
                mw.messages.set( 'jquerymsg-italics-msg', '<i>Very</i> important' );
 
                assertBothModes( assert, [ 'jquerymsg-italics-msg' ], mw.messages.get( 'jquerymsg-italics-msg' ), 'Simple italics unchanged' );
                );
        } );
 
-       QUnit.test( 'Nowiki', 3, function ( assert ) {
+       QUnit.test( 'Nowiki', function ( assert ) {
                mw.messages.set( 'jquerymsg-nowiki-link', 'Foo <nowiki>[[bar]]</nowiki> baz.' );
                assert.equal(
                        formatParse( 'jquerymsg-nowiki-link' ),
                );
        } );
 
-       QUnit.test( 'Behavior in case of invalid wikitext', 3, function ( assert ) {
+       QUnit.test( 'Behavior in case of invalid wikitext', function ( assert ) {
                mw.messages.set( 'invalid-wikitext', '<b>{{FAIL}}</b>' );
 
                this.suppressWarnings();
                assert.equal( logSpy.callCount, 2, 'mw.log.warn calls' );
        } );
 
-       QUnit.test( 'Integration', 5, function ( assert ) {
+       QUnit.test( 'Integration', function ( assert ) {
                var expected, logSpy, msg;
 
                expected = '<b><a title="Bold" href="/wiki/Bold">Bold</a>!</b>';
index 34fe9bf..b0b2e7a 100644 (file)
@@ -5,7 +5,7 @@
 ( function ( $ ) {
        QUnit.module( 'mediawiki.jscompat', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'Variable with Unicode letter in name', 3, function ( assert ) {
+       QUnit.test( 'Variable with Unicode letter in name', function ( assert ) {
                var orig, ŝablono;
 
                orig = 'some token';
@@ -44,7 +44,6 @@
                        expected, $textarea;
 
                maxn = 4;
-               QUnit.expect( maxn * 2 );
 
                function repeat( str, n ) {
                        var out;
index 2171f34..46cf1e8 100644 (file)
@@ -17,7 +17,7 @@
                }
        } ) );
 
-       QUnit.test( 'mw.language getData and setData', 3, function ( assert ) {
+       QUnit.test( 'mw.language getData and setData', function ( assert ) {
                mw.language.setData( 'en', 'testkey', 'testvalue' );
                assert.equal( mw.language.getData( 'en', 'testkey' ), 'testvalue', 'Getter setter test for mw.language' );
                assert.equal( mw.language.getData( 'en', 'invalidkey' ), undefined, 'Getter setter test for mw.language with invalid key' );
@@ -25,7 +25,7 @@
                assert.equal( mw.language.getData( 'en-US', 'testkey' ), 'testvalue', 'Case insensitive test for mw.language' );
        } );
 
-       QUnit.test( 'mw.language.commafy test', 9, function ( assert ) {
+       QUnit.test( 'mw.language.commafy test', function ( assert ) {
                mw.language.setData( 'en', 'digitGroupingPattern', null );
                mw.language.setData( 'en', 'digitTransformTable', null );
                mw.language.setData( 'en', 'separatorTransformTable', null );
@@ -43,7 +43,7 @@
                assert.equal( mw.language.commafy( 123456789.567, '###,###,#0.00' ), '1,234,567,89.56', 'Decimal part as group of 3 and last one 2' );
        } );
 
-       QUnit.test( 'mw.language.convertNumber', 2, function ( assert ) {
+       QUnit.test( 'mw.language.convertNumber', function ( assert ) {
                mw.language.setData( 'en', 'digitGroupingPattern', null );
                mw.language.setData( 'en', 'digitTransformTable', null );
                mw.language.setData( 'en', 'separatorTransformTable', { ',': '.', '.': ',' } );
@@ -57,7 +57,6 @@
                // The test works only if the content language is opt.language
                // because it requires [lang].js to be loaded.
                QUnit.test( 'Grammar test for lang=' + langCode, function ( assert ) {
-                       QUnit.expect( test.length );
 
                        for ( var i = 0; i < test.length; i++ ) {
                                assert.equal(
                }
        } );
 
-       QUnit.test( 'List to text test', 4, function ( assert ) {
+       QUnit.test( 'List to text test', function ( assert ) {
                assert.equal( mw.language.listToText( [] ), '', 'Blank list' );
                assert.equal( mw.language.listToText( [ 'a' ] ), 'a', 'Single item' );
                assert.equal( mw.language.listToText( [ 'a', 'b' ] ), 'a and b', 'Two items' );
index fcf80bd..fb3bedb 100644 (file)
@@ -75,7 +75,7 @@
                );
        }
 
-       QUnit.test( 'Basic', 2, function ( assert ) {
+       QUnit.test( 'Basic', function ( assert ) {
                var isAwesomeDone;
 
                mw.loader.testCallback = function () {
@@ -94,7 +94,7 @@
                } );
        } );
 
-       QUnit.test( 'Object method as module name', 2, function ( assert ) {
+       QUnit.test( 'Object method as module name', function ( assert ) {
                var isAwesomeDone;
 
                mw.loader.testCallback = function () {
                } );
        } );
 
-       QUnit.test( '.using( .. ) Promise', 2, function ( assert ) {
+       QUnit.test( '.using( .. ) Promise', function ( assert ) {
                var isAwesomeDone;
 
                mw.loader.testCallback = function () {
                ).always( done );
        } );
 
-       QUnit.test( '.load() - Error: Unregistered (ignored)', 0, function ( assert ) {
+       QUnit.test( '.load() - Error: Unregistered (ignored)', function ( assert ) {
+               assert.expect( 0 );
                mw.loader.load( 'test.using.unreg2' );
        } );
 
-       QUnit.test( '.implement( styles={ "css": [text, ..] } )', 2, function ( assert ) {
+       QUnit.test( '.implement( styles={ "css": [text, ..] } )', function ( assert ) {
                var $element = $( '<div class="mw-test-implement-a"></div>' ).appendTo( '#qunit-fixture' );
 
                assert.notEqual(
                return mw.loader.using( 'test.implement.a' );
        } );
 
-       QUnit.test( '.implement( styles={ "url": { <media>: [url, ..] } } )', 7, function ( assert ) {
+       QUnit.test( '.implement( styles={ "url": { <media>: [url, ..] } } )', function ( assert ) {
                var $element1 = $( '<div class="mw-test-implement-b1"></div>' ).appendTo( '#qunit-fixture' ),
                        $element2 = $( '<div class="mw-test-implement-b2"></div>' ).appendTo( '#qunit-fixture' ),
                        $element3 = $( '<div class="mw-test-implement-b3"></div>' ).appendTo( '#qunit-fixture' ),
        } );
 
        // Backwards compatibility
-       QUnit.test( '.implement( styles={ <media>: text } ) (back-compat)', 2, function ( assert ) {
+       QUnit.test( '.implement( styles={ <media>: text } ) (back-compat)', function ( assert ) {
                var $element = $( '<div class="mw-test-implement-c"></div>' ).appendTo( '#qunit-fixture' );
 
                assert.notEqual(
        } );
 
        // Backwards compatibility
-       QUnit.test( '.implement( styles={ <media>: [url, ..] } ) (back-compat)', 4, function ( assert ) {
+       QUnit.test( '.implement( styles={ <media>: [url, ..] } ) (back-compat)', function ( assert ) {
                var $element = $( '<div class="mw-test-implement-d"></div>' ).appendTo( '#qunit-fixture' ),
                        $element2 = $( '<div class="mw-test-implement-d2"></div>' ).appendTo( '#qunit-fixture' ),
                        done = assert.async();
        } );
 
        // @import (T33676)
-       QUnit.test( '.implement( styles has @import )', 7, function ( assert ) {
+       QUnit.test( '.implement( styles has @import )', function ( assert ) {
                var isJsExecuted, $element,
                        done = assert.async();
 
                } );
        } );
 
-       QUnit.test( '.implement( dependency with styles )', 4, function ( assert ) {
+       QUnit.test( '.implement( dependency with styles )', function ( assert ) {
                var $element = $( '<div class="mw-test-implement-e"></div>' ).appendTo( '#qunit-fixture' ),
                        $element2 = $( '<div class="mw-test-implement-e2"></div>' ).appendTo( '#qunit-fixture' );
 
                return mw.loader.using( 'test.implement.e' );
        } );
 
-       QUnit.test( '.implement( only scripts )', 1, function ( assert ) {
+       QUnit.test( '.implement( only scripts )', function ( assert ) {
                mw.loader.implement( 'test.onlyscripts', function () {} );
                assert.strictEqual( mw.loader.getState( 'test.onlyscripts' ), 'ready' );
        } );
 
-       QUnit.test( '.implement( only messages )', 2, function ( assert ) {
+       QUnit.test( '.implement( only messages )', function ( assert ) {
                assert.assertFalse( mw.messages.exists( 'T31107' ), 'Verify that the test message doesn\'t exist yet' );
 
                mw.loader.implement( 'test.implement.msgs', [], {}, { T31107: 'loaded' } );
                } );
        } );
 
-       QUnit.test( '.implement( empty )', 1, function ( assert ) {
+       QUnit.test( '.implement( empty )', function ( assert ) {
                mw.loader.implement( 'test.empty' );
                assert.strictEqual( mw.loader.getState( 'test.empty' ), 'ready' );
        } );
 
-       QUnit.test( 'Broken indirect dependency', 4, function ( assert ) {
+       QUnit.test( 'Broken indirect dependency', function ( assert ) {
                // don't emit an error event
                this.sandbox.stub( mw, 'track' );
 
                assert.strictEqual( mw.track.callCount, 1 );
        } );
 
-       QUnit.test( 'Out-of-order implementation', 9, function ( assert ) {
+       QUnit.test( 'Out-of-order implementation', function ( assert ) {
                mw.loader.register( [
                        [ 'test.module4', '0' ],
                        [ 'test.module5', '0', [ 'test.module4' ] ],
                assert.strictEqual( mw.loader.getState( 'test.module6' ), 'ready', 'Expected "ready" state for test.module6' );
        } );
 
-       QUnit.test( 'Missing dependency', 13, function ( assert ) {
+       QUnit.test( 'Missing dependency', function ( assert ) {
                mw.loader.register( [
                        [ 'test.module7', '0' ],
                        [ 'test.module8', '0', [ 'test.module7' ] ],
                );
        } );
 
-       QUnit.test( 'Dependency handling', 5, function ( assert ) {
+       QUnit.test( 'Dependency handling', function ( assert ) {
                var done = assert.async();
                mw.loader.register( [
                        // [module, version, dependencies, group, source]
                );
        } );
 
-       QUnit.test( 'Skip-function handling', 5, function ( assert ) {
+       QUnit.test( 'Skip-function handling', function ( assert ) {
                mw.loader.register( [
                        // [module, version, dependencies, group, source, skip]
                        [ 'testSkipped', '1', [], null, 'testloader', 'return true;' ],
                );
        } );
 
-       QUnit.asyncTest( '.load( "//protocol-relative" ) - T32825', 2, function ( assert ) {
+       QUnit.asyncTest( '.load( "//protocol-relative" ) - T32825', function ( assert ) {
                // This bug was actually already fixed in 1.18 and later when discovered in 1.17.
                // Test is for regressions!
 
                mw.loader.load( target );
        } );
 
-       QUnit.asyncTest( '.load( "/absolute-path" )', 2, function ( assert ) {
+       QUnit.asyncTest( '.load( "/absolute-path" )', function ( assert ) {
                // Forge a URL to the test callback script
                var target = QUnit.fixurl(
                        mw.config.get( 'wgScriptPath' ) + '/tests/qunit/data/qunitOkCall.js'
                } );
        } );
 
-       QUnit.test( 'Executing race - T112232', 2, function ( assert ) {
+       QUnit.test( 'Executing race - T112232', function ( assert ) {
                var done = false;
 
                // The red herring schedules its CSS buffer first. In T112232, a bug in the
                        } );
        } );
 
-       QUnit.test( 'require()', 6, function ( assert ) {
+       QUnit.test( 'require()', function ( assert ) {
                mw.loader.register( [
                        [ 'test.require1', '0' ],
                        [ 'test.require2', '0' ],
index b3c4bee..923f97d 100644 (file)
@@ -7,7 +7,7 @@
                }
        } ) );
 
-       QUnit.test( 'register', 2, function ( assert ) {
+       QUnit.test( 'register', function ( assert ) {
                var testMessagePosterConstructor = function () {};
 
                mw.messagePoster.factory.register( TEST_MODEL, testMessagePosterConstructor );
index 38ae5e4..cb583e7 100644 (file)
@@ -10,7 +10,7 @@
                }
        } );
 
-       QUnit.test( 'render', 2, function ( assert ) {
+       QUnit.test( 'render', function ( assert ) {
                var html, htmlPartial, data, partials,
                        template = mw.template.get( 'stub', 'test_greeting.mustache' ),
                        partial = mw.template.get( 'stub', 'test_greeting_suffix.mustache' );
index 86fd828..a282325 100644 (file)
@@ -24,7 +24,7 @@
                }
        } );
 
-       QUnit.test( 'add', 1, function ( assert ) {
+       QUnit.test( 'add', function ( assert ) {
                assert.throws(
                        function () {
                                mw.template.add( 'module', 'test_templates_foo', 'hello' );
@@ -33,7 +33,7 @@
                );
        } );
 
-       QUnit.test( 'compile', 1, function ( assert ) {
+       QUnit.test( 'compile', function ( assert ) {
                assert.throws(
                        function () {
                                mw.template.compile( '{{foo}}', 'rainbow' );
@@ -42,7 +42,7 @@
                );
        } );
 
-       QUnit.test( 'get', 4, function ( assert ) {
+       QUnit.test( 'get', function ( assert ) {
                assert.strictEqual( mw.template.get( 'test.mediawiki.template', 'test_templates_foo.xyz' ), 'xyz compiler' );
                assert.strictEqual( mw.template.get( 'test.mediawiki.template', 'test_templates_foo.abc' ), 'abc default compiler' );
                assert.throws(
index 65b7263..d3e73ae 100644 (file)
@@ -31,7 +31,7 @@
                }
        } ) );
 
-       QUnit.test( 'Initial check', 8, function ( assert ) {
+       QUnit.test( 'Initial check', function ( assert ) {
                assert.ok( window.jQuery, 'jQuery defined' );
                assert.ok( window.$, '$ defined' );
                assert.strictEqual( window.$, window.jQuery, '$ alias to jQuery' );
@@ -51,7 +51,7 @@
                this.restoreWarnings();
        } );
 
-       QUnit.test( 'mw.format', 2, function ( assert ) {
+       QUnit.test( 'mw.format', function ( assert ) {
                assert.equal(
                        mw.format( 'Format $1 $2', 'foo', 'bar' ),
                        'Format foo bar',
 
        } );
 
-       QUnit.test( 'mw.msg', 14, function ( assert ) {
+       QUnit.test( 'mw.msg', function ( assert ) {
                assert.ok( mw.messages.set( 'hello', 'Hello <b>awesome</b> world' ), 'mw.messages.set: Register' );
                assert.equal( mw.msg( 'hello' ), 'Hello <b>awesome</b> world', 'Gets message with default options (existing message)' );
                assert.equal( mw.msg( 'goodbye' ), '⧼goodbye⧽', 'Gets message with default options (nonexistent message)' );
                assert.equal( mw.msg( 'int-msg' ), 'Some Other Message', 'int is resolved' );
        } );
 
-       QUnit.test( 'mw.hook', 13, function ( assert ) {
+       QUnit.test( 'mw.hook', function ( assert ) {
                var hook, add, fire, chars, callback;
 
                mw.hook( 'test.hook.unfired' ).add( function () {
index 89eb45f..297f0fd 100644 (file)
@@ -6,7 +6,7 @@
                }
        } ) );
 
-       QUnit.asyncTest( 'toggleToc', 4, function ( assert ) {
+       QUnit.asyncTest( 'toggleToc', function ( assert ) {
                var tocHtml, $toggleLink, $tocList;
 
                assert.strictEqual( $( '#toc' ).length, 0, 'There is no table of contents on the page at the beginning' );
index 5329be6..6c27c5b 100644 (file)
@@ -1,7 +1,7 @@
 ( function ( mw ) {
        QUnit.module( 'mediawiki.track' );
 
-       QUnit.test( 'track', 1, function ( assert ) {
+       QUnit.test( 'track', function ( assert ) {
                var sequence = [];
                mw.trackSubscribe( 'simple', function ( topic, data ) {
                        sequence.push( [ topic, data ] );
@@ -15,7 +15,7 @@
                ], 'Events after subscribing' );
        } );
 
-       QUnit.test( 'trackSubscribe', 4, function ( assert ) {
+       QUnit.test( 'trackSubscribe', function ( assert ) {
                var now,
                        sequence = [];
                mw.track( 'before', { key: 1 } );
@@ -40,7 +40,7 @@
                } );
        } );
 
-       QUnit.test( 'trackUnsubscribe', 1, function ( assert ) {
+       QUnit.test( 'trackUnsubscribe', function ( assert ) {
                var sequence = [];
                function unsubber( topic, data ) {
                        sequence.push( [ topic, data ] );
index 88052de..ac5b3f8 100644 (file)
                }
        } ) );
 
-       QUnit.test( 'rawurlencode', 1, function ( assert ) {
+       QUnit.test( 'rawurlencode', function ( assert ) {
                assert.equal( mw.util.rawurlencode( 'Test:A & B/Here' ), 'Test%3AA%20%26%20B%2FHere' );
        } );
 
-       QUnit.test( 'escapeId', 17, function ( assert ) {
+       QUnit.test( 'escapeId', function ( assert ) {
                mw.config.set( 'wgExperimentalHtmlIds', false );
                $.each( {
                        '+': '.2B',
                } );
        } );
 
-       QUnit.test( 'wikiUrlencode', 11, function ( assert ) {
+       QUnit.test( 'wikiUrlencode', function ( assert ) {
                assert.equal( mw.util.wikiUrlencode( 'Test:A & B/Here' ), 'Test:A_%26_B/Here' );
                // See also wfUrlencodeTest.php#provideURLS
                $.each( {
                } );
        } );
 
-       QUnit.test( 'getUrl', 14, function ( assert ) {
+       QUnit.test( 'getUrl', function ( assert ) {
                var href;
                mw.config.set( {
                        wgScript: '/w/index.php',
                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' );
        } );
 
-       QUnit.test( 'wikiScript', 4, function ( assert ) {
+       QUnit.test( 'wikiScript', function ( assert ) {
                mw.config.set( {
                        // customized wgScript for T41103
                        wgScript: '/w/i.php',
                assert.equal( mw.util.wikiScript( 'api' ), '/w/api.php', 'API path' );
        } );
 
-       QUnit.test( 'addCSS', 3, function ( assert ) {
+       QUnit.test( 'addCSS', function ( assert ) {
                var $el, style;
                $el = $( '<div>' ).attr( 'id', 'mw-addcsstest' ).appendTo( '#qunit-fixture' );
 
                $( style.ownerNode ).remove();
        } );
 
-       QUnit.test( 'getParamValue', 5, function ( assert ) {
+       QUnit.test( 'getParamValue', function ( assert ) {
                var url;
 
                url = 'http://example.org/?foo=wrong&foo=right#&foo=bad';
                assert.strictEqual( mw.util.getParamValue( 'TEST', url ), 'a b+c d', 'T32441: getParamValue must understand "+" encoding of space (multiple spaces)' );
        } );
 
-       QUnit.test( '$content', 2, function ( assert ) {
+       QUnit.test( '$content', function ( assert ) {
                assert.ok( mw.util.$content instanceof jQuery, 'mw.util.$content instance of jQuery' );
                assert.strictEqual( mw.util.$content.length, 1, 'mw.util.$content must have length of 1' );
        } );
         * Previously, test elements where invisible to the selector since only
         * one element can have a given id.
         */
-       QUnit.test( 'addPortletLink', 13, function ( assert ) {
+       QUnit.test( 'addPortletLink', function ( assert ) {
                var pTestTb, pCustom, vectorTabs, tbRL, cuQuux, $cuQuux, tbMW, $tbMW, tbRLDM, caFoo,
                        addedAfter, tbRLDMnonexistentid, tbRLDMemptyjquery;
 
                assert.equal( tbRLDMemptyjquery, $( '#p-test-tb li:last' )[ 0 ], 'Fallback to adding at the end (nextnode as empty jQuery object)' );
        } );
 
-       QUnit.test( 'validateEmail', 6, function ( assert ) {
+       QUnit.test( 'validateEmail', function ( assert ) {
                assert.strictEqual( mw.util.validateEmail( '' ), null, 'Should return null for empty string ' );
                assert.strictEqual( mw.util.validateEmail( 'user@localhost' ), true, 'Return true for a valid e-mail address' );
 
                assert.strictEqual( mw.util.validateEmail( 'userfoo@ex-ample.org' ), true, 'Emails may contain a hyphen' );
        } );
 
-       QUnit.test( 'isIPv6Address', 40, function ( assert ) {
+       QUnit.test( 'isIPv6Address', function ( assert ) {
                $.each( IPV6_CASES, function ( i, ipCase ) {
                        assert.strictEqual( mw.util.isIPv6Address( ipCase[ 1 ] ), ipCase[ 0 ], ipCase[ 2 ] );
                } );
        } );
 
-       QUnit.test( 'isIPv4Address', 11, function ( assert ) {
+       QUnit.test( 'isIPv4Address', function ( assert ) {
                $.each( IPV4_CASES, function ( i, ipCase ) {
                        assert.strictEqual( mw.util.isIPv4Address( ipCase[ 1 ] ), ipCase[ 0 ], ipCase[ 2 ] );
                } );
        } );
 
-       QUnit.test( 'isIPAddress', 51, function ( assert ) {
+       QUnit.test( 'isIPAddress', function ( assert ) {
                $.each( IPV4_CASES, function ( i, ipCase ) {
                        assert.strictEqual( mw.util.isIPv4Address( ipCase[ 1 ] ), ipCase[ 0 ], ipCase[ 2 ] );
                } );
index f404294..9864166 100644 (file)
@@ -25,7 +25,7 @@
                }
        } ) );
 
-       QUnit.test( 'isElementInViewport', 6, function ( assert ) {
+       QUnit.test( 'isElementInViewport', function ( assert ) {
                var viewport = $.extend( {}, DEFAULT_VIEWPORT );
                assert.ok( mw.viewport.isElementInViewport( this.el, viewport ),
                        'It should return true when the element is fully enclosed in the viewport' );
@@ -60,7 +60,7 @@
                        'It should default to the window object if no viewport is given' );
        } );
 
-       QUnit.test( 'isElementInViewport with scrolled page', 1, function ( assert ) {
+       QUnit.test( 'isElementInViewport with scrolled page', function ( assert ) {
                var viewport = {
                                top: 2000,
                                left: 0,
@@ -83,7 +83,7 @@
                window.scrollTo( 0, 0 );
        } );
 
-       QUnit.test( 'isElementCloseToViewport', 3, function ( assert ) {
+       QUnit.test( 'isElementCloseToViewport', function ( assert ) {
                var
                        viewport = {
                                top: 90,
index e6e798b..7466bed 100644 (file)
 
        QUnit.module( 'startup', QUnit.newMwEnvironment() );
 
-       QUnit.test( 'isCompatible( featureTestable )', testcases.tested.length, function ( assert ) {
+       QUnit.test( 'isCompatible( featureTestable )', function ( assert ) {
                $.each( testcases.tested, function ( i, ua ) {
                                assert.strictEqual( isCompatible( ua ), true, ua );
                        }
                );
        } );
 
-       QUnit.test( 'isCompatible( blacklisted )', testcases.blacklisted.length, function ( assert ) {
+       QUnit.test( 'isCompatible( blacklisted )', function ( assert ) {
                $.each( testcases.blacklisted, function ( i, ua ) {
                                assert.strictEqual( isCompatible( ua ), false, ua );
                        }