From: Timo Tijhof Date: Wed, 22 Feb 2017 18:10:54 +0000 (-0800) Subject: qunit: Minor clean up in various tests X-Git-Tag: 1.31.0-rc.0~4014^2 X-Git-Url: http://git.cyclocoop.org/%22%20%20.%20generer_url_ecrire%28%22mots_tous%22%29%20.%20%22?a=commitdiff_plain;h=9046d17a7f7a9f6d07c9eded2abdb3ae1891d1f9;p=lhc%2Fweb%2Fwiklou.git qunit: Minor clean up in various tests Follows-up 5e602c613. * jquery.byteLimit: Remove redundant setTimeout(). * jquery.byteLimit: Remove unused $elA, $elB variables. * jquery.hidpi: Actually call bracketedDevicePixelRatio(). Change-Id: I288af22e081385fca6268a87e7b6fe1b27116706 --- diff --git a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js index 804d1ca96c..c7b7cc0d62 100644 --- a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js @@ -46,21 +46,17 @@ 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' + ); } ); } @@ -186,7 +182,7 @@ } ); QUnit.test( 'Confirm properties and attributes set', function ( assert ) { - var $el, $elA, $elB; + var $el; $el = $( '' ).attr( 'type', 'text' ) .attr( 'maxlength', '7' ) @@ -211,12 +207,12 @@ assert.strictEqual( $el.attr( 'maxlength' ), undefined, 'maxlength attribute removed for limit with callback' ); - $elA = $( '' ).attr( 'type', 'text' ) + $( '' ).attr( 'type', 'text' ) .addClass( 'mw-test-byteLimit-foo' ) .attr( 'maxlength', '7' ) .appendTo( '#qunit-fixture' ); - $elB = $( '' ).attr( 'type', 'text' ) + $( '' ).attr( 'type', 'text' ) .addClass( 'mw-test-byteLimit-foo' ) .attr( 'maxlength', '12' ) .appendTo( '#qunit-fixture' ); @@ -231,7 +227,7 @@ QUnit.test( 'Trim from insertion when limit exceeded', function ( assert ) { var $el; - // Use a new because the bug only occurs on the first time + // Use a new because the bug only occurs on the first time // the limit it reached (T42850) $el = $( '' ).attr( 'type', 'text' ) .appendTo( '#qunit-fixture' ) diff --git a/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js b/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js index 2f9e960f59..6a265eb591 100644 --- a/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js @@ -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 ) {