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-up7c363752, which removed 'QUnit.config.requireExpects' from our test configuration. Follows-upc4c7007de6and various other commits that already removed the test counts from a subset tests. This commit removes the remainder. Change-Id: Ie58396ba9c83d27220508481cb97c0fa74487756
This commit is contained in:
parent
7d48c807e2
commit
5e602c6132
46 changed files with 215 additions and 222 deletions
|
|
@ -16,7 +16,7 @@
|
|||
/*
|
||||
* @example QUnit
|
||||
* <code>
|
||||
QUnit.test( 'Output matches PHP parser', mw.libs.phpParserData.tests.length, function ( assert ) {
|
||||
QUnit.test( 'Output matches PHP parser', function ( assert ) {
|
||||
mw.messages.set( mw.libs.phpParserData.messages );
|
||||
$.each( mw.libs.phpParserData.tests, function ( i, test ) {
|
||||
QUnit.stop();
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
'<div><p class="some classes" data-length="10">Child paragraph with <a href="http://example.com">A link</a></p>Regular text<span>A span</span></div>',
|
||||
'<div><p data-length=\'10\' class=\'some classes\'>Child paragraph with <a href=\'http://example.com\' >A link</a></p>Regular text<span>A span</span></div>',
|
||||
|
|
@ -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()' );
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
return '<input title="' + title + '" ' + ( accessKey ? 'accessKey="' + accessKey + '" ' : '' ) + ' />';
|
||||
}
|
||||
|
||||
QUnit.test( 'getAccessKeyPrefix', getAccessKeyPrefixTestData.length, function ( assert ) {
|
||||
QUnit.test( 'getAccessKeyPrefix', function ( assert ) {
|
||||
var i;
|
||||
for ( i = 0; i < getAccessKeyPrefixTestData.length; i++ ) {
|
||||
assert.equal( $.fn.updateTooltipAccessKeys.getAccessKeyPrefix( {
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'updateTooltipAccessKeys - current browser', 2, function ( assert ) {
|
||||
QUnit.test( 'updateTooltipAccessKeys - current browser', function ( assert ) {
|
||||
var title = $( makeInput( 'Title', 'a' ) ).updateTooltipAccessKeys().prop( 'title' ),
|
||||
// The new title should be something like "Title [alt-a]", but the exact label will depend on the browser.
|
||||
// The "a" could be capitalized, and the prefix could be anything, e.g. a simple "^" for ctrl-
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
assert.notEqual( result[ 1 ], 'test-', 'Prefix used for testing shouldn\'t be used in production.' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'updateTooltipAccessKeys - no access key', updateTooltipAccessKeysTestData.length, function ( assert ) {
|
||||
QUnit.test( 'updateTooltipAccessKeys - no access key', function ( assert ) {
|
||||
var i, oldTitle, $input, newTitle;
|
||||
for ( i = 0; i < updateTooltipAccessKeysTestData.length; i++ ) {
|
||||
oldTitle = 'Title' + updateTooltipAccessKeysTestData[ i ];
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'updateTooltipAccessKeys - with access key', updateTooltipAccessKeysTestData.length, function ( assert ) {
|
||||
QUnit.test( 'updateTooltipAccessKeys - with access key', function ( assert ) {
|
||||
$.fn.updateTooltipAccessKeys.setTestMode( true );
|
||||
var i, oldTitle, $input, newTitle;
|
||||
for ( i = 0; i < updateTooltipAccessKeysTestData.length; i++ ) {
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
$.fn.updateTooltipAccessKeys.setTestMode( false );
|
||||
} );
|
||||
|
||||
QUnit.test( 'updateTooltipAccessKeys with label element', 2, function ( assert ) {
|
||||
QUnit.test( 'updateTooltipAccessKeys with label element', function ( assert ) {
|
||||
$.fn.updateTooltipAccessKeys.setTestMode( true );
|
||||
var html = '<label for="testInput" title="Title">Label</label><input id="testInput" accessKey="a" />',
|
||||
$label, $input;
|
||||
|
|
@ -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 title="Title">Label<input id="testInput" accessKey="a" /></label>',
|
||||
$label, $input;
|
||||
|
|
|
|||
|
|
@ -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.',
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 = $( '<input>' ).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 <input /> because the bug only occurs on the first time
|
||||
|
|
|
|||
|
|
@ -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%' );
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -220,7 +220,6 @@
|
|||
expected: '<span class="highlight">بو</span>ل إيردوس'
|
||||
}
|
||||
];
|
||||
QUnit.expect( cases.length );
|
||||
|
||||
$.each( cases, function ( i, item ) {
|
||||
$fixture = $( '<p>' ).text( item.text ).highlightText( item.highlight );
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
( function ( $, mw ) {
|
||||
QUnit.module( 'jquery.localize', QUnit.newMwEnvironment() );
|
||||
|
||||
QUnit.test( 'Handle basic replacements', 4, function ( assert ) {
|
||||
QUnit.test( 'Handle basic replacements', function ( assert ) {
|
||||
var html, $lc;
|
||||
mw.messages.set( 'basic', 'Basic stuff' );
|
||||
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
assert.strictEqual( $lc.attr( 'placeholder' ), 'Basic stuff', 'Attribute: placeholder-msg' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Proper escaping', 2, function ( assert ) {
|
||||
QUnit.test( 'Proper escaping', function ( assert ) {
|
||||
var html, $lc;
|
||||
mw.messages.set( 'properfoo', '<proper esc="test">' );
|
||||
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
assert.strictEqual( $lc.attr( 'title' ), mw.msg( 'properfoo' ), 'Attributes are not inserted raw.' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Options', 7, function ( assert ) {
|
||||
QUnit.test( 'Options', function ( assert ) {
|
||||
mw.messages.set( {
|
||||
'foo-lorem': 'Lorem',
|
||||
'foo-ipsum': 'Ipsum',
|
||||
|
|
@ -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 <a>link</a> here!!' );
|
||||
html = '<div><div data-msg-html="html"></div></div>';
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
}
|
||||
|
||||
// This test is first because if it fails, then almost all of the latter tests are meaningless.
|
||||
QUnit.test( 'testing hooks/triggers', 4, function ( assert ) {
|
||||
QUnit.test( 'testing hooks/triggers', function ( assert ) {
|
||||
var test = this,
|
||||
$collapsible = prepareCollapsible(
|
||||
'<div class="mw-collapsible">' + loremIpsum + '</div>'
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
$toggle.trigger( 'click' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'basic operation (<div>)', 5, function ( assert ) {
|
||||
QUnit.test( 'basic operation (<div>)', function ( assert ) {
|
||||
var test = this,
|
||||
$collapsible = prepareCollapsible(
|
||||
'<div class="mw-collapsible">' + loremIpsum + '</div>'
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
$toggle.trigger( 'click' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'basic operation (<table>)', 7, function ( assert ) {
|
||||
QUnit.test( 'basic operation (<table>)', function ( assert ) {
|
||||
var test = this,
|
||||
$collapsible = prepareCollapsible(
|
||||
'<table class="mw-collapsible">' +
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
$toggle.trigger( 'click' );
|
||||
}
|
||||
|
||||
QUnit.test( 'basic operation (<table> with caption)', 10, function ( assert ) {
|
||||
QUnit.test( 'basic operation (<table> with caption)', function ( assert ) {
|
||||
tableWithCaptionTest( prepareCollapsible(
|
||||
'<table class="mw-collapsible">' +
|
||||
'<caption>' + loremIpsum + '</caption>' +
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
), this, assert );
|
||||
} );
|
||||
|
||||
QUnit.test( 'basic operation (<table> with caption and <thead>)', 10, function ( assert ) {
|
||||
QUnit.test( 'basic operation (<table> with caption and <thead>)', function ( assert ) {
|
||||
tableWithCaptionTest( prepareCollapsible(
|
||||
'<table class="mw-collapsible">' +
|
||||
'<caption>' + loremIpsum + '</caption>' +
|
||||
|
|
@ -185,15 +185,15 @@
|
|||
$toggle.trigger( 'click' );
|
||||
}
|
||||
|
||||
QUnit.test( 'basic operation (<ul>)', 7, function ( assert ) {
|
||||
QUnit.test( 'basic operation (<ul>)', function ( assert ) {
|
||||
listTest( 'ul', this, assert );
|
||||
} );
|
||||
|
||||
QUnit.test( 'basic operation (<ol>)', 7, function ( assert ) {
|
||||
QUnit.test( 'basic operation (<ol>)', function ( assert ) {
|
||||
listTest( 'ol', this, assert );
|
||||
} );
|
||||
|
||||
QUnit.test( 'basic operation when synchronous (options.instantHide)', 2, function ( assert ) {
|
||||
QUnit.test( 'basic operation when synchronous (options.instantHide)', function ( assert ) {
|
||||
var $collapsible = prepareCollapsible(
|
||||
'<div class="mw-collapsible">' + loremIpsum + '</div>',
|
||||
{ instantHide: true }
|
||||
|
|
@ -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(
|
||||
'<div>' + loremIpsum + '</div>'
|
||||
);
|
||||
|
|
@ -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(
|
||||
'<div>' + loremIpsum + '</div>'
|
||||
);
|
||||
|
|
@ -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(
|
||||
'<div>' + loremIpsum + '</div>',
|
||||
{ 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(
|
||||
'<div class="mw-collapsible mw-collapsed">' + loremIpsum + '</div>'
|
||||
),
|
||||
|
|
@ -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(
|
||||
'<div class="mw-collapsible">' + loremIpsum + '</div>',
|
||||
{ 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(
|
||||
'<div class="mw-collapsible">' +
|
||||
'<div class="mw-collapsible-toggle">' +
|
||||
|
|
@ -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(
|
||||
'<div class="mw-collapsible" data-collapsetext="Collapse me!" data-expandtext="Expand me!">' +
|
||||
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(
|
||||
'<div class="mw-collapsible">' + loremIpsum + '</div>',
|
||||
{ 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(
|
||||
'<div class="mw-collapsible">' + loremIpsum + '</div>'
|
||||
|
|
|
|||
|
|
@ -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)' );
|
||||
|
|
|
|||
|
|
@ -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 <input type=text>', 22, function ( assert ) {
|
||||
QUnit.test( 'emulates placeholder for <input type=text>', function ( assert ) {
|
||||
$( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
|
||||
testElement( $( '#input-type-text' ), assert );
|
||||
} );
|
||||
|
||||
QUnit.test( 'emulates placeholder for <input type=search>', 22, function ( assert ) {
|
||||
QUnit.test( 'emulates placeholder for <input type=search>', function ( assert ) {
|
||||
$( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
|
||||
testElement( $( '#input-type-search' ), assert );
|
||||
} );
|
||||
|
||||
QUnit.test( 'emulates placeholder for <input type=email>', 22, function ( assert ) {
|
||||
QUnit.test( 'emulates placeholder for <input type=email>', function ( assert ) {
|
||||
$( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
|
||||
testElement( $( '#input-type-email' ), assert );
|
||||
} );
|
||||
|
||||
QUnit.test( 'emulates placeholder for <input type=url>', 22, function ( assert ) {
|
||||
QUnit.test( 'emulates placeholder for <input type=url>', function ( assert ) {
|
||||
$( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
|
||||
testElement( $( '#input-type-url' ), assert );
|
||||
} );
|
||||
|
||||
QUnit.test( 'emulates placeholder for <input type=tel>', 22, function ( assert ) {
|
||||
QUnit.test( 'emulates placeholder for <input type=tel>', function ( assert ) {
|
||||
$( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
|
||||
testElement( $( '#input-type-tel' ), assert );
|
||||
} );
|
||||
|
||||
QUnit.test( 'emulates placeholder for <input type=password>', 13, function ( assert ) {
|
||||
QUnit.test( 'emulates placeholder for <input type=password>', function ( assert ) {
|
||||
$( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
|
||||
|
||||
var selector = '#input-type-password',
|
||||
|
|
@ -137,7 +137,7 @@
|
|||
|
||||
} );
|
||||
|
||||
QUnit.test( 'emulates placeholder for <textarea></textarea>', 22, function ( assert ) {
|
||||
QUnit.test( 'emulates placeholder for <textarea></textarea>', function ( assert ) {
|
||||
$( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
|
||||
testElement( $( '#textarea' ), assert );
|
||||
} );
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
( function ( $ ) {
|
||||
QUnit.module( 'jquery.tabIndex', QUnit.newMwEnvironment() );
|
||||
|
||||
QUnit.test( 'firstTabIndex', 2, function ( assert ) {
|
||||
QUnit.test( 'firstTabIndex', function ( assert ) {
|
||||
var html, $testA, $testB;
|
||||
html = '<form>' +
|
||||
'<input tabindex="7" />' +
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
assert.strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'lastTabIndex', 2, function ( assert ) {
|
||||
QUnit.test( 'lastTabIndex', function ( assert ) {
|
||||
var html, $testA, $testB;
|
||||
html = '<form>' +
|
||||
'<input tabindex="7" />' +
|
||||
|
|
|
|||
|
|
@ -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' ]
|
||||
|
|
|
|||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable" id="mw-bug-32888">' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
'<tr><th>THEAD</th></tr>' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
'<tr><th>THEAD</th></tr>' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
'<tr><th>THEAD</th></tr>' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
'<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 = $(
|
||||
'<table class="sortable">' +
|
||||
'<thead>' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
'<thead>' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
'<thead>' +
|
||||
|
|
@ -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 = $( '<table class="sortable">' +
|
||||
'<thead><tr><th rowspan="2">n</th><th colspan="2">foo</th><th rowspan="2">baz</th></tr>' +
|
||||
'<tr><th>foo</th><th>bar</th></tr></thead>' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
|
|
@ -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 = $(
|
||||
'<table class="sortable">' +
|
||||
|
|
|
|||
|
|
@ -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 = $( '<textarea>' );
|
||||
|
||||
|
|
@ -215,7 +210,7 @@
|
|||
} );
|
||||
|
||||
function caretTest( options ) {
|
||||
QUnit.test( options.description, 2, function ( assert ) {
|
||||
QUnit.test( options.description, function ( assert ) {
|
||||
var pos,
|
||||
$textarea = $( '<textarea>' ).text( options.text );
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'origin is included in GET requests', 1, function ( assert ) {
|
||||
QUnit.test( 'origin is included in GET requests', function ( assert ) {
|
||||
var api = new mw.ForeignApi( '//localhost:4242/w/api.php' );
|
||||
|
||||
this.server.respond( function ( request ) {
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
return api.get( {} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'origin is included in POST requests', 2, function ( assert ) {
|
||||
QUnit.test( 'origin is included in POST requests', function ( assert ) {
|
||||
var api = new mw.ForeignApi( '//localhost:4242/w/api.php' );
|
||||
|
||||
this.server.respond( function ( request ) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( '.getCategoriesByPrefix()', 1, function ( assert ) {
|
||||
QUnit.test( '.getCategoriesByPrefix()', function ( assert ) {
|
||||
this.server.respondWith( [ 200, { 'Content-Type': 'application/json' },
|
||||
'{ "query": { "allpages": [ ' +
|
||||
'{ "title": "Category:Food" },' +
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( '.getMessages()', 1, function ( assert ) {
|
||||
QUnit.test( '.getMessages()', function ( assert ) {
|
||||
this.server.respondWith( /ammessages=foo%7Cbaz/, [
|
||||
200,
|
||||
{ 'Content-Type': 'application/json' },
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'saveOption', 2, function ( assert ) {
|
||||
QUnit.test( 'saveOption', function ( assert ) {
|
||||
var api = new mw.Api(),
|
||||
stub = this.sandbox.stub( mw.Api.prototype, 'saveOptions' );
|
||||
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
assert.deepEqual( stub.getCall( 0 ).args, [ { foo: 'bar' } ], '#saveOptions called correctly' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'saveOptions without Unit Separator', 13, function ( assert ) {
|
||||
QUnit.test( 'saveOptions without Unit Separator', function ( assert ) {
|
||||
var api = new mw.Api( { useUS: false } );
|
||||
|
||||
// We need to respond to the request for token first, otherwise the other requests won't be sent
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'saveOptions with Unit Separator', 14, function ( assert ) {
|
||||
QUnit.test( 'saveOptions with Unit Separator', function ( assert ) {
|
||||
var api = new mw.Api( { useUS: true } );
|
||||
|
||||
// We need to respond to the request for token first, otherwise the other requests won't be sent
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( '#abort', 3, function ( assert ) {
|
||||
QUnit.test( '#abort', function ( assert ) {
|
||||
this.api.get( {
|
||||
a: 1
|
||||
} );
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
( function ( mw, $ ) {
|
||||
QUnit.module( 'mediawiki.api.upload', QUnit.newMwEnvironment( {} ) );
|
||||
|
||||
QUnit.test( 'Basic functionality', 2, function ( assert ) {
|
||||
QUnit.test( 'Basic functionality', function ( assert ) {
|
||||
var api = new mw.Api();
|
||||
assert.ok( api.upload );
|
||||
assert.throws( function () {
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Set up iframe upload', 5, function ( assert ) {
|
||||
QUnit.test( 'Set up iframe upload', function ( assert ) {
|
||||
var $iframe, $form, $input,
|
||||
api = new mw.Api();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// TODO: verify checkboxes == [ 'nsassociated', 'nsinvert' ]
|
||||
|
||||
QUnit.test( '"all" namespace disable checkboxes', 8, function ( assert ) {
|
||||
QUnit.test( '"all" namespace disable checkboxes', function ( assert ) {
|
||||
var selectHtml, $env, $options,
|
||||
rc = require( 'mediawiki.special.recentchanges' );
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
( function ( mw, $ ) {
|
||||
QUnit.module( 'mediawiki.RegExp' );
|
||||
|
||||
QUnit.test( 'escape', 16, function ( assert ) {
|
||||
QUnit.test( 'escape', function ( assert ) {
|
||||
var specials, normal;
|
||||
|
||||
specials = [
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'constructor', cases.invalid.length, function ( assert ) {
|
||||
QUnit.test( 'constructor', function ( assert ) {
|
||||
var i, title;
|
||||
for ( i = 0; i < cases.valid.length; i++ ) {
|
||||
title = new mw.Title( cases.valid[ i ] );
|
||||
|
|
@ -148,7 +148,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'newFromText', cases.valid.length + cases.invalid.length, function ( assert ) {
|
||||
QUnit.test( 'newFromText', function ( assert ) {
|
||||
var i;
|
||||
for ( i = 0; i < cases.valid.length; i++ ) {
|
||||
assert.equal(
|
||||
|
|
@ -166,7 +166,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'makeTitle', 6, function ( assert ) {
|
||||
QUnit.test( 'makeTitle', function ( assert ) {
|
||||
var cases, i, title, expected,
|
||||
NS_MAIN = 0,
|
||||
NS_TALK = 1,
|
||||
|
|
@ -192,7 +192,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'Basic parsing', 21, function ( assert ) {
|
||||
QUnit.test( 'Basic parsing', function ( assert ) {
|
||||
var title;
|
||||
title = new mw.Title( 'File:Foo_bar.JPG' );
|
||||
|
||||
|
|
@ -223,7 +223,7 @@
|
|||
assert.equal( title.getPrefixedText(), '.foo' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Transformation', 12, function ( assert ) {
|
||||
QUnit.test( 'Transformation', function ( assert ) {
|
||||
var title;
|
||||
|
||||
title = new mw.Title( 'File:quux pif.jpg' );
|
||||
|
|
@ -260,7 +260,7 @@
|
|||
assert.equal( title.getFragment(), ' foo bar baz', 'Fragment' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Namespace detection and conversion', 10, function ( assert ) {
|
||||
QUnit.test( 'Namespace detection and conversion', function ( assert ) {
|
||||
var title;
|
||||
|
||||
title = new mw.Title( 'File:User:Example' );
|
||||
|
|
@ -292,13 +292,13 @@
|
|||
assert.equal( title.toString(), 'Penguins:Flightless_yet_cute.jpg' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Throw error on invalid title', 1, function ( assert ) {
|
||||
QUnit.test( 'Throw error on invalid title', function ( assert ) {
|
||||
assert.throws( function () {
|
||||
return new mw.Title( '' );
|
||||
}, 'Throw error on empty string' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Case-sensivity', 5, function ( assert ) {
|
||||
QUnit.test( 'Case-sensivity', function ( assert ) {
|
||||
var title;
|
||||
|
||||
// Default config
|
||||
|
|
@ -323,14 +323,14 @@
|
|||
assert.equal( title.toString(), 'User:John', '$wgCapitalLinks=false: User namespace is insensitive, first-letter becomes uppercase' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'toString / toText', 2, function ( assert ) {
|
||||
QUnit.test( 'toString / toText', function ( assert ) {
|
||||
var title = new mw.Title( 'Some random page' );
|
||||
|
||||
assert.equal( title.toString(), title.getPrefixedDb() );
|
||||
assert.equal( title.toText(), title.getPrefixedText() );
|
||||
} );
|
||||
|
||||
QUnit.test( 'getExtension', 7, function ( assert ) {
|
||||
QUnit.test( 'getExtension', function ( assert ) {
|
||||
function extTest( pagename, ext, description ) {
|
||||
var title = new mw.Title( pagename );
|
||||
assert.equal( title.getExtension(), ext, description || pagename );
|
||||
|
|
@ -348,7 +348,7 @@
|
|||
// extTest( '.NET', null, 'Leading dot is (or is not?) an extension' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'exists', 3, function ( assert ) {
|
||||
QUnit.test( 'exists', function ( assert ) {
|
||||
var title;
|
||||
|
||||
// Empty registry, checks default to null
|
||||
|
|
@ -367,7 +367,7 @@
|
|||
|
||||
} );
|
||||
|
||||
QUnit.test( 'getUrl', 4, function ( assert ) {
|
||||
QUnit.test( 'getUrl', function ( assert ) {
|
||||
var title;
|
||||
mw.config.set( {
|
||||
wgScript: '/w/index.php',
|
||||
|
|
@ -385,7 +385,7 @@
|
|||
assert.equal( title.getUrl( { meme: true } ), '/w/index.php?title=User_talk:John_Cena&meme=true#And_His_Name_Is', 'title with fragment and query parameter' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'newFromImg', 44, function ( assert ) {
|
||||
QUnit.test( 'newFromImg', function ( assert ) {
|
||||
var title, i, thisCase, prefix,
|
||||
cases = [
|
||||
{
|
||||
|
|
@ -496,7 +496,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'getRelativeText', 5, function ( assert ) {
|
||||
QUnit.test( 'getRelativeText', function ( assert ) {
|
||||
var i, thisCase, title,
|
||||
cases = [
|
||||
{
|
||||
|
|
@ -534,7 +534,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'normalizeExtension', 5, function ( assert ) {
|
||||
QUnit.test( 'normalizeExtension', function ( assert ) {
|
||||
var extension, i, thisCase, prefix,
|
||||
cases = [
|
||||
{
|
||||
|
|
@ -573,7 +573,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'newFromUserInput', 12, function ( assert ) {
|
||||
QUnit.test( 'newFromUserInput', function ( assert ) {
|
||||
var title, i, thisCase, prefix,
|
||||
cases = [
|
||||
{
|
||||
|
|
@ -628,7 +628,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'newFromFileName', 54, function ( assert ) {
|
||||
QUnit.test( 'newFromFileName', function ( assert ) {
|
||||
var title, i, thisCase, prefix,
|
||||
cases = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
} ) );
|
||||
|
||||
$.each( [ true, false ], function ( i, strictMode ) {
|
||||
QUnit.test( 'Basic construction and properties (' + ( strictMode ? '' : 'non-' ) + 'strict mode)', 2, function ( assert ) {
|
||||
QUnit.test( 'Basic construction and properties (' + ( strictMode ? '' : 'non-' ) + 'strict mode)', function ( assert ) {
|
||||
var uriString, uri;
|
||||
uriString = 'http://www.ietf.org/rfc/rfc2396.txt';
|
||||
uri = new mw.Uri( uriString, {
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Constructor( String[, Object ] )', 11, function ( assert ) {
|
||||
QUnit.test( 'Constructor( String[, Object ] )', function ( assert ) {
|
||||
var uri;
|
||||
|
||||
uri = new mw.Uri( 'http://www.example.com/dir/?m=foo&m=bar&n=1', {
|
||||
|
|
@ -147,7 +147,7 @@
|
|||
/*jshint +W001 */
|
||||
} );
|
||||
|
||||
QUnit.test( 'Constructor( Object )', 3, function ( assert ) {
|
||||
QUnit.test( 'Constructor( Object )', function ( assert ) {
|
||||
var uri = new mw.Uri( {
|
||||
protocol: 'http',
|
||||
host: 'www.foo.local',
|
||||
|
|
@ -178,7 +178,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Constructor( empty[, Object ] )', 5, function ( assert ) {
|
||||
QUnit.test( 'Constructor( empty[, Object ] )', function ( assert ) {
|
||||
var testuri, MyUri, uri;
|
||||
|
||||
testuri = 'http://example.org/w/index.php?a=1&a=2';
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
assert.deepEqual( uri.query, { a: '2' }, 'null, with options' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Properties', 8, function ( assert ) {
|
||||
QUnit.test( 'Properties', function ( assert ) {
|
||||
var uriBase, uri;
|
||||
|
||||
uriBase = new mw.Uri( 'http://en.wiki.local/w/api.php' );
|
||||
|
|
@ -233,7 +233,7 @@
|
|||
assert.ok( uri.toString().indexOf( 'pif=paf' ) >= 0, 'extend query arguments' );
|
||||
} );
|
||||
|
||||
QUnit.test( '.getQueryString()', 2, function ( assert ) {
|
||||
QUnit.test( '.getQueryString()', function ( assert ) {
|
||||
var uri = new mw.Uri( 'http://search.example.com/?q=uri' );
|
||||
|
||||
assert.deepEqual(
|
||||
|
|
@ -267,7 +267,7 @@
|
|||
|
||||
} );
|
||||
|
||||
QUnit.test( '.clone()', 6, function ( assert ) {
|
||||
QUnit.test( '.clone()', function ( assert ) {
|
||||
var original, clone;
|
||||
|
||||
original = new mw.Uri( 'http://foo.example.org/index.php?one=1&two=2' );
|
||||
|
|
@ -291,7 +291,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( '.toString() after query manipulation', 8, function ( assert ) {
|
||||
QUnit.test( '.toString() after query manipulation', function ( assert ) {
|
||||
var uri;
|
||||
|
||||
uri = new mw.Uri( 'http://www.example.com/dir/?m=foo&m=bar&n=1', {
|
||||
|
|
@ -330,7 +330,7 @@
|
|||
assert.equal( uri.toString(), 'http://www.example.com/dir/', 'empty array value is ommitted' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Variable defaultUri', 2, function ( assert ) {
|
||||
QUnit.test( 'Variable defaultUri', function ( assert ) {
|
||||
var uri,
|
||||
href = 'http://example.org/w/index.php#here',
|
||||
UriClass = mw.UriRelative( function () {
|
||||
|
|
@ -390,7 +390,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Advanced URL', 11, function ( assert ) {
|
||||
QUnit.test( 'Advanced URL', function ( assert ) {
|
||||
var uri, queryString, relativePath;
|
||||
|
||||
uri = new mw.Uri( 'http://auth@www.example.com:81/dir/dir.2/index.htm?q1=0&&test1&test2=value+%28escaped%29#top' );
|
||||
|
|
@ -437,7 +437,7 @@
|
|||
assert.ok( relativePath.indexOf( uri.fragment ) >= 0, 'fragment in relative path' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Parse a uri with an @ symbol in the path and query', 1, function ( assert ) {
|
||||
QUnit.test( 'Parse a uri with an @ symbol in the path and query', function ( assert ) {
|
||||
var uri = new mw.Uri( 'http://www.example.com/test@test?x=@uri&y@=uri&z@=@' );
|
||||
|
||||
assert.deepEqual(
|
||||
|
|
@ -467,7 +467,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Handle protocol-relative URLs', 5, function ( assert ) {
|
||||
QUnit.test( 'Handle protocol-relative URLs', function ( assert ) {
|
||||
var UriRel, uri;
|
||||
|
||||
UriRel = mw.UriRelative( 'glork://en.wiki.local/foo.php' );
|
||||
|
|
@ -488,7 +488,7 @@
|
|||
assert.equal( uri.toString(), 'http://en.wiki.local/foo.com', 'handle absolute paths by supplying host from document in strict mode' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'T37658', 2, function ( assert ) {
|
||||
QUnit.test( 'T37658', function ( assert ) {
|
||||
var testProtocol, testServer, testPort, testPath, UriClass, uri, href;
|
||||
|
||||
testProtocol = 'https://';
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
};
|
||||
|
||||
function pluralTest( langCode, tests ) {
|
||||
QUnit.test( 'Plural Test for ' + langCode, tests.length, function ( assert ) {
|
||||
QUnit.test( 'Plural Test for ' + langCode, function ( assert ) {
|
||||
for ( var i = 0; i < tests.length; i++ ) {
|
||||
assert.equal(
|
||||
mw.language.convertPlural( tests[ i ][ 0 ], tests[ i ][ 1 ] ),
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'set( key, value )', 7, function ( assert ) {
|
||||
QUnit.test( 'set( key, value )', function ( assert ) {
|
||||
var call;
|
||||
|
||||
// Simple case
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
assert.strictEqual( call[ 1 ], '0', '0 is value' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'set( key, value, expires )', 6, function ( assert ) {
|
||||
QUnit.test( 'set( key, value, expires )', function ( assert ) {
|
||||
var date, options;
|
||||
|
||||
date = new Date();
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
assert.strictEqual( options.expires, date, 'custom expiration (with wgCookieExpiration=0)' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'set( key, value, options )', 4, function ( assert ) {
|
||||
QUnit.test( 'set( key, value, options )', function ( assert ) {
|
||||
var date, call;
|
||||
|
||||
mw.cookie.set( 'foo', 'bar', {
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
}, 'Options (incl. expires)' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'get( key ) - no values', 6, function ( assert ) {
|
||||
QUnit.test( 'get( key ) - no values', function ( assert ) {
|
||||
var key, value;
|
||||
|
||||
mw.cookie.get( 'foo' );
|
||||
|
|
@ -158,7 +158,7 @@
|
|||
assert.strictEqual( value, 'bar', 'Custom default value' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'get( key ) - with value', 1, function ( assert ) {
|
||||
QUnit.test( 'get( key ) - with value', function ( assert ) {
|
||||
var value;
|
||||
|
||||
$.cookie.returns( 'bar' );
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
assert.strictEqual( value, 'bar', 'Return value of cookie' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'get( key, prefix )', 1, function ( assert ) {
|
||||
QUnit.test( 'get( key, prefix )', function ( assert ) {
|
||||
var key;
|
||||
|
||||
mw.cookie.get( 'foo', 'bar' );
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
( function ( $, mw ) {
|
||||
QUnit.module( 'mediawiki.errorLogger', QUnit.newMwEnvironment() );
|
||||
|
||||
QUnit.test( 'installGlobalHandler', 7, function ( assert ) {
|
||||
QUnit.test( 'installGlobalHandler', function ( assert ) {
|
||||
var w = {},
|
||||
errorMessage = 'Foo',
|
||||
errorUrl = 'http://example.com',
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
QUnit.module( 'mediawiki.experiments' );
|
||||
|
||||
QUnit.test( 'getBucket( experiment, token )', 4, function ( assert ) {
|
||||
QUnit.test( 'getBucket( experiment, token )', function ( assert ) {
|
||||
var experiment = createExperiment(),
|
||||
token = '123457890';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
( function ( mw ) {
|
||||
QUnit.module( 'mediawiki.html' );
|
||||
|
||||
QUnit.test( 'escape', 2, function ( assert ) {
|
||||
QUnit.test( 'escape', function ( assert ) {
|
||||
assert.throws(
|
||||
function () {
|
||||
mw.html.escape();
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'element()', 1, function ( assert ) {
|
||||
QUnit.test( 'element()', function ( assert ) {
|
||||
assert.equal(
|
||||
mw.html.element(),
|
||||
'<undefined/>',
|
||||
|
|
@ -25,11 +25,11 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'element( tagName )', 1, function ( assert ) {
|
||||
QUnit.test( 'element( tagName )', function ( assert ) {
|
||||
assert.equal( mw.html.element( 'div' ), '<div/>', 'DIV' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'element( tagName, attrs )', 2, function ( assert ) {
|
||||
QUnit.test( 'element( tagName, attrs )', function ( assert ) {
|
||||
assert.equal( mw.html.element( 'div', {} ), '<div/>', 'DIV' );
|
||||
|
||||
assert.equal(
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'element( tagName, attrs, content )', 8, function ( assert ) {
|
||||
QUnit.test( 'element( tagName, attrs, content )', function ( assert ) {
|
||||
|
||||
assert.equal( mw.html.element( 'div', {}, '' ), '<div></div>', 'DIV with empty attributes and content' );
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@
|
|||
next();
|
||||
}
|
||||
|
||||
QUnit.test( 'Replace', 15, function ( assert ) {
|
||||
QUnit.test( 'Replace', function ( assert ) {
|
||||
mw.messages.set( 'simple', 'Foo $1 baz $2' );
|
||||
|
||||
assert.equal( formatParse( 'simple' ), 'Foo $1 baz $2', 'Replacements with no substitutes' );
|
||||
|
|
@ -229,7 +229,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Plural', 9, function ( assert ) {
|
||||
QUnit.test( 'Plural', function ( assert ) {
|
||||
assert.equal( formatParse( 'plural-msg', 0 ), 'Found 0 items', 'Plural test for english with zero as count' );
|
||||
assert.equal( formatParse( 'plural-msg', 1 ), 'Found 1 item', 'Singular test for english' );
|
||||
assert.equal( formatParse( 'plural-msg', 2 ), 'Found 2 items', 'Plural test for english' );
|
||||
|
|
@ -241,7 +241,7 @@
|
|||
assert.equal( formatParse( 'plural-empty-explicit-form', 2 ), 'There is me and other people.' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Gender', 15, function ( assert ) {
|
||||
QUnit.test( 'Gender', function ( assert ) {
|
||||
var originalGender = mw.user.options.get( 'gender' );
|
||||
|
||||
// TODO: These tests should be for mw.msg once mw.msg integrated with mw.jqueryMsg
|
||||
|
|
@ -334,7 +334,7 @@
|
|||
mw.user.options.set( 'gender', originalGender );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Case changing', 8, function ( assert ) {
|
||||
QUnit.test( 'Case changing', function ( assert ) {
|
||||
mw.messages.set( 'to-lowercase', '{{lc:thIS hAS MEsSed uP CapItaliZatiON}}' );
|
||||
assert.equal( formatParse( 'to-lowercase' ), 'this has messed up capitalization', 'To lowercase' );
|
||||
|
||||
|
|
@ -357,14 +357,14 @@
|
|||
assert.equal( formatParse( 'all-caps-except-first' ), 'tHIS HAS MESSED UP CAPITALIZATION', 'To opposite sentence case' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Grammar', 2, function ( assert ) {
|
||||
QUnit.test( 'Grammar', function ( assert ) {
|
||||
assert.equal( formatParse( 'grammar-msg' ), 'Przeszukaj Wiki', 'Grammar Test with sitename' );
|
||||
|
||||
mw.messages.set( 'grammar-msg-wrong-syntax', 'Przeszukaj {{GRAMMAR:grammar_case_xyz}}' );
|
||||
assert.equal( formatParse( 'grammar-msg-wrong-syntax' ), 'Przeszukaj ', 'Grammar Test with wrong grammar template syntax' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Match PHP parser', mw.libs.phpParserData.tests.length, function ( assert ) {
|
||||
QUnit.test( 'Match PHP parser', function ( assert ) {
|
||||
mw.messages.set( mw.libs.phpParserData.messages );
|
||||
var tasks = $.map( mw.libs.phpParserData.tests, function ( test ) {
|
||||
var done = assert.async();
|
||||
|
|
@ -389,7 +389,7 @@
|
|||
process( tasks );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Links', 15, function ( assert ) {
|
||||
QUnit.test( 'Links', function ( assert ) {
|
||||
var testCases,
|
||||
expectedDisambiguationsText,
|
||||
expectedMultipleBars,
|
||||
|
|
@ -515,7 +515,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Replacements in links', 14, function ( assert ) {
|
||||
QUnit.test( 'Replacements in links', function ( assert ) {
|
||||
var testCases = [
|
||||
[
|
||||
'extlink-param-href-full',
|
||||
|
|
@ -606,7 +606,7 @@
|
|||
} );
|
||||
|
||||
// Tests that {{-transformation vs. general parsing are done as requested
|
||||
QUnit.test( 'Curly brace transformation', 16, function ( assert ) {
|
||||
QUnit.test( 'Curly brace transformation', function ( assert ) {
|
||||
var oldUserLang = mw.config.get( 'wgUserLanguage' );
|
||||
|
||||
assertBothModes( assert, [ 'gender-msg', 'Bob', 'male' ], 'Bob: blue', 'gender is resolved' );
|
||||
|
|
@ -669,7 +669,7 @@
|
|||
mw.config.set( 'wgUserLanguage', oldUserLang );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Int', 4, function ( assert ) {
|
||||
QUnit.test( 'Int', function ( assert ) {
|
||||
var newarticletextSource = 'You have followed a link to a page that does not exist yet. To create the page, start typing in the box below (see the [[{{Int:Foobar}}|foobar]] for more info). If you are here by mistake, click your browser\'s back button.',
|
||||
expectedNewarticletext,
|
||||
helpPageTitle = 'Help:Foobar';
|
||||
|
|
@ -711,7 +711,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Ns', 4, function ( assert ) {
|
||||
QUnit.test( 'Ns', function ( assert ) {
|
||||
mw.messages.set( 'ns-template-talk', '{{ns:Template talk}}' );
|
||||
assert.equal(
|
||||
formatParse( 'ns-template-talk' ),
|
||||
|
|
@ -743,7 +743,7 @@
|
|||
|
||||
// Tests that getMessageFunction is used for non-plain messages with curly braces or
|
||||
// square brackets, but not otherwise.
|
||||
QUnit.test( 'mw.Message.prototype.parser monkey-patch', 22, function ( assert ) {
|
||||
QUnit.test( 'mw.Message.prototype.parser monkey-patch', function ( assert ) {
|
||||
var oldGMF, outerCalled, innerCalled;
|
||||
|
||||
mw.messages.set( {
|
||||
|
|
@ -891,7 +891,7 @@
|
|||
}
|
||||
];
|
||||
|
||||
QUnit.test( 'formatnum', formatnumTests.length, function ( assert ) {
|
||||
QUnit.test( 'formatnum', function ( assert ) {
|
||||
mw.messages.set( 'formatnum-msg', '{{formatnum:$1}}' );
|
||||
mw.messages.set( 'formatnum-msg-int', '{{formatnum:$1|R}}' );
|
||||
var queue = $.map( formatnumTests, function ( test ) {
|
||||
|
|
@ -918,7 +918,7 @@
|
|||
} );
|
||||
|
||||
// HTML in wikitext
|
||||
QUnit.test( 'HTML', 33, function ( assert ) {
|
||||
QUnit.test( 'HTML', function ( assert ) {
|
||||
mw.messages.set( 'jquerymsg-italics-msg', '<i>Very</i> important' );
|
||||
|
||||
assertBothModes( assert, [ 'jquerymsg-italics-msg' ], mw.messages.get( 'jquerymsg-italics-msg' ), 'Simple italics unchanged' );
|
||||
|
|
@ -1104,7 +1104,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Nowiki', 3, function ( assert ) {
|
||||
QUnit.test( 'Nowiki', function ( assert ) {
|
||||
mw.messages.set( 'jquerymsg-nowiki-link', 'Foo <nowiki>[[bar]]</nowiki> baz.' );
|
||||
assert.equal(
|
||||
formatParse( 'jquerymsg-nowiki-link' ),
|
||||
|
|
@ -1127,7 +1127,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Behavior in case of invalid wikitext', 3, function ( assert ) {
|
||||
QUnit.test( 'Behavior in case of invalid wikitext', function ( assert ) {
|
||||
mw.messages.set( 'invalid-wikitext', '<b>{{FAIL}}</b>' );
|
||||
|
||||
this.suppressWarnings();
|
||||
|
|
@ -1148,7 +1148,7 @@
|
|||
assert.equal( logSpy.callCount, 2, 'mw.log.warn calls' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Integration', 5, function ( assert ) {
|
||||
QUnit.test( 'Integration', function ( assert ) {
|
||||
var expected, logSpy, msg;
|
||||
|
||||
expected = '<b><a title="Bold" href="/wiki/Bold">Bold</a>!</b>';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
( function ( $ ) {
|
||||
QUnit.module( 'mediawiki.jscompat', QUnit.newMwEnvironment() );
|
||||
|
||||
QUnit.test( 'Variable with Unicode letter in name', 3, function ( assert ) {
|
||||
QUnit.test( 'Variable with Unicode letter in name', function ( assert ) {
|
||||
var orig, ŝablono;
|
||||
|
||||
orig = 'some token';
|
||||
|
|
@ -44,7 +44,6 @@
|
|||
expected, $textarea;
|
||||
|
||||
maxn = 4;
|
||||
QUnit.expect( maxn * 2 );
|
||||
|
||||
function repeat( str, n ) {
|
||||
var out;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'mw.language getData and setData', 3, function ( assert ) {
|
||||
QUnit.test( 'mw.language getData and setData', function ( assert ) {
|
||||
mw.language.setData( 'en', 'testkey', 'testvalue' );
|
||||
assert.equal( mw.language.getData( 'en', 'testkey' ), 'testvalue', 'Getter setter test for mw.language' );
|
||||
assert.equal( mw.language.getData( 'en', 'invalidkey' ), undefined, 'Getter setter test for mw.language with invalid key' );
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
assert.equal( mw.language.getData( 'en-US', 'testkey' ), 'testvalue', 'Case insensitive test for mw.language' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'mw.language.commafy test', 9, function ( assert ) {
|
||||
QUnit.test( 'mw.language.commafy test', function ( assert ) {
|
||||
mw.language.setData( 'en', 'digitGroupingPattern', null );
|
||||
mw.language.setData( 'en', 'digitTransformTable', null );
|
||||
mw.language.setData( 'en', 'separatorTransformTable', null );
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
assert.equal( mw.language.commafy( 123456789.567, '###,###,#0.00' ), '1,234,567,89.56', 'Decimal part as group of 3 and last one 2' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'mw.language.convertNumber', 2, function ( assert ) {
|
||||
QUnit.test( 'mw.language.convertNumber', function ( assert ) {
|
||||
mw.language.setData( 'en', 'digitGroupingPattern', null );
|
||||
mw.language.setData( 'en', 'digitTransformTable', null );
|
||||
mw.language.setData( 'en', 'separatorTransformTable', { ',': '.', '.': ',' } );
|
||||
|
|
@ -57,7 +57,6 @@
|
|||
// The test works only if the content language is opt.language
|
||||
// because it requires [lang].js to be loaded.
|
||||
QUnit.test( 'Grammar test for lang=' + langCode, function ( assert ) {
|
||||
QUnit.expect( test.length );
|
||||
|
||||
for ( var i = 0; i < test.length; i++ ) {
|
||||
assert.equal(
|
||||
|
|
@ -555,7 +554,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'List to text test', 4, function ( assert ) {
|
||||
QUnit.test( 'List to text test', function ( assert ) {
|
||||
assert.equal( mw.language.listToText( [] ), '', 'Blank list' );
|
||||
assert.equal( mw.language.listToText( [ 'a' ] ), 'a', 'Single item' );
|
||||
assert.equal( mw.language.listToText( [ 'a', 'b' ] ), 'a and b', 'Two items' );
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
);
|
||||
}
|
||||
|
||||
QUnit.test( 'Basic', 2, function ( assert ) {
|
||||
QUnit.test( 'Basic', function ( assert ) {
|
||||
var isAwesomeDone;
|
||||
|
||||
mw.loader.testCallback = function () {
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Object method as module name', 2, function ( assert ) {
|
||||
QUnit.test( 'Object method as module name', function ( assert ) {
|
||||
var isAwesomeDone;
|
||||
|
||||
mw.loader.testCallback = function () {
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( '.using( .. ) Promise', 2, function ( assert ) {
|
||||
QUnit.test( '.using( .. ) Promise', function ( assert ) {
|
||||
var isAwesomeDone;
|
||||
|
||||
mw.loader.testCallback = function () {
|
||||
|
|
@ -176,11 +176,12 @@
|
|||
).always( done );
|
||||
} );
|
||||
|
||||
QUnit.test( '.load() - Error: Unregistered (ignored)', 0, function ( assert ) {
|
||||
QUnit.test( '.load() - Error: Unregistered (ignored)', function ( assert ) {
|
||||
assert.expect( 0 );
|
||||
mw.loader.load( 'test.using.unreg2' );
|
||||
} );
|
||||
|
||||
QUnit.test( '.implement( styles={ "css": [text, ..] } )', 2, function ( assert ) {
|
||||
QUnit.test( '.implement( styles={ "css": [text, ..] } )', function ( assert ) {
|
||||
var $element = $( '<div class="mw-test-implement-a"></div>' ).appendTo( '#qunit-fixture' );
|
||||
|
||||
assert.notEqual(
|
||||
|
|
@ -206,7 +207,7 @@
|
|||
return mw.loader.using( 'test.implement.a' );
|
||||
} );
|
||||
|
||||
QUnit.test( '.implement( styles={ "url": { <media>: [url, ..] } } )', 7, function ( assert ) {
|
||||
QUnit.test( '.implement( styles={ "url": { <media>: [url, ..] } } )', function ( assert ) {
|
||||
var $element1 = $( '<div class="mw-test-implement-b1"></div>' ).appendTo( '#qunit-fixture' ),
|
||||
$element2 = $( '<div class="mw-test-implement-b2"></div>' ).appendTo( '#qunit-fixture' ),
|
||||
$element3 = $( '<div class="mw-test-implement-b3"></div>' ).appendTo( '#qunit-fixture' ),
|
||||
|
|
@ -268,7 +269,7 @@
|
|||
} );
|
||||
|
||||
// Backwards compatibility
|
||||
QUnit.test( '.implement( styles={ <media>: text } ) (back-compat)', 2, function ( assert ) {
|
||||
QUnit.test( '.implement( styles={ <media>: text } ) (back-compat)', function ( assert ) {
|
||||
var $element = $( '<div class="mw-test-implement-c"></div>' ).appendTo( '#qunit-fixture' );
|
||||
|
||||
assert.notEqual(
|
||||
|
|
@ -295,7 +296,7 @@
|
|||
} );
|
||||
|
||||
// Backwards compatibility
|
||||
QUnit.test( '.implement( styles={ <media>: [url, ..] } ) (back-compat)', 4, function ( assert ) {
|
||||
QUnit.test( '.implement( styles={ <media>: [url, ..] } ) (back-compat)', function ( assert ) {
|
||||
var $element = $( '<div class="mw-test-implement-d"></div>' ).appendTo( '#qunit-fixture' ),
|
||||
$element2 = $( '<div class="mw-test-implement-d2"></div>' ).appendTo( '#qunit-fixture' ),
|
||||
done = assert.async();
|
||||
|
|
@ -329,7 +330,7 @@
|
|||
} );
|
||||
|
||||
// @import (T33676)
|
||||
QUnit.test( '.implement( styles has @import )', 7, function ( assert ) {
|
||||
QUnit.test( '.implement( styles has @import )', function ( assert ) {
|
||||
var isJsExecuted, $element,
|
||||
done = assert.async();
|
||||
|
||||
|
|
@ -372,7 +373,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( '.implement( dependency with styles )', 4, function ( assert ) {
|
||||
QUnit.test( '.implement( dependency with styles )', function ( assert ) {
|
||||
var $element = $( '<div class="mw-test-implement-e"></div>' ).appendTo( '#qunit-fixture' ),
|
||||
$element2 = $( '<div class="mw-test-implement-e2"></div>' ).appendTo( '#qunit-fixture' );
|
||||
|
||||
|
|
@ -423,12 +424,12 @@
|
|||
return mw.loader.using( 'test.implement.e' );
|
||||
} );
|
||||
|
||||
QUnit.test( '.implement( only scripts )', 1, function ( assert ) {
|
||||
QUnit.test( '.implement( only scripts )', function ( assert ) {
|
||||
mw.loader.implement( 'test.onlyscripts', function () {} );
|
||||
assert.strictEqual( mw.loader.getState( 'test.onlyscripts' ), 'ready' );
|
||||
} );
|
||||
|
||||
QUnit.test( '.implement( only messages )', 2, function ( assert ) {
|
||||
QUnit.test( '.implement( only messages )', function ( assert ) {
|
||||
assert.assertFalse( mw.messages.exists( 'T31107' ), 'Verify that the test message doesn\'t exist yet' );
|
||||
|
||||
mw.loader.implement( 'test.implement.msgs', [], {}, { T31107: 'loaded' } );
|
||||
|
|
@ -440,12 +441,12 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( '.implement( empty )', 1, function ( assert ) {
|
||||
QUnit.test( '.implement( empty )', function ( assert ) {
|
||||
mw.loader.implement( 'test.empty' );
|
||||
assert.strictEqual( mw.loader.getState( 'test.empty' ), 'ready' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Broken indirect dependency', 4, function ( assert ) {
|
||||
QUnit.test( 'Broken indirect dependency', function ( assert ) {
|
||||
// don't emit an error event
|
||||
this.sandbox.stub( mw, 'track' );
|
||||
|
||||
|
|
@ -464,7 +465,7 @@
|
|||
assert.strictEqual( mw.track.callCount, 1 );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Out-of-order implementation', 9, function ( assert ) {
|
||||
QUnit.test( 'Out-of-order implementation', function ( assert ) {
|
||||
mw.loader.register( [
|
||||
[ 'test.module4', '0' ],
|
||||
[ 'test.module5', '0', [ 'test.module4' ] ],
|
||||
|
|
@ -484,7 +485,7 @@
|
|||
assert.strictEqual( mw.loader.getState( 'test.module6' ), 'ready', 'Expected "ready" state for test.module6' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Missing dependency', 13, function ( assert ) {
|
||||
QUnit.test( 'Missing dependency', function ( assert ) {
|
||||
mw.loader.register( [
|
||||
[ 'test.module7', '0' ],
|
||||
[ 'test.module8', '0', [ 'test.module7' ] ],
|
||||
|
|
@ -531,7 +532,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Dependency handling', 5, function ( assert ) {
|
||||
QUnit.test( 'Dependency handling', function ( assert ) {
|
||||
var done = assert.async();
|
||||
mw.loader.register( [
|
||||
// [module, version, dependencies, group, source]
|
||||
|
|
@ -569,7 +570,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Skip-function handling', 5, function ( assert ) {
|
||||
QUnit.test( 'Skip-function handling', function ( assert ) {
|
||||
mw.loader.register( [
|
||||
// [module, version, dependencies, group, source, skip]
|
||||
[ 'testSkipped', '1', [], null, 'testloader', 'return true;' ],
|
||||
|
|
@ -599,7 +600,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.asyncTest( '.load( "//protocol-relative" ) - T32825', 2, function ( assert ) {
|
||||
QUnit.asyncTest( '.load( "//protocol-relative" ) - T32825', function ( assert ) {
|
||||
// This bug was actually already fixed in 1.18 and later when discovered in 1.17.
|
||||
// Test is for regressions!
|
||||
|
||||
|
|
@ -620,7 +621,7 @@
|
|||
mw.loader.load( target );
|
||||
} );
|
||||
|
||||
QUnit.asyncTest( '.load( "/absolute-path" )', 2, function ( assert ) {
|
||||
QUnit.asyncTest( '.load( "/absolute-path" )', function ( assert ) {
|
||||
// Forge a URL to the test callback script
|
||||
var target = QUnit.fixurl(
|
||||
mw.config.get( 'wgScriptPath' ) + '/tests/qunit/data/qunitOkCall.js'
|
||||
|
|
@ -653,7 +654,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Executing race - T112232', 2, function ( assert ) {
|
||||
QUnit.test( 'Executing race - T112232', function ( assert ) {
|
||||
var done = false;
|
||||
|
||||
// The red herring schedules its CSS buffer first. In T112232, a bug in the
|
||||
|
|
@ -736,7 +737,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'require()', 6, function ( assert ) {
|
||||
QUnit.test( 'require()', function ( assert ) {
|
||||
mw.loader.register( [
|
||||
[ 'test.require1', '0' ],
|
||||
[ 'test.require2', '0' ],
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'register', 2, function ( assert ) {
|
||||
QUnit.test( 'register', function ( assert ) {
|
||||
var testMessagePosterConstructor = function () {};
|
||||
|
||||
mw.messagePoster.factory.register( TEST_MODEL, testMessagePosterConstructor );
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'render', 2, function ( assert ) {
|
||||
QUnit.test( 'render', function ( assert ) {
|
||||
var html, htmlPartial, data, partials,
|
||||
template = mw.template.get( 'stub', 'test_greeting.mustache' ),
|
||||
partial = mw.template.get( 'stub', 'test_greeting_suffix.mustache' );
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'add', 1, function ( assert ) {
|
||||
QUnit.test( 'add', function ( assert ) {
|
||||
assert.throws(
|
||||
function () {
|
||||
mw.template.add( 'module', 'test_templates_foo', 'hello' );
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'compile', 1, function ( assert ) {
|
||||
QUnit.test( 'compile', function ( assert ) {
|
||||
assert.throws(
|
||||
function () {
|
||||
mw.template.compile( '{{foo}}', 'rainbow' );
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'get', 4, function ( assert ) {
|
||||
QUnit.test( 'get', function ( assert ) {
|
||||
assert.strictEqual( mw.template.get( 'test.mediawiki.template', 'test_templates_foo.xyz' ), 'xyz compiler' );
|
||||
assert.strictEqual( mw.template.get( 'test.mediawiki.template', 'test_templates_foo.abc' ), 'abc default compiler' );
|
||||
assert.throws(
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'Initial check', 8, function ( assert ) {
|
||||
QUnit.test( 'Initial check', function ( assert ) {
|
||||
assert.ok( window.jQuery, 'jQuery defined' );
|
||||
assert.ok( window.$, '$ defined' );
|
||||
assert.strictEqual( window.$, window.jQuery, '$ alias to jQuery' );
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
this.restoreWarnings();
|
||||
} );
|
||||
|
||||
QUnit.test( 'mw.format', 2, function ( assert ) {
|
||||
QUnit.test( 'mw.format', function ( assert ) {
|
||||
assert.equal(
|
||||
mw.format( 'Format $1 $2', 'foo', 'bar' ),
|
||||
'Format foo bar',
|
||||
|
|
@ -323,7 +323,7 @@
|
|||
|
||||
} );
|
||||
|
||||
QUnit.test( 'mw.msg', 14, function ( assert ) {
|
||||
QUnit.test( 'mw.msg', function ( assert ) {
|
||||
assert.ok( mw.messages.set( 'hello', 'Hello <b>awesome</b> world' ), 'mw.messages.set: Register' );
|
||||
assert.equal( mw.msg( 'hello' ), 'Hello <b>awesome</b> world', 'Gets message with default options (existing message)' );
|
||||
assert.equal( mw.msg( 'goodbye' ), '⧼goodbye⧽', 'Gets message with default options (nonexistent message)' );
|
||||
|
|
@ -346,7 +346,7 @@
|
|||
assert.equal( mw.msg( 'int-msg' ), 'Some Other Message', 'int is resolved' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'mw.hook', 13, function ( assert ) {
|
||||
QUnit.test( 'mw.hook', function ( assert ) {
|
||||
var hook, add, fire, chars, callback;
|
||||
|
||||
mw.hook( 'test.hook.unfired' ).add( function () {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.asyncTest( 'toggleToc', 4, function ( assert ) {
|
||||
QUnit.asyncTest( 'toggleToc', function ( assert ) {
|
||||
var tocHtml, $toggleLink, $tocList;
|
||||
|
||||
assert.strictEqual( $( '#toc' ).length, 0, 'There is no table of contents on the page at the beginning' );
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
( function ( mw ) {
|
||||
QUnit.module( 'mediawiki.track' );
|
||||
|
||||
QUnit.test( 'track', 1, function ( assert ) {
|
||||
QUnit.test( 'track', function ( assert ) {
|
||||
var sequence = [];
|
||||
mw.trackSubscribe( 'simple', function ( topic, data ) {
|
||||
sequence.push( [ topic, data ] );
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
], 'Events after subscribing' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'trackSubscribe', 4, function ( assert ) {
|
||||
QUnit.test( 'trackSubscribe', function ( assert ) {
|
||||
var now,
|
||||
sequence = [];
|
||||
mw.track( 'before', { key: 1 } );
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'trackUnsubscribe', 1, function ( assert ) {
|
||||
QUnit.test( 'trackUnsubscribe', function ( assert ) {
|
||||
var sequence = [];
|
||||
function unsubber( topic, data ) {
|
||||
sequence.push( [ topic, data ] );
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'rawurlencode', 1, function ( assert ) {
|
||||
QUnit.test( 'rawurlencode', function ( assert ) {
|
||||
assert.equal( mw.util.rawurlencode( 'Test:A & B/Here' ), 'Test%3AA%20%26%20B%2FHere' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'escapeId', 17, function ( assert ) {
|
||||
QUnit.test( 'escapeId', function ( assert ) {
|
||||
mw.config.set( 'wgExperimentalHtmlIds', false );
|
||||
$.each( {
|
||||
'+': '.2B',
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'wikiUrlencode', 11, function ( assert ) {
|
||||
QUnit.test( 'wikiUrlencode', function ( assert ) {
|
||||
assert.equal( mw.util.wikiUrlencode( 'Test:A & B/Here' ), 'Test:A_%26_B/Here' );
|
||||
// See also wfUrlencodeTest.php#provideURLS
|
||||
$.each( {
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'getUrl', 14, function ( assert ) {
|
||||
QUnit.test( 'getUrl', function ( assert ) {
|
||||
var href;
|
||||
mw.config.set( {
|
||||
wgScript: '/w/index.php',
|
||||
|
|
@ -189,7 +189,7 @@
|
|||
assert.equal( href, '/w/index.php?action=edit#.2B.26.3D:.3B.40.24-_..21.2A.2F.5B.5D.3C.3E.27.C2.A7', 'fragment with various characters' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'wikiScript', 4, function ( assert ) {
|
||||
QUnit.test( 'wikiScript', function ( assert ) {
|
||||
mw.config.set( {
|
||||
// customized wgScript for T41103
|
||||
wgScript: '/w/i.php',
|
||||
|
|
@ -210,7 +210,7 @@
|
|||
assert.equal( mw.util.wikiScript( 'api' ), '/w/api.php', 'API path' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'addCSS', 3, function ( assert ) {
|
||||
QUnit.test( 'addCSS', function ( assert ) {
|
||||
var $el, style;
|
||||
$el = $( '<div>' ).attr( 'id', 'mw-addcsstest' ).appendTo( '#qunit-fixture' );
|
||||
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
$( style.ownerNode ).remove();
|
||||
} );
|
||||
|
||||
QUnit.test( 'getParamValue', 5, function ( assert ) {
|
||||
QUnit.test( 'getParamValue', function ( assert ) {
|
||||
var url;
|
||||
|
||||
url = 'http://example.org/?foo=wrong&foo=right#&foo=bad';
|
||||
|
|
@ -241,7 +241,7 @@
|
|||
assert.strictEqual( mw.util.getParamValue( 'TEST', url ), 'a b+c d', 'T32441: getParamValue must understand "+" encoding of space (multiple spaces)' );
|
||||
} );
|
||||
|
||||
QUnit.test( '$content', 2, function ( assert ) {
|
||||
QUnit.test( '$content', function ( assert ) {
|
||||
assert.ok( mw.util.$content instanceof jQuery, 'mw.util.$content instance of jQuery' );
|
||||
assert.strictEqual( mw.util.$content.length, 1, 'mw.util.$content must have length of 1' );
|
||||
} );
|
||||
|
|
@ -252,7 +252,7 @@
|
|||
* Previously, test elements where invisible to the selector since only
|
||||
* one element can have a given id.
|
||||
*/
|
||||
QUnit.test( 'addPortletLink', 13, function ( assert ) {
|
||||
QUnit.test( 'addPortletLink', function ( assert ) {
|
||||
var pTestTb, pCustom, vectorTabs, tbRL, cuQuux, $cuQuux, tbMW, $tbMW, tbRLDM, caFoo,
|
||||
addedAfter, tbRLDMnonexistentid, tbRLDMemptyjquery;
|
||||
|
||||
|
|
@ -349,7 +349,7 @@
|
|||
assert.equal( tbRLDMemptyjquery, $( '#p-test-tb li:last' )[ 0 ], 'Fallback to adding at the end (nextnode as empty jQuery object)' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'validateEmail', 6, function ( assert ) {
|
||||
QUnit.test( 'validateEmail', function ( assert ) {
|
||||
assert.strictEqual( mw.util.validateEmail( '' ), null, 'Should return null for empty string ' );
|
||||
assert.strictEqual( mw.util.validateEmail( 'user@localhost' ), true, 'Return true for a valid e-mail address' );
|
||||
|
||||
|
|
@ -362,19 +362,19 @@
|
|||
assert.strictEqual( mw.util.validateEmail( 'userfoo@ex-ample.org' ), true, 'Emails may contain a hyphen' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'isIPv6Address', 40, function ( assert ) {
|
||||
QUnit.test( 'isIPv6Address', function ( assert ) {
|
||||
$.each( IPV6_CASES, function ( i, ipCase ) {
|
||||
assert.strictEqual( mw.util.isIPv6Address( ipCase[ 1 ] ), ipCase[ 0 ], ipCase[ 2 ] );
|
||||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'isIPv4Address', 11, function ( assert ) {
|
||||
QUnit.test( 'isIPv4Address', function ( assert ) {
|
||||
$.each( IPV4_CASES, function ( i, ipCase ) {
|
||||
assert.strictEqual( mw.util.isIPv4Address( ipCase[ 1 ] ), ipCase[ 0 ], ipCase[ 2 ] );
|
||||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'isIPAddress', 51, function ( assert ) {
|
||||
QUnit.test( 'isIPAddress', function ( assert ) {
|
||||
$.each( IPV4_CASES, function ( i, ipCase ) {
|
||||
assert.strictEqual( mw.util.isIPv4Address( ipCase[ 1 ] ), ipCase[ 0 ], ipCase[ 2 ] );
|
||||
} );
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
}
|
||||
} ) );
|
||||
|
||||
QUnit.test( 'isElementInViewport', 6, function ( assert ) {
|
||||
QUnit.test( 'isElementInViewport', function ( assert ) {
|
||||
var viewport = $.extend( {}, DEFAULT_VIEWPORT );
|
||||
assert.ok( mw.viewport.isElementInViewport( this.el, viewport ),
|
||||
'It should return true when the element is fully enclosed in the viewport' );
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
'It should default to the window object if no viewport is given' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'isElementInViewport with scrolled page', 1, function ( assert ) {
|
||||
QUnit.test( 'isElementInViewport with scrolled page', function ( assert ) {
|
||||
var viewport = {
|
||||
top: 2000,
|
||||
left: 0,
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
window.scrollTo( 0, 0 );
|
||||
} );
|
||||
|
||||
QUnit.test( 'isElementCloseToViewport', 3, function ( assert ) {
|
||||
QUnit.test( 'isElementCloseToViewport', function ( assert ) {
|
||||
var
|
||||
viewport = {
|
||||
top: 90,
|
||||
|
|
|
|||
|
|
@ -147,14 +147,14 @@
|
|||
|
||||
QUnit.module( 'startup', QUnit.newMwEnvironment() );
|
||||
|
||||
QUnit.test( 'isCompatible( featureTestable )', testcases.tested.length, function ( assert ) {
|
||||
QUnit.test( 'isCompatible( featureTestable )', function ( assert ) {
|
||||
$.each( testcases.tested, function ( i, ua ) {
|
||||
assert.strictEqual( isCompatible( ua ), true, ua );
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'isCompatible( blacklisted )', testcases.blacklisted.length, function ( assert ) {
|
||||
QUnit.test( 'isCompatible( blacklisted )', function ( assert ) {
|
||||
$.each( testcases.blacklisted, function ( i, ua ) {
|
||||
assert.strictEqual( isCompatible( ua ), false, ua );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue