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'
+ );
} );
}
} );
byteLimitTest( {
- description: 'Plain text input. Calling byteLimit with no parameters and no maxlength attribute (bug 36310)',
+ description: 'Plain text input. Calling byteLimit with no parameters and no maxlength attribute (T38310)',
$input: $( '<input>' ).attr( 'type', 'text' )
.byteLimit(),
sample: simpleSample,
$input: $( '<input>' ).attr( 'type', 'text' )
.byteLimit( 12 ),
sample: mbSample,
- expected: '1234567890' + '12'
+ expected: '123456789012'
} );
byteLimitTest( {
byteLimitTest( {
description: 'Input filter that increases the length',
$input: $( '<input>' ).attr( 'type', 'text' )
- .byteLimit( 10, function ( text ) {
- return 'prefix' + text;
- } ),
+ .byteLimit( 10, function ( text ) {
+ return 'prefix' + text;
+ } ),
sample: simpleSample,
// Prefix adds 6 characters, limit is reached after 4
expected: '1234'
} );
- // Regression tests for bug 41450
+ // Regression tests for T43450
byteLimitTest( {
description: 'Input filter of which the base exceeds the limit',
$input: $( '<input>' ).attr( 'type', 'text' )
- .byteLimit( 3, function ( text ) {
- return 'prefix' + text;
- } ),
+ .byteLimit( 3, function ( text ) {
+ return 'prefix' + text;
+ } ),
sample: simpleSample,
hasLimit: true,
limit: 6, // 'prefix' length
expected: ''
} );
- QUnit.test( 'Confirm properties and attributes set', 4, function ( assert ) {
- var $el, $elA, $elB;
+ QUnit.test( 'Confirm properties and attributes set', function ( assert ) {
+ 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' );
$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
- // the limit it reached (bug 40850)
+ // 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' )
.byteLimit( 3 )