Merge "GallerySlideshow: Always set image height, adjust according to caption size"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 23 Feb 2017 02:51:53 +0000 (02:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 23 Feb 2017 02:51:53 +0000 (02:51 +0000)
32 files changed:
.eslintrc.json
Gruntfile.js
RELEASE-NOTES-1.29
resources/src/jquery/jquery.qunit.completenessTest.js
tests/qunit/.eslintrc.json [new file with mode: 0644]
tests/qunit/data/generateJqueryMsgData.php
tests/qunit/data/mediawiki.jqueryMsg.data.js
tests/qunit/data/testrunner.js
tests/qunit/suites/resources/jquery/jquery.accessKeyLabel.test.js
tests/qunit/suites/resources/jquery/jquery.byteLimit.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.placeholder.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.api.edit.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.test.js
tests/qunit/suites/resources/mediawiki.rcfilters/dm.FiltersViewModel.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.Title.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.cldr.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.errorLogger.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.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.util.test.js
tests/qunit/suites/resources/startup.test.js

index 98d0f10..64b5ea7 100644 (file)
@@ -2,8 +2,7 @@
        "extends": "wikimedia",
        "env": {
                "browser": true,
-               "jquery": true,
-               "qunit": true
+               "jquery": true
        },
        "globals": {
                "require": false,
index 191286a..0e1c8cb 100644 (file)
@@ -24,12 +24,13 @@ module.exports = function ( grunt ) {
                        all: [
                                '**/*.js',
                                '!docs/**',
-                               '!tests/**',
                                '!node_modules/**',
                                '!resources/lib/**',
                                '!resources/src/jquery.tipsy/**',
                                '!resources/src/jquery/jquery.farbtastic.js',
                                '!resources/src/mediawiki.libs/**',
+                               // Third-party code of PHPUnit coverage report
+                               '!tests/coverage/**',
                                '!vendor/**',
                                // Explicitly say "**/*.js" here in case of symlinks
                                '!extensions/**/*.js',
index a739821..a1ce9d9 100644 (file)
@@ -61,6 +61,7 @@ production.
 * Updated QUnit from v1.22.0 to v1.23.1.
 * Updated cssjanus from v1.1.2 to 1.1.3.
 * Updated psr/log from v1.0.0 to v1.0.2.
+* Update Moment.js from v2.8.4 to v2.15.0.
 
 ==== New external libraries ====
 
index 4353dd7..0aaa4ff 100644 (file)
@@ -12,6 +12,7 @@
  *
  * @author Timo Tijhof, 2011-2012
  */
+/* eslint-env qunit */
 ( function ( mw, $ ) {
        'use strict';
 
diff --git a/tests/qunit/.eslintrc.json b/tests/qunit/.eslintrc.json
new file mode 100644 (file)
index 0000000..b3a46f4
--- /dev/null
@@ -0,0 +1,14 @@
+{
+       "extends": "../../.eslintrc.json",
+       "env": {
+               "qunit": true
+       },
+       "globals": {
+               "sinon": false
+       },
+       "rules": {
+               "operator-linebreak": 0,
+               "quote-props": [ "error", "as-needed" ],
+               "valid-jsdoc": 0
+       }
+}
index d02d476..1c79f6d 100644 (file)
@@ -133,6 +133,7 @@ class GenerateJqueryMsgData extends Maintenance {
                                . "// languages, and parser modes. Intended for use by a unit test framework by looping\n"
                                . "// through the object and comparing its parser return value with the 'result' property.\n"
                                . '// Last generated with ' . basename( __FILE__ ) . ' at ' . gmdate( 'r' ) . "\n"
+                               . "/* eslint-disable */\n"
                                . "\n"
                                . 'mediaWiki.libs.phpParserData = ' . FormatJson::encode( $phpParserData, true ) . ";\n";
 
index db723b6..90dc1b2 100644 (file)
@@ -2,6 +2,7 @@
 // languages, and parser modes. Intended for use by a unit test framework by looping
 // through the object and comparing its parser return value with the 'result' property.
 // Last generated with generateJqueryMsgData.php at Fri, 10 Jul 2015 11:44:08 +0000
+/* eslint-disable */
 
 mediaWiki.libs.phpParserData = {
     "messages": {
index 683dc1d..cef5c15 100644 (file)
@@ -1,8 +1,8 @@
-/*global CompletenessTest, sinon */
+/* global CompletenessTest, sinon */
 ( function ( $, mw, QUnit ) {
        'use strict';
 
-       var mwTestIgnore, mwTester, addons;
+       var mwTestIgnore, addons;
 
        /**
         * Add bogus to url to prevent IE crazy caching
@@ -26,6 +26,7 @@
        QUnit.config.testTimeout = 60 * 1000;
 
        // Reduce default animation duration from 400ms to 0ms for unit tests
+       // eslint-disable-next-line no-underscore-dangle
        $.fx.speeds._default = 0;
 
        // Add a checkbox to QUnit header to toggle MediaWiki ResourceLoader debug mode.
                        return false;
                };
 
-               mwTester = new CompletenessTest( mw, mwTestIgnore );
+               // eslint-disable-next-line no-new
+               new CompletenessTest( mw, mwTestIgnore );
        }
 
        /**
                }
 
                function freshMessagesCopy( custom ) {
-                       return $.extend( /*deep=*/true, {}, liveMessages.get(), custom );
+                       return $.extend( /* deep */true, {}, liveMessages.get(), custom );
                }
 
                /**
index 9af443d..e4b6157 100644 (file)
@@ -1,4 +1,6 @@
 ( function ( $ ) {
+       var getAccessKeyPrefixTestData, updateTooltipAccessKeysTestData;
+
        QUnit.module( 'jquery.accessKeyLabel', QUnit.newMwEnvironment( {
                messages: {
                        brackets: '[$1]',
@@ -6,40 +8,40 @@
                }
        } ) );
 
-       var getAccessKeyPrefixTestData = [
-                       // ua string, platform string, expected prefix
-                       // Internet Explorer
-                       [ 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)', 'Win32', 'alt-' ],
-                       [ 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)', 'Win32', 'alt-' ],
-                       [ 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; rv:11.0) like Gecko', 'Win64', 'alt-' ],
-                       [ 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136', 'Win64', 'alt-' ],
-                       // Firefox
-                       [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.19) Gecko/20110420 Firefox/3.5.19', 'MacIntel', 'ctrl-' ],
-                       [ 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17', 'Linux i686', 'alt-shift-' ],
-                       [ 'Mozilla/5.0 (Windows NT 6.0; rv:2.0.1) Gecko/20100101 Firefox/4.0.1', 'Win32', 'alt-shift-' ],
-                       [ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:50.0) Gecko/20100101 Firefox/50.0', 'MacIntel', 'ctrl-option-' ],
-                       [ 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20121202 Firefox/17.0 Iceweasel/17.0.1', 'Linux 1686', 'alt-shift-' ],
-                       [ 'Mozilla/5.0 (Windows NT 5.2; U; de; rv:1.8.0) Gecko/20060728 Firefox/1.5.0', 'Win32', 'alt-' ],
-                       // Safari / Konqueror
-                       [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; nl-nl) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7', 'MacIntel', 'ctrl-option-' ],
-                       [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; de-de) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3', 'MacIntel', 'ctrl-' ],
-                       [ 'Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29', 'Win32', 'alt-' ],
-                       [ 'Mozilla/5.0 (Windows; U; Windows NT 6.0; cs-CZ) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7', 'Win32', 'alt-' ],
-                       [ 'Mozilla/5.0 (X11; Linux i686) KHTML/4.9.1 (like Gecko) Konqueror/4.9', 'Linux i686', 'ctrl-' ],
-                       // Opera
-                       [ 'Opera/9.80 (Windows NT 5.1)', 'Win32', 'shift-esc-' ],
-                       [ 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.130', 'Win32', 'alt-shift-' ],
-                       // Chrome
-                       [ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30', 'MacIntel', 'ctrl-option-' ],
-                       [ 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.68 Safari/534.30', 'Linux i686', 'alt-shift-' ],
-                       // Unknown! Note: These aren't necessarily *right*, this is just
-                       // testing that we're getting the expected output based on the
-                       // platform.
-                       [ 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.1) Gecko/20021111 Chimera/0.6', 'MacPPC', 'ctrl-' ],
-                       [ 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5', 'Linux i686', 'alt-' ]
-               ],
-               // strings appended to title to make sure updateTooltipAccessKeys handles them correctly
-               updateTooltipAccessKeysTestData = [ '', ' [a]', ' [test-a]', ' [alt-b]' ];
+       getAccessKeyPrefixTestData = [
+               // ua string, platform string, expected prefix
+               // Internet Explorer
+               [ 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)', 'Win32', 'alt-' ],
+               [ 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)', 'Win32', 'alt-' ],
+               [ 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; rv:11.0) like Gecko', 'Win64', 'alt-' ],
+               [ 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136', 'Win64', 'alt-' ],
+               // Firefox
+               [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.19) Gecko/20110420 Firefox/3.5.19', 'MacIntel', 'ctrl-' ],
+               [ 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17', 'Linux i686', 'alt-shift-' ],
+               [ 'Mozilla/5.0 (Windows NT 6.0; rv:2.0.1) Gecko/20100101 Firefox/4.0.1', 'Win32', 'alt-shift-' ],
+               [ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:50.0) Gecko/20100101 Firefox/50.0', 'MacIntel', 'ctrl-option-' ],
+               [ 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20121202 Firefox/17.0 Iceweasel/17.0.1', 'Linux 1686', 'alt-shift-' ],
+               [ 'Mozilla/5.0 (Windows NT 5.2; U; de; rv:1.8.0) Gecko/20060728 Firefox/1.5.0', 'Win32', 'alt-' ],
+               // Safari / Konqueror
+               [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; nl-nl) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7', 'MacIntel', 'ctrl-option-' ],
+               [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; de-de) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3', 'MacIntel', 'ctrl-' ],
+               [ 'Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29', 'Win32', 'alt-' ],
+               [ 'Mozilla/5.0 (Windows; U; Windows NT 6.0; cs-CZ) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7', 'Win32', 'alt-' ],
+               [ 'Mozilla/5.0 (X11; Linux i686) KHTML/4.9.1 (like Gecko) Konqueror/4.9', 'Linux i686', 'ctrl-' ],
+               // Opera
+               [ 'Opera/9.80 (Windows NT 5.1)', 'Win32', 'shift-esc-' ],
+               [ 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.130', 'Win32', 'alt-shift-' ],
+               // Chrome
+               [ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30', 'MacIntel', 'ctrl-option-' ],
+               [ 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.68 Safari/534.30', 'Linux i686', 'alt-shift-' ],
+               // Unknown! Note: These aren't necessarily *right*, this is just
+               // testing that we're getting the expected output based on the
+               // platform.
+               [ 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.1) Gecko/20021111 Chimera/0.6', 'MacPPC', 'ctrl-' ],
+               [ 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5', 'Linux i686', 'alt-' ]
+       ];
+       // strings appended to title to make sure updateTooltipAccessKeys handles them correctly
+       updateTooltipAccessKeysTestData = [ '', ' [a]', ' [test-a]', ' [alt-b]' ];
 
        function makeInput( title, accessKey ) {
                // The properties aren't escaped, so make sure you don't call this function with values that need to be escaped!
@@ -78,8 +80,8 @@
        } );
 
        QUnit.test( 'updateTooltipAccessKeys - with access key', function ( assert ) {
-               $.fn.updateTooltipAccessKeys.setTestMode( true );
                var i, oldTitle, $input, newTitle;
+               $.fn.updateTooltipAccessKeys.setTestMode( true );
                for ( i = 0; i < updateTooltipAccessKeysTestData.length; i++ ) {
                        oldTitle = 'Title' + updateTooltipAccessKeysTestData[ i ];
                        $input = $( makeInput( oldTitle, 'a' ) );
@@ -91,9 +93,9 @@
        } );
 
        QUnit.test( 'updateTooltipAccessKeys with label element', function ( assert ) {
+               var html, $label, $input;
                $.fn.updateTooltipAccessKeys.setTestMode( true );
-               var html = '<label for="testInput" title="Title">Label</label><input id="testInput" accessKey="a" />',
-                       $label, $input;
+               html = '<label for="testInput" title="Title">Label</label><input id="testInput" accessKey="a" />';
                $( '#qunit-fixture' ).html( html );
                $label = $( '#qunit-fixture label' );
                $input = $( '#qunit-fixture input' );
        } );
 
        QUnit.test( 'updateTooltipAccessKeys with label element as parent', function ( assert ) {
+               var html, $label, $input;
                $.fn.updateTooltipAccessKeys.setTestMode( true );
-               var html = '<label title="Title">Label<input id="testInput" accessKey="a" /></label>',
-               $label, $input;
+               html = '<label title="Title">Label<input id="testInput" accessKey="a" /></label>';
                $( '#qunit-fixture' ).html( html );
                $label = $( '#qunit-fixture label' );
                $input = $( '#qunit-fixture input' );
index 804d1ca..c7b7cc0 100644 (file)
                        expected: ''
                }, options );
 
-               QUnit.asyncTest( opt.description, 1, function ( assert ) {
-                       setTimeout( function () {
-                               opt.$input.appendTo( '#qunit-fixture' );
+               QUnit.test( opt.description, function ( assert ) {
+                       opt.$input.appendTo( '#qunit-fixture' );
 
-                               // Simulate pressing keys for each of the sample characters
-                               addChars( opt.$input, opt.sample );
+                       // Simulate pressing keys for each of the sample characters
+                       addChars( opt.$input, opt.sample );
 
-                               assert.equal(
-                                       opt.$input.val(),
-                                       opt.expected,
-                                       'New value matches the expected string'
-                               );
-
-                               QUnit.start();
-                       } );
+                       assert.equal(
+                               opt.$input.val(),
+                               opt.expected,
+                               'New value matches the expected string'
+                       );
                } );
        }
 
        } );
 
        QUnit.test( 'Confirm properties and attributes set', function ( assert ) {
-               var $el, $elA, $elB;
+               var $el;
 
                $el = $( '<input>' ).attr( 'type', 'text' )
                        .attr( 'maxlength', '7' )
 
                assert.strictEqual( $el.attr( 'maxlength' ), undefined, 'maxlength attribute removed for limit with callback' );
 
-               $elA = $( '<input>' ).attr( 'type', 'text' )
+               $( '<input>' ).attr( 'type', 'text' )
                        .addClass( 'mw-test-byteLimit-foo' )
                        .attr( 'maxlength', '7' )
                        .appendTo( '#qunit-fixture' );
 
-               $elB = $( '<input>' ).attr( 'type', 'text' )
+               $( '<input>' ).attr( 'type', 'text' )
                        .addClass( 'mw-test-byteLimit-foo' )
                        .attr( 'maxlength', '12' )
                        .appendTo( '#qunit-fixture' );
        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
+               // Use a new <input> because the bug only occurs on the first time
                // the limit it reached (T42850)
                $el = $( '<input>' ).attr( 'type', 'text' )
                        .appendTo( '#qunit-fixture' )
index 2878999..74d8509 100644 (file)
@@ -4,7 +4,7 @@
        QUnit.test( 'getAttrs()', function ( assert ) {
                var attrs = {
                                foo: 'bar',
-                               'class': 'lorem',
+                               class: 'lorem',
                                'data-foo': 'data value'
                        },
                        $el = $( '<div>' ).attr( attrs );
index 2f9e960..6a265eb 100644 (file)
@@ -7,8 +7,8 @@
        } );
 
        QUnit.test( 'bracketedDevicePixelRatio', function ( assert ) {
-               var devicePixelRatio = $.devicePixelRatio();
-               assert.equal( typeof devicePixelRatio, 'number', '$.bracketedDevicePixelRatio() returns a number' );
+               var ratio = $.bracketedDevicePixelRatio();
+               assert.equal( typeof ratio, 'number', '$.bracketedDevicePixelRatio() returns a number' );
        } );
 
        QUnit.test( 'bracketDevicePixelRatio', function ( assert ) {
index 9f87596..0dac22e 100644 (file)
        QUnit.module( 'jquery.highlightText', QUnit.newMwEnvironment() );
 
        QUnit.test( 'Check', function ( assert ) {
-               var $fixture, cases = [
-                       {
-                               desc: 'Test 001',
-                               text: 'Blue Öyster Cult',
-                               highlight: 'Blue',
-                               expected: '<span class="highlight">Blue</span> Öyster Cult'
-                       },
-                       {
-                               desc: 'Test 002',
-                               text: 'Blue Öyster Cult',
-                               highlight: 'Blue ',
-                               expected: '<span class="highlight">Blue</span> Öyster Cult'
-                       },
-                       {
-                               desc: 'Test 003',
-                               text: 'Blue Öyster Cult',
-                               highlight: 'Blue Ö',
-                               expected: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'
-                       },
-                       {
-                               desc: 'Test 004',
-                               text: 'Blue Öyster Cult',
-                               highlight: 'Blue Öy',
-                               expected: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'
-                       },
-                       {
-                               desc: 'Test 005',
-                               text: 'Blue Öyster Cult',
-                               highlight: ' Blue',
-                               expected: '<span class="highlight">Blue</span> Öyster Cult'
-                       },
-                       {
-                               desc: 'Test 006',
-                               text: 'Blue Öyster Cult',
-                               highlight: ' Blue ',
-                               expected: '<span class="highlight">Blue</span> Öyster Cult'
-                       },
-                       {
-                               desc: 'Test 007',
-                               text: 'Blue Öyster Cult',
-                               highlight: ' Blue Ö',
-                               expected: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'
-                       },
-                       {
-                               desc: 'Test 008',
-                               text: 'Blue Öyster Cult',
-                               highlight: ' Blue Öy',
-                               expected: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'
-                       },
-                       {
-                               desc: 'Test 009: Highlighter broken on starting Umlaut?',
-                               text: 'Österreich',
-                               highlight: 'Österreich',
-                               expected: '<span class="highlight">Österreich</span>'
-                       },
-                       {
-                               desc: 'Test 010: Highlighter broken on starting Umlaut?',
-                               text: 'Österreich',
-                               highlight: 'Ö',
-                               expected: '<span class="highlight">Ö</span>sterreich'
-                       },
-                       {
-                               desc: 'Test 011: Highlighter broken on starting Umlaut?',
-                               text: 'Österreich',
-                               highlight: 'Öst',
-                               expected: '<span class="highlight">Öst</span>erreich'
-                       },
-                       {
-                               desc: 'Test 012: Highlighter broken on starting Umlaut?',
-                               text: 'Österreich',
-                               highlight: 'Oe',
-                               expected: 'Österreich'
-                       },
-                       {
-                               desc: 'Test 013: Highlighter broken on punctuation mark?',
-                               text: 'So good. To be there',
-                               highlight: 'good',
-                               expected: 'So <span class="highlight">good</span>. To be there'
-                       },
-                       {
-                               desc: 'Test 014: Highlighter broken on space?',
-                               text: 'So good. To be there',
-                               highlight: 'be',
-                               expected: 'So good. To <span class="highlight">be</span> there'
-                       },
-                       {
-                               desc: 'Test 015: Highlighter broken on space?',
-                               text: 'So good. To be there',
-                               highlight: ' be',
-                               expected: 'So good. To <span class="highlight">be</span> there'
-                       },
-                       {
-                               desc: 'Test 016: Highlighter broken on space?',
-                               text: 'So good. To be there',
-                               highlight: 'be ',
-                               expected: 'So good. To <span class="highlight">be</span> there'
-                       },
-                       {
-                               desc: 'Test 017: Highlighter broken on space?',
-                               text: 'So good. To be there',
-                               highlight: ' be ',
-                               expected: 'So good. To <span class="highlight">be</span> there'
-                       },
-                       {
-                               desc: 'Test 018: en de Highlighter broken on special character at the end?',
-                               text: 'So good. xbß',
-                               highlight: 'xbß',
-                               expected: 'So good. <span class="highlight">xbß</span>'
-                       },
-                       {
-                               desc: 'Test 019: en de Highlighter broken on special character at the end?',
-                               text: 'So good. xbß.',
-                               highlight: 'xbß.',
-                               expected: 'So good. <span class="highlight">xbß.</span>'
-                       },
-                       {
-                               desc: 'Test 020: RTL he Hebrew',
-                               text: 'חסיד אומות העולם',
-                               highlight: 'חסיד אומות העולם',
-                               expected: '<span class="highlight">חסיד</span> <span class="highlight">אומות</span> <span class="highlight">העולם</span>'
-                       },
-                       {
-                               desc: 'Test 021: RTL he Hebrew',
-                               text: 'חסיד אומות העולם',
-                               highlight: 'חסי',
-                               expected: '<span class="highlight">חסי</span>ד אומות העולם'
-                       },
-                       {
-                               desc: 'Test 022: ja Japanese',
-                               text: '諸国民の中の正義の人',
-                               highlight: '諸国民の中の正義の人',
-                               expected: '<span class="highlight">諸国民の中の正義の人</span>'
-                       },
-                       {
-                               desc: 'Test 023: ja Japanese',
-                               text: '諸国民の中の正義の人',
-                               highlight: '諸国',
-                               expected: '<span class="highlight">諸国</span>民の中の正義の人'
-                       },
-                       {
-                               desc: 'Test 024: fr French text and « french quotes » (guillemets)',
-                               text: '« L\'oiseau est sur l’île »',
-                               highlight: '« L\'oiseau est sur l’île »',
-                               expected: '<span class="highlight">«</span> <span class="highlight">L\'oiseau</span> <span class="highlight">est</span> <span class="highlight">sur</span> <span class="highlight">l’île</span> <span class="highlight">»</span>'
-                       },
-                       {
-                               desc: 'Test 025: fr French text and « french quotes » (guillemets)',
-                               text: '« L\'oiseau est sur l’île »',
-                               highlight: '« L\'oise',
-                               expected: '<span class="highlight">«</span> <span class="highlight">L\'oise</span>au est sur l’île »'
-                       },
-                       {
-                               desc: 'Test 025a: fr French text and « french quotes » (guillemets) - does it match the single strings "«" and "L" separately?',
-                               text: '« L\'oiseau est sur l’île »',
-                               highlight: '« L',
-                               expected: '<span class="highlight">«</span> <span class="highlight">L</span>\'oiseau est sur <span class="highlight">l</span>’île »'
-                       },
-                       {
-                               desc: 'Test 026: ru Russian',
-                               text: 'Праведники мира',
-                               highlight: 'Праведники мира',
-                               expected: '<span class="highlight">Праведники</span> <span class="highlight">мира</span>'
-                       },
-                       {
-                               desc: 'Test 027: ru Russian',
-                               text: 'Праведники мира',
-                               highlight: 'Праве',
-                               expected: '<span class="highlight">Праве</span>дники мира'
-                       },
-                       {
-                               desc: 'Test 028 ka Georgian',
-                               text: 'მთავარი გვერდი',
-                               highlight: 'მთავარი გვერდი',
-                               expected: '<span class="highlight">მთავარი</span> <span class="highlight">გვერდი</span>'
-                       },
-                       {
-                               desc: 'Test 029 ka Georgian',
-                               text: 'მთავარი გვერდი',
-                               highlight: 'მთა',
-                               expected: '<span class="highlight">მთა</span>ვარი გვერდი'
-                       },
-                       {
-                               desc: 'Test 030 hy Armenian',
-                               text: 'Նոնա Գափրինդաշվիլի',
-                               highlight: 'Նոնա Գափրինդաշվիլի',
-                               expected: '<span class="highlight">Նոնա</span> <span class="highlight">Գափրինդաշվիլի</span>'
-                       },
-                       {
-                               desc: 'Test 031 hy Armenian',
-                               text: 'Նոնա Գափրինդաշվիլի',
-                               highlight: 'Նոն',
-                               expected: '<span class="highlight">Նոն</span>ա Գափրինդաշվիլի'
-                       },
-                       {
-                               desc: 'Test 032: th Thai',
-                               text: 'พอล แอร์ดิช',
-                               highlight: 'พอล แอร์ดิช',
-                               expected: '<span class="highlight">พอล</span> <span class="highlight">แอร์ดิช</span>'
-                       },
-                       {
-                               desc: 'Test 033: th Thai',
-                               text: 'พอล แอร์ดิช',
-                               highlight: 'พอ',
-                               expected: '<span class="highlight">พอ</span>ล แอร์ดิช'
-                       },
-                       {
-                               desc: 'Test 034: RTL ar Arabic',
-                               text: 'بول إيردوس',
-                               highlight: 'بول إيردوس',
-                               expected: '<span class="highlight">بول</span> <span class="highlight">إيردوس</span>'
-                       },
-                       {
-                               desc: 'Test 035: RTL ar Arabic',
-                               text: 'بول إيردوس',
-                               highlight: 'بو',
-                               expected: '<span class="highlight">بو</span>ل إيردوس'
-                       }
-               ];
+               var $fixture,
+                       cases = [
+                               {
+                                       desc: 'Test 001',
+                                       text: 'Blue Öyster Cult',
+                                       highlight: 'Blue',
+                                       expected: '<span class="highlight">Blue</span> Öyster Cult'
+                               },
+                               {
+                                       desc: 'Test 002',
+                                       text: 'Blue Öyster Cult',
+                                       highlight: 'Blue ',
+                                       expected: '<span class="highlight">Blue</span> Öyster Cult'
+                               },
+                               {
+                                       desc: 'Test 003',
+                                       text: 'Blue Öyster Cult',
+                                       highlight: 'Blue Ö',
+                                       expected: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'
+                               },
+                               {
+                                       desc: 'Test 004',
+                                       text: 'Blue Öyster Cult',
+                                       highlight: 'Blue Öy',
+                                       expected: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'
+                               },
+                               {
+                                       desc: 'Test 005',
+                                       text: 'Blue Öyster Cult',
+                                       highlight: ' Blue',
+                                       expected: '<span class="highlight">Blue</span> Öyster Cult'
+                               },
+                               {
+                                       desc: 'Test 006',
+                                       text: 'Blue Öyster Cult',
+                                       highlight: ' Blue ',
+                                       expected: '<span class="highlight">Blue</span> Öyster Cult'
+                               },
+                               {
+                                       desc: 'Test 007',
+                                       text: 'Blue Öyster Cult',
+                                       highlight: ' Blue Ö',
+                                       expected: '<span class="highlight">Blue</span> <span class="highlight">Ö</span>yster Cult'
+                               },
+                               {
+                                       desc: 'Test 008',
+                                       text: 'Blue Öyster Cult',
+                                       highlight: ' Blue Öy',
+                                       expected: '<span class="highlight">Blue</span> <span class="highlight">Öy</span>ster Cult'
+                               },
+                               {
+                                       desc: 'Test 009: Highlighter broken on starting Umlaut?',
+                                       text: 'Österreich',
+                                       highlight: 'Österreich',
+                                       expected: '<span class="highlight">Österreich</span>'
+                               },
+                               {
+                                       desc: 'Test 010: Highlighter broken on starting Umlaut?',
+                                       text: 'Österreich',
+                                       highlight: 'Ö',
+                                       expected: '<span class="highlight">Ö</span>sterreich'
+                               },
+                               {
+                                       desc: 'Test 011: Highlighter broken on starting Umlaut?',
+                                       text: 'Österreich',
+                                       highlight: 'Öst',
+                                       expected: '<span class="highlight">Öst</span>erreich'
+                               },
+                               {
+                                       desc: 'Test 012: Highlighter broken on starting Umlaut?',
+                                       text: 'Österreich',
+                                       highlight: 'Oe',
+                                       expected: 'Österreich'
+                               },
+                               {
+                                       desc: 'Test 013: Highlighter broken on punctuation mark?',
+                                       text: 'So good. To be there',
+                                       highlight: 'good',
+                                       expected: 'So <span class="highlight">good</span>. To be there'
+                               },
+                               {
+                                       desc: 'Test 014: Highlighter broken on space?',
+                                       text: 'So good. To be there',
+                                       highlight: 'be',
+                                       expected: 'So good. To <span class="highlight">be</span> there'
+                               },
+                               {
+                                       desc: 'Test 015: Highlighter broken on space?',
+                                       text: 'So good. To be there',
+                                       highlight: ' be',
+                                       expected: 'So good. To <span class="highlight">be</span> there'
+                               },
+                               {
+                                       desc: 'Test 016: Highlighter broken on space?',
+                                       text: 'So good. To be there',
+                                       highlight: 'be ',
+                                       expected: 'So good. To <span class="highlight">be</span> there'
+                               },
+                               {
+                                       desc: 'Test 017: Highlighter broken on space?',
+                                       text: 'So good. To be there',
+                                       highlight: ' be ',
+                                       expected: 'So good. To <span class="highlight">be</span> there'
+                               },
+                               {
+                                       desc: 'Test 018: en de Highlighter broken on special character at the end?',
+                                       text: 'So good. xbß',
+                                       highlight: 'xbß',
+                                       expected: 'So good. <span class="highlight">xbß</span>'
+                               },
+                               {
+                                       desc: 'Test 019: en de Highlighter broken on special character at the end?',
+                                       text: 'So good. xbß.',
+                                       highlight: 'xbß.',
+                                       expected: 'So good. <span class="highlight">xbß.</span>'
+                               },
+                               {
+                                       desc: 'Test 020: RTL he Hebrew',
+                                       text: 'חסיד אומות העולם',
+                                       highlight: 'חסיד אומות העולם',
+                                       expected: '<span class="highlight">חסיד</span> <span class="highlight">אומות</span> <span class="highlight">העולם</span>'
+                               },
+                               {
+                                       desc: 'Test 021: RTL he Hebrew',
+                                       text: 'חסיד אומות העולם',
+                                       highlight: 'חסי',
+                                       expected: '<span class="highlight">חסי</span>ד אומות העולם'
+                               },
+                               {
+                                       desc: 'Test 022: ja Japanese',
+                                       text: '諸国民の中の正義の人',
+                                       highlight: '諸国民の中の正義の人',
+                                       expected: '<span class="highlight">諸国民の中の正義の人</span>'
+                               },
+                               {
+                                       desc: 'Test 023: ja Japanese',
+                                       text: '諸国民の中の正義の人',
+                                       highlight: '諸国',
+                                       expected: '<span class="highlight">諸国</span>民の中の正義の人'
+                               },
+                               {
+                                       desc: 'Test 024: fr French text and « french quotes » (guillemets)',
+                                       text: '« L\'oiseau est sur l’île »',
+                                       highlight: '« L\'oiseau est sur l’île »',
+                                       expected: '<span class="highlight">«</span> <span class="highlight">L\'oiseau</span> <span class="highlight">est</span> <span class="highlight">sur</span> <span class="highlight">l’île</span> <span class="highlight">»</span>'
+                               },
+                               {
+                                       desc: 'Test 025: fr French text and « french quotes » (guillemets)',
+                                       text: '« L\'oiseau est sur l’île »',
+                                       highlight: '« L\'oise',
+                                       expected: '<span class="highlight">«</span> <span class="highlight">L\'oise</span>au est sur l’île »'
+                               },
+                               {
+                                       desc: 'Test 025a: fr French text and « french quotes » (guillemets) - does it match the single strings "«" and "L" separately?',
+                                       text: '« L\'oiseau est sur l’île »',
+                                       highlight: '« L',
+                                       expected: '<span class="highlight">«</span> <span class="highlight">L</span>\'oiseau est sur <span class="highlight">l</span>’île »'
+                               },
+                               {
+                                       desc: 'Test 026: ru Russian',
+                                       text: 'Праведники мира',
+                                       highlight: 'Праведники мира',
+                                       expected: '<span class="highlight">Праведники</span> <span class="highlight">мира</span>'
+                               },
+                               {
+                                       desc: 'Test 027: ru Russian',
+                                       text: 'Праведники мира',
+                                       highlight: 'Праве',
+                                       expected: '<span class="highlight">Праве</span>дники мира'
+                               },
+                               {
+                                       desc: 'Test 028 ka Georgian',
+                                       text: 'მთავარი გვერდი',
+                                       highlight: 'მთავარი გვერდი',
+                                       expected: '<span class="highlight">მთავარი</span> <span class="highlight">გვერდი</span>'
+                               },
+                               {
+                                       desc: 'Test 029 ka Georgian',
+                                       text: 'მთავარი გვერდი',
+                                       highlight: 'მთა',
+                                       expected: '<span class="highlight">მთა</span>ვარი გვერდი'
+                               },
+                               {
+                                       desc: 'Test 030 hy Armenian',
+                                       text: 'Նոնա Գափրինդաշվիլի',
+                                       highlight: 'Նոնա Գափրինդաշվիլի',
+                                       expected: '<span class="highlight">Նոնա</span> <span class="highlight">Գափրինդաշվիլի</span>'
+                               },
+                               {
+                                       desc: 'Test 031 hy Armenian',
+                                       text: 'Նոնա Գափրինդաշվիլի',
+                                       highlight: 'Նոն',
+                                       expected: '<span class="highlight">Նոն</span>ա Գափրինդաշվիլի'
+                               },
+                               {
+                                       desc: 'Test 032: th Thai',
+                                       text: 'พอล แอร์ดิช',
+                                       highlight: 'พอล แอร์ดิช',
+                                       expected: '<span class="highlight">พอล</span> <span class="highlight">แอร์ดิช</span>'
+                               },
+                               {
+                                       desc: 'Test 033: th Thai',
+                                       text: 'พอล แอร์ดิช',
+                                       highlight: 'พอ',
+                                       expected: '<span class="highlight">พอ</span>ล แอร์ดิช'
+                               },
+                               {
+                                       desc: 'Test 034: RTL ar Arabic',
+                                       text: 'بول إيردوس',
+                                       highlight: 'بول إيردوس',
+                                       expected: '<span class="highlight">بول</span> <span class="highlight">إيردوس</span>'
+                               },
+                               {
+                                       desc: 'Test 035: RTL ar Arabic',
+                                       text: 'بول إيردوس',
+                                       highlight: 'بو',
+                                       expected: '<span class="highlight">بو</span>ل إيردوس'
+                               }
+                       ];
 
                $.each( cases, function ( i, item ) {
                        $fixture = $( '<p>' ).text( item.text ).highlightText( item.highlight );
index 1b68809..a3e46ab 100644 (file)
@@ -51,6 +51,7 @@
        } );
 
        QUnit.test( 'Options', function ( assert ) {
+               var html, $lc, x, sitename = 'Wikipedia';
                mw.messages.set( {
                        'foo-lorem': 'Lorem',
                        'foo-ipsum': 'Ipsum',
@@ -60,7 +61,6 @@
                        'foo-bazz-label': 'The Bazz ($1)',
                        'foo-welcome': 'Welcome to $1! (last visit: $2)'
                } );
-               var html, $lc, x, sitename = 'Wikipedia';
 
                // Message key prefix
                html = '<div><span title-msg="lorem"><html:msg key="ipsum" /></span></div>';
index b80af4c..4e77d72 100644 (file)
@@ -12,8 +12,7 @@
 
        // This test is first because if it fails, then almost all of the latter tests are meaningless.
        QUnit.test( 'testing hooks/triggers', function ( assert ) {
-               var test = this,
-                       $collapsible = prepareCollapsible(
+               var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>'
                        ),
                        $content = $collapsible.find( '.mw-collapsible-content' ),
@@ -45,8 +44,7 @@
        } );
 
        QUnit.test( 'basic operation (<div>)', function ( assert ) {
-               var test = this,
-                       $collapsible = prepareCollapsible(
+               var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>'
                        ),
                        $content = $collapsible.find( '.mw-collapsible-content' ),
@@ -71,8 +69,7 @@
        } );
 
        QUnit.test( 'basic operation (<table>)', function ( assert ) {
-               var test = this,
-                       $collapsible = prepareCollapsible(
+               var $collapsible = prepareCollapsible(
                                '<table class="mw-collapsible">' +
                                        '<tr><td>' + loremIpsum + '</td><td>' + loremIpsum + '</td></tr>' +
                                        '<tr><td>' + loremIpsum + '</td><td>' + loremIpsum + '</td></tr>' +
        } );
 
        QUnit.test( 'cloned collapsibles can be made collapsible again', function ( assert ) {
-               var test = this,
-                       $collapsible = prepareCollapsible(
+               var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' + loremIpsum + '</div>'
                        ),
                        $clone = $collapsible.clone() // clone without data and events
index 73e4313..dd7666b 100644 (file)
@@ -1,4 +1,5 @@
 ( function ( $ ) {
+       var html, testElement;
 
        QUnit.module( 'jquery.placeholder', QUnit.newMwEnvironment() );
 
                return;
        }
 
-       var html = '<form>' +
-                       '<input id="input-type-search" type="search" placeholder="Search this site...">' +
-                       '<input id="input-type-text" type="text" placeholder="e.g. John Doe">' +
-                       '<input id="input-type-email" type="email" placeholder="e.g. address@example.ext">' +
-                       '<input id="input-type-url" type="url" placeholder="e.g. http://mathiasbynens.be/">' +
-                       '<input id="input-type-tel" type="tel" placeholder="e.g. +32 472 77 69 88">' +
-                       '<input id="input-type-password" type="password" placeholder="e.g. hunter2">' +
-                       '<textarea id="textarea" name="message" placeholder="Your message goes here"></textarea>' +
-               '</form>',
+       html = '<form>' +
+               '<input id="input-type-search" type="search" placeholder="Search this site...">' +
+               '<input id="input-type-text" type="text" placeholder="e.g. John Doe">' +
+               '<input id="input-type-email" type="email" placeholder="e.g. address@example.ext">' +
+               '<input id="input-type-url" type="url" placeholder="e.g. http://mathiasbynens.be/">' +
+               '<input id="input-type-tel" type="tel" placeholder="e.g. +32 472 77 69 88">' +
+               '<input id="input-type-password" type="password" placeholder="e.g. hunter2">' +
+               '<textarea id="textarea" name="message" placeholder="Your message goes here"></textarea>' +
+       '</form>';
        testElement = function ( $el, assert ) {
-
                var el = $el[ 0 ],
                        placeholder = el.getAttribute( 'placeholder' );
 
        } );
 
        QUnit.test( 'emulates placeholder for <input type=password>', function ( assert ) {
+               var $el, el, placeholder, selector = '#input-type-password';
+
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
 
-               var selector = '#input-type-password',
-                       $el = $( selector ),
-                       el = $el[ 0 ],
-                       placeholder = el.getAttribute( 'placeholder' );
+               $el = $( selector );
+               el = $el[ 0 ];
+               placeholder = el.getAttribute( 'placeholder' );
 
                assert.strictEqual( $el.placeholder(), $el, 'should be chainable' );
 
 
        } );
 
-       QUnit.test( 'emulates placeholder for <textarea></textarea>', function ( assert ) {
+       QUnit.test( 'emulates placeholder for <textarea>', function ( assert ) {
                $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
                testElement( $( '#textarea' ), assert );
        } );
index 97b2c0e..c0b1657 100644 (file)
                                                'jul', 'aug', 'sep', 'oct', 'nov', 'dec' ]
                                },
                                names: [ 'January', 'February', 'March', 'April', 'May', 'June',
-                                               'July', 'August', 'September', 'October', 'November', 'December' ],
+                                       'July', 'August', 'September', 'October', 'November', 'December' ],
                                genitive: [ 'January', 'February', 'March', 'April', 'May', 'June',
-                                               'July', 'August', 'September', 'October', 'November', 'December' ],
+                                       'July', 'August', 'September', 'October', 'November', 'December' ],
                                abbrev: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-                                               'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
+                                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
                        };
                },
                teardown: function () {
index f73d019..5b973f6 100644 (file)
                                                'jul', 'aug', 'sep', 'oct', 'nov', 'dec' ]
                                },
                                names: [ 'January', 'February', 'March', 'April', 'May', 'June',
-                                               'July', 'August', 'September', 'October', 'November', 'December' ],
+                                       'July', 'August', 'September', 'October', 'November', 'December' ],
                                genitive: [ 'January', 'February', 'March', 'April', 'May', 'June',
-                                               'July', 'August', 'September', 'October', 'November', 'December' ],
+                                       'July', 'August', 'September', 'October', 'November', 'December' ],
                                abbrev: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-                                               'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
+                                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
                        };
                },
                teardown: function () {
 
                for ( i = 0; i < data.length; i++ ) {
                        $tr = $( '<tr>' );
+                       // eslint-disable-next-line no-loop-func
                        $.each( data[ i ], function ( j, str ) {
                                var $td = $( '<td>' );
                                $td.text( str ).appendTo( $tr );
                simple,
                simpleAsc,
                function ( $table ) {
+                       var event;
                        $table.tablesorter(
                                { sortList: [ { 0: 'desc' }, { 1: 'desc' } ] }
                        );
                        $table.find( '.headerSort:eq(0)' ).click();
 
                        // Pretend to click while pressing the multi-sort key
-                       var event = $.Event( 'click' );
+                       event = $.Event( 'click' );
                        event[ $table.data( 'tablesorter' ).config.sortMultiSortKey ] = true;
                        $table.find( '.headerSort:eq(1)' ).trigger( event );
                }
index 3ab8428..f958e09 100644 (file)
@@ -1,4 +1,28 @@
 ( function ( $ ) {
+       var caretSample,
+               sig = {
+                       pre: '--~~~~'
+               },
+               bold = {
+                       pre: '\'\'\'',
+                       peri: 'Bold text',
+                       post: '\'\'\''
+               },
+               h2 = {
+                       pre: '== ',
+                       peri: 'Heading 2',
+                       post: ' ==',
+                       regex: /^(\s*)(={1,6})(.*?)\2(\s*)$/,
+                       regexReplace: '$1==$3==$4',
+                       ownline: true
+               },
+               ulist = {
+                       pre: '* ',
+                       peri: 'Bulleted list item',
+                       post: '',
+                       ownline: true,
+                       splitlines: true
+               };
 
        QUnit.module( 'jquery.textSelection', QUnit.newMwEnvironment() );
 
                } );
        }
 
-       var caretSample,
-               sig = {
-                       pre: '--~~~~'
-               },
-               bold = {
-                       pre: '\'\'\'',
-                       peri: 'Bold text',
-                       post: '\'\'\''
-               },
-               h2 = {
-                       pre: '== ',
-                       peri: 'Heading 2',
-                       post: ' ==',
-                       regex: /^(\s*)(={1,6})(.*?)\2(\s*)$/,
-                       regexReplace: '$1==$3==$4',
-                       ownline: true
-               },
-               ulist = {
-                       pre: '* ',
-                       peri: 'Bulleted list item',
-                       post: '',
-                       ownline: true,
-                       splitlines: true
-               };
-
        encapsulateTest( {
                description: 'Adding sig to end of text',
                before: {
index f83f66c..13d7dcc 100644 (file)
@@ -15,7 +15,7 @@
                                                pages: [ {
                                                        pageid: 1,
                                                        ns: 0,
-                                                       title:  'Sandbox',
+                                                       title: 'Sandbox',
                                                        revisions: [ {
                                                                timestamp: '2016-01-01T12:00:00Z',
                                                                contentformat: 'text/x-wiki',
@@ -56,7 +56,7 @@
                                                pages: [ {
                                                        pageid: 4,
                                                        ns: 0,
-                                                       title:  'Async',
+                                                       title: 'Async',
                                                        revisions: [ {
                                                                timestamp: '2016-02-01T12:00:00Z',
                                                                contentformat: 'text/x-wiki',
@@ -97,7 +97,7 @@
                                                pages: [ {
                                                        pageid: 3,
                                                        ns: 0,
-                                                       title:  'Param',
+                                                       title: 'Param',
                                                        revisions: [ {
                                                                timestamp: '2016-03-01T12:00:00Z',
                                                                contentformat: 'text/x-wiki',
                        if ( /edit.+text=Sand/.test( req.requestBody ) ) {
                                req.respond( 200, { 'Content-Type': 'application/json' }, JSON.stringify( {
                                        edit: {
-                                               'new': true,
+                                               new: true,
                                                result: 'Success',
                                                newrevid: 41,
                                                newtimestamp: '2016-04-01T12:00:00Z'
index f3d29c9..854e4b1 100644 (file)
 
                // Requests are POST, match requestBody instead of url
                this.server.respond( function ( request ) {
-                       switch ( request.requestBody ) {
+                       if ( $.inArray( request.requestBody, [
                                // simple
-                               case 'action=options&format=json&formatversion=2&change=foo%3Dbar&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&change=foo%3Dbar&token=%2B%5C',
                                // two options
-                               case 'action=options&format=json&formatversion=2&change=foo%3Dbar%7Cbaz%3Dquux&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&change=foo%3Dbar%7Cbaz%3Dquux&token=%2B%5C',
                                // not bundleable
-                               case 'action=options&format=json&formatversion=2&optionname=foo&optionvalue=bar%7Cquux&token=%2B%5C':
-                               case 'action=options&format=json&formatversion=2&optionname=bar&optionvalue=a%7Cb%7Cc&token=%2B%5C':
-                               case 'action=options&format=json&formatversion=2&change=baz%3Dquux&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&optionname=foo&optionvalue=bar%7Cquux&token=%2B%5C',
+                               'action=options&format=json&formatversion=2&optionname=bar&optionvalue=a%7Cb%7Cc&token=%2B%5C',
+                               'action=options&format=json&formatversion=2&change=baz%3Dquux&token=%2B%5C',
                                // reset an option
-                               case 'action=options&format=json&formatversion=2&change=foo&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&change=foo&token=%2B%5C',
                                // reset an option, not bundleable
-                               case 'action=options&format=json&formatversion=2&optionname=foo%7Cbar%3Dquux&token=%2B%5C':
-                                       assert.ok( true, 'Repond to ' + request.requestBody );
-                                       request.respond( 200, { 'Content-Type': 'application/json' },
-                                               '{ "options": "success" }' );
-                                       break;
-                               default:
-                                       assert.ok( false, 'Unexpected request: ' + request.requestBody );
+                               'action=options&format=json&formatversion=2&optionname=foo%7Cbar%3Dquux&token=%2B%5C'
+                       ] ) !== -1 ) {
+                               assert.ok( true, 'Repond to ' + request.requestBody );
+                               request.respond( 200, { 'Content-Type': 'application/json' },
+                                       '{ "options": "success" }' );
+                       } else {
+                               assert.ok( false, 'Unexpected request: ' + request.requestBody );
                        }
                } );
 
 
                // Requests are POST, match requestBody instead of url
                this.server.respond( function ( request ) {
-                       switch ( request.requestBody ) {
+                       if ( $.inArray( request.requestBody, [
                                // simple
-                               case 'action=options&format=json&formatversion=2&change=foo%3Dbar&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&change=foo%3Dbar&token=%2B%5C',
                                // two options
-                               case 'action=options&format=json&formatversion=2&change=foo%3Dbar%7Cbaz%3Dquux&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&change=foo%3Dbar%7Cbaz%3Dquux&token=%2B%5C',
                                // bundleable with unit separator
-                               case 'action=options&format=json&formatversion=2&change=%1Ffoo%3Dbar%7Cquux%1Fbar%3Da%7Cb%7Cc%1Fbaz%3Dquux&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&change=%1Ffoo%3Dbar%7Cquux%1Fbar%3Da%7Cb%7Cc%1Fbaz%3Dquux&token=%2B%5C',
                                // not bundleable with unit separator
-                               case 'action=options&format=json&formatversion=2&optionname=baz%3Dbaz&optionvalue=quux&token=%2B%5C':
-                               case 'action=options&format=json&formatversion=2&change=%1Ffoo%3Dbar%7Cquux%1Fbar%3Da%7Cb%7Cc&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&optionname=baz%3Dbaz&optionvalue=quux&token=%2B%5C',
+                               'action=options&format=json&formatversion=2&change=%1Ffoo%3Dbar%7Cquux%1Fbar%3Da%7Cb%7Cc&token=%2B%5C',
                                // reset an option
-                               case 'action=options&format=json&formatversion=2&change=foo&token=%2B%5C':
+                               'action=options&format=json&formatversion=2&change=foo&token=%2B%5C',
                                // reset an option, not bundleable
-                               case 'action=options&format=json&formatversion=2&optionname=foo%7Cbar%3Dquux&token=%2B%5C':
-                                       assert.ok( true, 'Repond to ' + request.requestBody );
-                                       request.respond( 200, { 'Content-Type': 'application/json' },
+                               'action=options&format=json&formatversion=2&optionname=foo%7Cbar%3Dquux&token=%2B%5C'
+                       ] ) !== -1 ) {
+                               assert.ok( true, 'Repond to ' + request.requestBody );
+                               request.respond( 200, { 'Content-Type': 'application/json' },
                                                '{ "options": "success" }' );
-                                       break;
-                               default:
-                                       assert.ok( false, 'Unexpected request: ' + request.requestBody );
+                       } else {
+                               assert.ok( false, 'Unexpected request: ' + request.requestBody );
                        }
                } );
 
index 7d27352..74da009 100644 (file)
@@ -39,7 +39,7 @@
                ] );
 
                return new mw.Api().parse( new mw.Title( 'Earth' ) ).done( function ( html ) {
-                       assert.equal( html, '<p><b>Earth</b> is a planet.</p>', 'Parse page by Title object'  );
+                       assert.equal( html, '<p><b>Earth</b> is a planet.</p>', 'Parse page by Title object' );
                } );
        } );
 }( mediaWiki ) );
index 6629f5c..e10a7fa 100644 (file)
 
                return api.postWithToken( 'testassertpost', { action: 'example', key: 'foo', assert: 'user' } )
                        // Cast error to success and vice versa
-                       .then( function ( ) {
+                       .then( function () {
                                return $.Deferred().reject( 'Unexpected success' );
                        }, function ( errorCode ) {
                                assert.equal( errorCode, 'assertuserfailed', 'getToken fails assert' );
                this.server.respond( [ 200, { 'Content-Type': 'application/json' }, '{ "example": "quux" }' ] );
 
                return api.postWithToken( 'csrf',
-                               { action: 'example' },
-                               {
-                                       headers: {
-                                               'X-Foo': 'Bar'
-                                       }
+                       { action: 'example' },
+                       {
+                               headers: {
+                                       'X-Foo': 'Bar'
                                }
-                       )
-                       .then( function () {
-                               assert.equal( test.server.requests[ 0 ].requestHeaders[ 'X-Foo' ], 'Bar', 'Header sent' );
+                       }
+               )
+               .then( function () {
+                       assert.equal( test.server.requests[ 0 ].requestHeaders[ 'X-Foo' ], 'Bar', 'Header sent' );
 
-                               return api.postWithToken( 'csrf',
-                                       { action: 'example' },
-                                       function () {
-                                               assert.ok( false, 'This parameter cannot be a callback' );
-                                       }
-                               );
-                       } )
-                       .then( function ( data ) {
-                               assert.equal( data.example, 'quux' );
+                       return api.postWithToken( 'csrf',
+                               { action: 'example' },
+                               function () {
+                                       assert.ok( false, 'This parameter cannot be a callback' );
+                               }
+                       );
+               } )
+               .then( function ( data ) {
+                       assert.equal( data.example, 'quux' );
 
-                               assert.equal( test.server.requests.length, 2, 'Request made' );
-                       } );
+                       assert.equal( test.server.requests.length, 2, 'Request made' );
+               } );
        } );
 
        QUnit.test( 'postWithToken() - badtoken', function ( assert ) {
index 49a5b18..a5b12c9 100644 (file)
                                hidefilter4: 0,
                                hidefilter5: 0,
                                hidefilter6: 0,
-                               group3: 'all',
+                               group3: 'all'
                        },
                        'Unselected filters return all parameters falsey or \'all\'.'
                );
                                        filters: [
                                                { name: 'filter1' },
                                                { name: 'filter2' },
-                                               { name: 'filter3' },
+                                               { name: 'filter3' }
                                        ]
                                },
                                group2: {
                                        filters: [
                                                { name: 'filter4' },
                                                { name: 'filter5' },
-                                               { name: 'filter6' },
+                                               { name: 'filter6' }
                                        ]
                                }
                        },
+                       model = new mw.rcfilters.dm.FiltersViewModel(),
                        isCapsuleItemMuted = function ( filterName ) {
                                var itemModel = model.getItemByName( filterName ),
                                        groupModel = itemModel.getGroupModel();
                                filter4: false,
                                filter5: false,
                                filter6: false
-                       },
-                       model = new mw.rcfilters.dm.FiltersViewModel();
+                       };
 
                model.initializeFilters( definition );
 
                                                        conflicts: [ 'filter3' ]
                                                },
                                                {
-                                                       name: 'filter6',
+                                                       name: 'filter6'
                                                }
                                        ]
                                }
                        $.extend( true, {}, baseFullState, {
                                filter1: { selected: true },
                                filter2: { conflicted: true },
-                               filter4: { conflicted: true },
+                               filter4: { conflicted: true }
                        } ),
                        'Selecting a filter set its conflicts list as "conflicted".'
                );
                        $.extend( true, {}, baseFullState, {
                                filter1: { selected: true, conflicted: true },
                                filter2: { conflicted: true },
-                               filter4: { selected: true, conflicted: true },
+                               filter4: { selected: true, conflicted: true }
                        } ),
                        'Selecting a conflicting filter sets both sides to conflicted and selected.'
                );
index 40fed08..1bc4c06 100644 (file)
@@ -1,79 +1,80 @@
 ( function ( mw, $ ) {
+       /* eslint-disable camelcase */
        var repeat = function ( input, multiplier ) {
-               return new Array( multiplier + 1 ).join( input );
-       },
-       cases = {
+                       return new Array( multiplier + 1 ).join( input );
+               },
                // See also TitleTest.php#testSecureAndSplit
-               valid: [
-                       'Sandbox',
-                       'A "B"',
-                       'A \'B\'',
-                       '.com',
-                       '~',
-                       '"',
-                       '\'',
-                       'Talk:Sandbox',
-                       'Talk:Foo:Sandbox',
-                       'File:Example.svg',
-                       'File_talk:Example.svg',
-                       'Foo/.../Sandbox',
-                       'Sandbox/...',
-                       'A~~',
-                       ':A',
-                       // Length is 256 total, but only title part matters
-                       'Category:' + repeat( 'x', 248 ),
-                       repeat( 'x', 252 )
-               ],
-               invalid: [
-                       '',
-                       ':',
-                       '__  __',
-                       '  __  ',
-                       // Bad characters forbidden regardless of wgLegalTitleChars
-                       'A [ B',
-                       'A ] B',
-                       'A { B',
-                       'A } B',
-                       'A < B',
-                       'A > B',
-                       'A | B',
-                       'A \t B',
-                       'A \n B',
-                       // URL encoding
-                       'A%20B',
-                       'A%23B',
-                       'A%2523B',
-                       // XML/HTML character entity references
-                       // Note: The ones with # are commented out as those are interpreted as fragment and
-                       // as such end up being valid.
-                       'A &eacute; B',
-                       // 'A &#233; B',
-                       // 'A &#x00E9; B',
-                       // Subject of NS_TALK does not roundtrip to NS_MAIN
-                       'Talk:File:Example.svg',
-                       // Directory navigation
-                       '.',
-                       '..',
-                       './Sandbox',
-                       '../Sandbox',
-                       'Foo/./Sandbox',
-                       'Foo/../Sandbox',
-                       'Sandbox/.',
-                       'Sandbox/..',
-                       // Tilde
-                       'A ~~~ Name',
-                       'A ~~~~ Signature',
-                       'A ~~~~~ Timestamp',
-                       repeat( 'x', 256 ),
-                       // Extension separation is a js invention, for length
-                       // purposes it is part of the title
-                       repeat( 'x', 252 ) + '.json',
-                       // Namespace prefix without actual title
-                       'Talk:',
-                       'Category: ',
-                       'Category: #bar'
-               ]
-       };
+               cases = {
+                       valid: [
+                               'Sandbox',
+                               'A "B"',
+                               'A \'B\'',
+                               '.com',
+                               '~',
+                               '"',
+                               '\'',
+                               'Talk:Sandbox',
+                               'Talk:Foo:Sandbox',
+                               'File:Example.svg',
+                               'File_talk:Example.svg',
+                               'Foo/.../Sandbox',
+                               'Sandbox/...',
+                               'A~~',
+                               ':A',
+                               // Length is 256 total, but only title part matters
+                               'Category:' + repeat( 'x', 248 ),
+                               repeat( 'x', 252 )
+                       ],
+                       invalid: [
+                               '',
+                               ':',
+                               '__  __',
+                               '  __  ',
+                               // Bad characters forbidden regardless of wgLegalTitleChars
+                               'A [ B',
+                               'A ] B',
+                               'A { B',
+                               'A } B',
+                               'A < B',
+                               'A > B',
+                               'A | B',
+                               'A \t B',
+                               'A \n B',
+                               // URL encoding
+                               'A%20B',
+                               'A%23B',
+                               'A%2523B',
+                               // XML/HTML character entity references
+                               // Note: The ones with # are commented out as those are interpreted as fragment and
+                               // as such end up being valid.
+                               'A &eacute; B',
+                               // 'A &#233; B',
+                               // 'A &#x00E9; B',
+                               // Subject of NS_TALK does not roundtrip to NS_MAIN
+                               'Talk:File:Example.svg',
+                               // Directory navigation
+                               '.',
+                               '..',
+                               './Sandbox',
+                               '../Sandbox',
+                               'Foo/./Sandbox',
+                               'Foo/../Sandbox',
+                               'Sandbox/.',
+                               'Sandbox/..',
+                               // Tilde
+                               'A ~~~ Name',
+                               'A ~~~~ Signature',
+                               'A ~~~~~ Timestamp',
+                               repeat( 'x', 256 ),
+                               // Extension separation is a js invention, for length
+                               // purposes it is part of the title
+                               repeat( 'x', 252 ) + '.json',
+                               // Namespace prefix without actual title
+                               'Talk:',
+                               'Category: ',
+                               'Category: #bar'
+                       ]
+               };
 
        QUnit.module( 'mediawiki.Title', QUnit.newMwEnvironment( {
                // mw.Title relies on these three config vars
                }
                for ( i = 0; i < cases.invalid.length; i++ ) {
                        title = cases.invalid[ i ];
+                       // eslint-disable-next-line no-loop-func
                        assert.throws( function () {
                                return new mw.Title( title );
                        }, cases.invalid[ i ] );
index 02212cb..4170897 100644 (file)
@@ -1,6 +1,4 @@
 ( function ( mw, $ ) {
-       QUnit.module( 'mediawiki.cldr', QUnit.newMwEnvironment() );
-
        var pluralTestcases = {
                /*
                 * Sample:
                ]
        };
 
+       QUnit.module( 'mediawiki.cldr', QUnit.newMwEnvironment() );
+
        function pluralTest( langCode, tests ) {
                QUnit.test( 'Plural Test for ' + langCode, function ( assert ) {
-                       for ( var i = 0; i < tests.length; i++ ) {
+                       var i;
+                       for ( i = 0; i < tests.length; i++ ) {
                                assert.equal(
                                        mw.language.convertPlural( tests[ i ][ 0 ], tests[ i ][ 1 ] ),
                                        tests[ i ][ 2 ],
index bc0ef40..46d7837 100644 (file)
@@ -24,7 +24,7 @@
                w.onerror( errorMessage, errorUrl, errorLine, errorColumn, errorObject );
                sinon.assert.calledWithExactly( mw.track, 'global.error',
                        sinon.match( { errorMessage: errorMessage, url: errorUrl, lineNumber: errorLine,
-                       columnNumber: errorColumn, errorObject: errorObject } ) );
+                               columnNumber: errorColumn, errorObject: errorObject } ) );
 
                w = { onerror: oldHandler };
 
index 0495469..3b549bd 100644 (file)
@@ -1,4 +1,5 @@
 ( function ( mw, $ ) {
+       /* eslint-disable camelcase */
        var formatText, formatParse, formatnumTests, specialCharactersPageName, expectedListUsers,
                expectedListUsersSitename, expectedLinkPagenamee, expectedEntrypoints,
                mwLanguageCache = {},
        function process( tasks ) {
                function abort() {
                        tasks.splice( 0, tasks.length );
+                       // eslint-disable-next-line no-use-before-define
                        next();
                }
                function next() {
+                       var task;
                        if ( !tasks ) {
                                // This happens if after the process is completed, one of our callbacks is
                                // invoked. This can happen if a test timed out but the process was still
                                // running. In that case, ignore it. Don't invoke complete() a second time.
                                return;
                        }
-                       var task = tasks.shift();
+                       task = tasks.shift();
                        if ( task ) {
                                task( next, abort );
                        } else {
        } );
 
        QUnit.test( 'Match PHP parser', function ( assert ) {
+               var tasks;
                mw.messages.set( mw.libs.phpParserData.messages );
-               var tasks = $.map( mw.libs.phpParserData.tests, function ( test ) {
+               tasks = $.map( mw.libs.phpParserData.tests, function ( test ) {
                        var done = assert.async();
                        return function ( next, abort ) {
                                getMwLanguage( test.lang )
                                        .then( function ( langClass ) {
+                                               var parser;
                                                mw.config.set( 'wgUserLanguage', test.lang );
-                                               var parser = new mw.jqueryMsg.parser( { language: langClass } );
+                                               // eslint-disable-next-line new-cap
+                                               parser = new mw.jqueryMsg.parser( { language: langClass } );
                                                assert.equal(
                                                        parser.parse( test.key, test.args ).html(),
                                                        test.result,
        ];
 
        QUnit.test( 'formatnum', function ( assert ) {
+               var queue;
                mw.messages.set( 'formatnum-msg', '{{formatnum:$1}}' );
                mw.messages.set( 'formatnum-msg-int', '{{formatnum:$1|R}}' );
-               var queue = $.map( formatnumTests, function ( test ) {
+               queue = $.map( formatnumTests, function ( test ) {
                        var done = assert.async();
                        return function ( next, abort ) {
                                getMwLanguage( test.lang )
                                        .then( function ( langClass ) {
+                                               var parser;
                                                mw.config.set( 'wgUserLanguage', test.lang );
-                                               var parser = new mw.jqueryMsg.parser( { language: langClass } );
+                                               // eslint-disable-next-line new-cap
+                                               parser = new mw.jqueryMsg.parser( { language: langClass } );
                                                assert.equal(
                                                        parser.parse( test.integer ? 'formatnum-msg-int' : 'formatnum-msg',
                                                                [ test.number ] ).html(),
        } );
 
        QUnit.test( 'Behavior in case of invalid wikitext', function ( assert ) {
+               var logSpy;
                mw.messages.set( 'invalid-wikitext', '<b>{{FAIL}}</b>' );
 
                this.suppressWarnings();
-               var logSpy = this.sandbox.spy( mw.log, 'warn' );
+               logSpy = this.sandbox.spy( mw.log, 'warn' );
 
                assert.equal(
                        formatParse( 'invalid-wikitext' ),
index d185d3c..b965079 100644 (file)
@@ -1,6 +1,8 @@
 ( function ( mw, $ ) {
        'use strict';
 
+       var grammarTests;
+
        QUnit.module( 'mediawiki.language', QUnit.newMwEnvironment( {
                setup: function () {
                        this.liveLangData = mw.language.data;
@@ -82,8 +84,8 @@
                // 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 ) {
-
-                       for ( var i = 0; i < test.length; i++ ) {
+                       var i;
+                       for ( i = 0; i < test.length; i++ ) {
                                assert.equal(
                                        mw.language.convertGrammar( test[ i ].word, test[ i ].grammarForm ),
                                        test[ i ].expected,
@@ -94,7 +96,7 @@
        }
 
        // These tests run only for the current UI language.
-       var grammarTests = {
+       grammarTests = {
                bs: [
                        {
                                word: 'word',
index fb3bedb..6f9af76 100644 (file)
 
                function isCssImportApplied() {
                        // Trigger reflow, repaint, redraw, whatever (cross-browser)
-                       var x = $element.css( 'height' );
-                       x = el.innerHTML;
+                       $element.css( 'height' );
+                       el.innerHTML;
                        el.className = el.className;
-                       x = document.documentElement.clientHeight;
+                       document.documentElement.clientHeight;
 
                        return $element.css( prop ) === val;
                }
index ac5b3f8..01665e5 100644 (file)
@@ -29,7 +29,7 @@
                        [ false, ':::' ],
                        [ false, '::0:', 'IPv6 ending in a lone ":"' ],
 
-                       [ true,  '::', 'IPv6 zero address' ],
+                       [ true, '::', 'IPv6 zero address' ],
 
                        [ false, '::fc:100:a:d:1:e:ac:0', 'IPv6 with "::" and 8 words' ],
                        [ false, '::fc:100:a:d:1:e:ac:0:1', 'IPv6 with 9 words' ],
                        [ false, 'fc::100:', 'IPv6 ending with lone ":"' ],
                        [ false, 'fc:::100', 'IPv6 with ":::" in the middle' ],
 
-                       [ true,  'fc::100', 'IPv6 with "::" and 2 words' ],
-                       [ true,  'fc::100:a', 'IPv6 with "::" and 3 words' ],
-                       [ true,  'fc::100:a:d', 'IPv6 with "::" and 4 words' ],
-                       [ true,  'fc::100:a:d:1', 'IPv6 with "::" and 5 words' ],
-                       [ true,  'fc::100:a:d:1:e', 'IPv6 with "::" and 6 words' ],
-                       [ true,  'fc::100:a:d:1:e:ac', 'IPv6 with "::" and 7 words' ],
-                       [ true,  '2001::df', 'IPv6 with "::" and 2 words' ],
-                       [ true,  '2001:5c0:1400:a::df', 'IPv6 with "::" and 5 words' ],
-                       [ true,  '2001:5c0:1400:a::df:2', 'IPv6 with "::" and 6 words' ],
+                       [ true, 'fc::100', 'IPv6 with "::" and 2 words' ],
+                       [ true, 'fc::100:a', 'IPv6 with "::" and 3 words' ],
+                       [ true, 'fc::100:a:d', 'IPv6 with "::" and 4 words' ],
+                       [ true, 'fc::100:a:d:1', 'IPv6 with "::" and 5 words' ],
+                       [ true, 'fc::100:a:d:1:e', 'IPv6 with "::" and 6 words' ],
+                       [ true, 'fc::100:a:d:1:e:ac', 'IPv6 with "::" and 7 words' ],
+                       [ true, '2001::df', 'IPv6 with "::" and 2 words' ],
+                       [ true, '2001:5c0:1400:a::df', 'IPv6 with "::" and 5 words' ],
+                       [ true, '2001:5c0:1400:a::df:2', 'IPv6 with "::" and 6 words' ],
 
                        [ false, 'fc::100:a:d:1:e:ac:0', 'IPv6 with "::" and 8 words' ],
                        [ false, 'fc::100:a:d:1:e:ac:0:1', 'IPv6 with 9 words' ]
index 7466bed..02ca243 100644 (file)
@@ -1,4 +1,4 @@
-/*global isCompatible: true */
+/* global isCompatible: true */
 ( function ( $ ) {
        var testcases = {
                tested: [
 
        QUnit.test( 'isCompatible( featureTestable )', function ( assert ) {
                $.each( testcases.tested, function ( i, ua ) {
-                               assert.strictEqual( isCompatible( ua ), true, ua );
-                       }
-               );
+                       assert.strictEqual( isCompatible( ua ), true, ua );
+               } );
        } );
 
        QUnit.test( 'isCompatible( blacklisted )', function ( assert ) {
                $.each( testcases.blacklisted, function ( i, ua ) {
-                               assert.strictEqual( isCompatible( ua ), false, ua );
-                       }
-               );
+                       assert.strictEqual( isCompatible( ua ), false, ua );
+               } );
        } );
 }( jQuery ) );