From 5e602c61326d71b053bfdfb9cd2498d6d620c25a Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 20 Feb 2017 18:36:36 -0800 Subject: [PATCH] qunit: Remove redundant testCount expectation 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 --- tests/qunit/data/generateJqueryMsgData.php | 2 +- tests/qunit/data/testrunner.js | 10 ++--- .../jquery/jquery.accessKeyLabel.test.js | 12 ++--- .../jquery/jquery.autoEllipsis.test.js | 2 +- .../jquery/jquery.byteLength.test.js | 4 +- .../resources/jquery/jquery.byteLimit.test.js | 4 +- .../resources/jquery/jquery.colorUtil.test.js | 8 ++-- .../resources/jquery/jquery.getAttrs.test.js | 2 +- .../resources/jquery/jquery.hidpi.test.js | 8 ++-- .../jquery/jquery.highlightText.test.js | 1 - .../resources/jquery/jquery.localize.test.js | 10 ++--- .../jquery/jquery.makeCollapsible.test.js | 34 +++++++------- .../jquery/jquery.mwExtension.test.js | 8 ++-- .../jquery/jquery.placeholder.test.js | 16 +++---- .../resources/jquery/jquery.tabIndex.test.js | 4 +- .../jquery/jquery.tablesorter.parsers.test.js | 4 +- .../jquery/jquery.tablesorter.test.js | 34 +++++++------- .../jquery/jquery.textSelection.test.js | 9 +--- .../mediawiki.ForeignApi.test.js | 4 +- .../mediawiki.api.category.test.js | 2 +- .../mediawiki.api.messages.test.js | 2 +- .../mediawiki.api.options.test.js | 6 +-- .../mediawiki.api/mediawiki.api.test.js | 2 +- .../mediawiki.api.upload.test.js | 4 +- .../mediawiki.special.recentchanges.test.js | 2 +- .../mediawiki/mediawiki.RegExp.test.js | 2 +- .../mediawiki/mediawiki.Title.test.js | 34 +++++++------- .../resources/mediawiki/mediawiki.Uri.test.js | 26 +++++------ .../mediawiki/mediawiki.cldr.test.js | 2 +- .../mediawiki/mediawiki.cookie.test.js | 12 ++--- .../mediawiki/mediawiki.errorLogger.test.js | 2 +- .../mediawiki/mediawiki.experiments.test.js | 2 +- .../mediawiki/mediawiki.html.test.js | 10 ++--- .../mediawiki/mediawiki.jqueryMsg.test.js | 34 +++++++------- .../mediawiki/mediawiki.jscompat.test.js | 3 +- .../mediawiki/mediawiki.language.test.js | 9 ++-- .../mediawiki/mediawiki.loader.test.js | 45 ++++++++++--------- .../mediawiki.messagePoster.factory.test.js | 2 +- .../mediawiki.template.mustache.test.js | 2 +- .../mediawiki/mediawiki.template.test.js | 6 +-- .../resources/mediawiki/mediawiki.test.js | 8 ++-- .../resources/mediawiki/mediawiki.toc.test.js | 2 +- .../mediawiki/mediawiki.track.test.js | 6 +-- .../mediawiki/mediawiki.util.test.js | 26 +++++------ .../mediawiki/mediawiki.viewport.test.js | 6 +-- tests/qunit/suites/resources/startup.test.js | 4 +- 46 files changed, 215 insertions(+), 222 deletions(-) diff --git a/tests/qunit/data/generateJqueryMsgData.php b/tests/qunit/data/generateJqueryMsgData.php index 5a96dc3356..5d1f1cd5b9 100644 --- a/tests/qunit/data/generateJqueryMsgData.php +++ b/tests/qunit/data/generateJqueryMsgData.php @@ -16,7 +16,7 @@ /* * @example QUnit * - 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(); diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index 0b28684a59..683dc1d610 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -479,7 +479,7 @@ } } ) ); - 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' ); @@ -488,12 +488,12 @@ 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 = [], @@ -512,7 +512,7 @@ assert.deepEqual( missing, [], 'Modules in missing state' ); } ); - QUnit.test( 'htmlEqual', 8, function ( assert ) { + QUnit.test( 'htmlEqual', function ( assert ) { assert.htmlEqual( '

Child paragraph with A link

Regular textA span
', '

Child paragraph with A link

Regular textA span
', @@ -564,7 +564,7 @@ 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( '<' ), '<', '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()' ); diff --git a/tests/qunit/suites/resources/jquery/jquery.accessKeyLabel.test.js b/tests/qunit/suites/resources/jquery/jquery.accessKeyLabel.test.js index 0fb7d9a71a..9af443dbd0 100644 --- a/tests/qunit/suites/resources/jquery/jquery.accessKeyLabel.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.accessKeyLabel.test.js @@ -46,7 +46,7 @@ return ''; } - 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, $input; @@ -103,7 +103,7 @@ $.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, $input; diff --git a/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.test.js b/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.test.js index a1b2e5c3db..c3521ba878 100644 --- a/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.autoEllipsis.test.js @@ -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.', diff --git a/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js b/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js index e6aa3aa8e0..558e64161d 100644 --- a/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js @@ -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 diff --git a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js index 5c2a06c306..804d1ca96c 100644 --- a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js @@ -185,7 +185,7 @@ 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 = $( '' ).attr( 'type', 'text' ) @@ -228,7 +228,7 @@ $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 because the bug only occurs on the first time diff --git a/tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js b/tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js index 00de895dad..d6208e9128 100644 --- a/tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js @@ -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%' ); diff --git a/tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js b/tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js index ca3f418c31..28789995d6 100644 --- a/tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js @@ -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', diff --git a/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js b/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js index 8c6287658e..2f9e960f59 100644 --- a/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js @@ -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 diff --git a/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js b/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js index e1fb96dceb..9f8759622c 100644 --- a/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js @@ -220,7 +220,6 @@ expected: 'بول إيردوس' } ]; - QUnit.expect( cases.length ); $.each( cases, function ( i, item ) { $fixture = $( '

' ).text( item.text ).highlightText( item.highlight ); diff --git a/tests/qunit/suites/resources/jquery/jquery.localize.test.js b/tests/qunit/suites/resources/jquery/jquery.localize.test.js index c503fc9932..1b688097ca 100644 --- a/tests/qunit/suites/resources/jquery/jquery.localize.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.localize.test.js @@ -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', '' ); @@ -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', @@ -114,7 +114,7 @@ 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' ); @@ -124,7 +124,7 @@ 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 link here!!' ); html = '

'; diff --git a/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js b/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js index 9c7660fe8d..b80af4c634 100644 --- a/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js @@ -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( '
' + loremIpsum + '
' @@ -44,7 +44,7 @@ $toggle.trigger( 'click' ); } ); - QUnit.test( 'basic operation (
)', 5, function ( assert ) { + QUnit.test( 'basic operation (
)', function ( assert ) { var test = this, $collapsible = prepareCollapsible( '
' + loremIpsum + '
' @@ -70,7 +70,7 @@ $toggle.trigger( 'click' ); } ); - QUnit.test( 'basic operation ()', 7, function ( assert ) { + QUnit.test( 'basic operation (
)', function ( assert ) { var test = this, $collapsible = prepareCollapsible( '
' + @@ -132,7 +132,7 @@ $toggle.trigger( 'click' ); } - QUnit.test( 'basic operation (
with caption)', 10, function ( assert ) { + QUnit.test( 'basic operation (
with caption)', function ( assert ) { tableWithCaptionTest( prepareCollapsible( '
' + '' + @@ -143,7 +143,7 @@ ), this, assert ); } ); - QUnit.test( 'basic operation (
' + loremIpsum + '
with caption and )', 10, function ( assert ) { + QUnit.test( 'basic operation (
with caption and )', function ( assert ) { tableWithCaptionTest( prepareCollapsible( '
' + '' + @@ -185,15 +185,15 @@ $toggle.trigger( 'click' ); } - QUnit.test( 'basic operation (
    )', 7, function ( assert ) { + QUnit.test( 'basic operation (
      )', function ( assert ) { listTest( 'ul', this, assert ); } ); - QUnit.test( 'basic operation (
        )', 7, function ( assert ) { + QUnit.test( 'basic operation (
          )', 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( '
          ' + loremIpsum + '
          ', { instantHide: true } @@ -207,7 +207,7 @@ 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( '
          ' + loremIpsum + '
          ' ); @@ -215,7 +215,7 @@ 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( '
          ' + loremIpsum + '
          ' ); @@ -223,7 +223,7 @@ 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( '
          ' + loremIpsum + '
          ', { collapsed: true } @@ -232,7 +232,7 @@ 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( '
          ' + loremIpsum + '
          ' ), @@ -248,7 +248,7 @@ $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( '
          ' + loremIpsum + '
          ', { collapsed: true } @@ -265,7 +265,7 @@ $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( '
          ' + '
          ' + @@ -285,7 +285,7 @@ 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( '
          ' + loremIpsum + @@ -302,7 +302,7 @@ $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( '
          ' + loremIpsum + '
          ', { collapseText: 'Collapse me!', expandText: 'Expand me!' } @@ -318,7 +318,7 @@ $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( '
          ' + loremIpsum + '
          ' diff --git a/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js b/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js index 029edd5587..aeda51651f 100644 --- a/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js @@ -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)' ); diff --git a/tests/qunit/suites/resources/jquery/jquery.placeholder.test.js b/tests/qunit/suites/resources/jquery/jquery.placeholder.test.js index 5d0ddebb98..73e431339c 100644 --- a/tests/qunit/suites/resources/jquery/jquery.placeholder.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.placeholder.test.js @@ -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' ); } ); @@ -67,32 +67,32 @@ $el.placeholder( placeholder ); }; - QUnit.test( 'emulates placeholder for ', 22, function ( assert ) { + QUnit.test( 'emulates placeholder for ', function ( assert ) { $( '
          ' ).html( html ).appendTo( $( '#qunit-fixture' ) ); testElement( $( '#input-type-text' ), assert ); } ); - QUnit.test( 'emulates placeholder for ', 22, function ( assert ) { + QUnit.test( 'emulates placeholder for ', function ( assert ) { $( '
          ' ).html( html ).appendTo( $( '#qunit-fixture' ) ); testElement( $( '#input-type-search' ), assert ); } ); - QUnit.test( 'emulates placeholder for ', 22, function ( assert ) { + QUnit.test( 'emulates placeholder for ', function ( assert ) { $( '
          ' ).html( html ).appendTo( $( '#qunit-fixture' ) ); testElement( $( '#input-type-email' ), assert ); } ); - QUnit.test( 'emulates placeholder for ', 22, function ( assert ) { + QUnit.test( 'emulates placeholder for ', function ( assert ) { $( '
          ' ).html( html ).appendTo( $( '#qunit-fixture' ) ); testElement( $( '#input-type-url' ), assert ); } ); - QUnit.test( 'emulates placeholder for ', 22, function ( assert ) { + QUnit.test( 'emulates placeholder for ', function ( assert ) { $( '
          ' ).html( html ).appendTo( $( '#qunit-fixture' ) ); testElement( $( '#input-type-tel' ), assert ); } ); - QUnit.test( 'emulates placeholder for ', 13, function ( assert ) { + QUnit.test( 'emulates placeholder for ', function ( assert ) { $( '
          ' ).html( html ).appendTo( $( '#qunit-fixture' ) ); var selector = '#input-type-password', @@ -137,7 +137,7 @@ } ); - QUnit.test( 'emulates placeholder for ', 22, function ( assert ) { + QUnit.test( 'emulates placeholder for ', function ( assert ) { $( '
          ' ).html( html ).appendTo( $( '#qunit-fixture' ) ); testElement( $( '#textarea' ), assert ); } ); diff --git a/tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js b/tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js index 121379315b..ec3539b95a 100644 --- a/tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js @@ -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 = '
          ' + '' + @@ -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 = '' + '' + diff --git a/tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js b/tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js index 01ff45fca9..97b2c0e5ce 100644 --- a/tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js @@ -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' ] diff --git a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js index dffd67a56a..6f84945d48 100644 --- a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js @@ -503,7 +503,7 @@ $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: [ @@ -589,7 +589,7 @@ } ); - 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' ); @@ -731,7 +731,7 @@ } ); - 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: @@ -853,7 +853,7 @@ } ); - QUnit.test( 'Test detection routine', 1, function ( assert ) { + QUnit.test( 'Test detection routine', function ( assert ) { var $table; $table = $( '
' + loremIpsum + '
' + @@ -874,7 +874,7 @@ } ); /** 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 = $( '
' + @@ -894,7 +894,7 @@ ); } ); - 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, @@ -1071,7 +1071,7 @@ ); // 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 = $( '
' + @@ -1135,7 +1135,7 @@ } ); - QUnit.test( 'Sorting images using alt text', 1, function ( assert ) { + QUnit.test( 'Sorting images using alt text', function ( assert ) { var $table = $( '
' + '' + @@ -1152,7 +1152,7 @@ ); } ); - QUnit.test( 'Sorting images using alt text (complex)', 1, function ( assert ) { + QUnit.test( 'Sorting images using alt text (complex)', function ( assert ) { var $table = $( '
THEAD
' + '' + @@ -1173,7 +1173,7 @@ ); } ); - 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 = $( '
THEAD
' + '' + @@ -1192,7 +1192,7 @@ ); } ); - 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 = $( '
THEAD
' + '' + @@ -1222,7 +1222,7 @@ ); } ); - 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 = $( '
' + '' + @@ -1247,7 +1247,7 @@ ); } ); - 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 = $( '
' + '' + @@ -1270,7 +1270,7 @@ } ); // 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 = $( '
' + '' + @@ -1307,7 +1307,7 @@ // 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 = $( '
' + '' + '' + @@ -1424,7 +1424,7 @@ ] ); - 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 = $( '
nfoobaz
foobar
' + @@ -1459,7 +1459,7 @@ ); } ); - 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 = $( '
' + diff --git a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js index c28d3ceac2..3ab842821b 100644 --- a/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js @@ -32,12 +32,7 @@ }, 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 = $( '