From 12f88660764a873e65bcc069ad52f1cbbbc5ff3d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 20 Feb 2013 20:25:15 +0100 Subject: [PATCH] Tests: Add missing expect numbers in QUnit tests. Various tests were failing due to missing or incorrect numbers. Follows-up Iedb304f8 Change-Id: I665b8c4c1501ea058ecdc8e846f8b4efa4eded29 --- .../resources/jquery/jquery.hidpi.test.js | 4 ++-- .../jquery/jquery.mwExtension.test.js | 20 +++++++++---------- .../mediawiki/mediawiki.jqueryMsg.test.js | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js b/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js index 140da384d9..906369eec0 100644 --- a/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js @@ -1,12 +1,12 @@ ( function ( $ ) { QUnit.module( 'jquery.hidpi', QUnit.newMwEnvironment() ); - QUnit.test( 'devicePixelRatio', function ( assert ) { + QUnit.test( 'devicePixelRatio', 1, function ( assert ) { var devicePixelRatio = $.devicePixelRatio(); assert.equal( typeof devicePixelRatio, 'number', '$.devicePixelRatio() returns a number' ); } ); - QUnit.test( 'matchSrcSet', function ( assert ) { + QUnit.test( 'matchSrcSet', 6, function ( assert ) { var srcset = 'onefive.png 1.5x, two.png 2x'; // Nice exact matches diff --git a/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js b/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js index 2765498743..5fae065560 100644 --- a/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js @@ -1,7 +1,7 @@ ( function ( $ ) { QUnit.module( 'jquery.mwExtension', QUnit.newMwEnvironment() ); - QUnit.test( 'String functions', function ( assert ) { + QUnit.test( 'String functions', 7, function ( assert ) { assert.equal( $.trimLeft( ' foo bar ' ), 'foo bar ', 'trimLeft' ); assert.equal( $.trimRight( ' foo bar ' ), ' foo bar', 'trimRight' ); assert.equal( $.ucFirst( 'foo' ), 'Foo', 'ucFirst' ); @@ -15,7 +15,7 @@ assert.equal( $.escapeRE( '0123456789' ), '0123456789', 'escapeRE - Leave numbers alone' ); } ); - QUnit.test( 'Is functions', function ( assert ) { + QUnit.test( 'Is functions', 15, function ( assert ) { assert.strictEqual( $.isDomElement( document.getElementById( 'qunit-header' ) ), true, 'isDomElement: #qunit-header Node' ); assert.strictEqual( $.isDomElement( document.getElementById( 'random-name' ) ), false, @@ -33,18 +33,18 @@ assert.strictEqual( $.isDomElement( { foo: 1 } ), false, 'isDomElement: Object' ); - assert.strictEqual( $.isEmpty( 'string' ), false, 'isEmptry: "string"' ); - assert.strictEqual( $.isEmpty( '0' ), true, 'isEmptry: "0"' ); - assert.strictEqual( $.isEmpty( '' ), true, 'isEmptry: ""' ); - assert.strictEqual( $.isEmpty( 1 ), false, 'isEmptry: 1' ); - assert.strictEqual( $.isEmpty( [] ), true, 'isEmptry: []' ); - assert.strictEqual( $.isEmpty( {} ), true, 'isEmptry: {}' ); + assert.strictEqual( $.isEmpty( 'string' ), false, 'isEmpty: "string"' ); + assert.strictEqual( $.isEmpty( '0' ), true, 'isEmpty: "0"' ); + assert.strictEqual( $.isEmpty( '' ), true, 'isEmpty: ""' ); + assert.strictEqual( $.isEmpty( 1 ), false, 'isEmpty: 1' ); + assert.strictEqual( $.isEmpty( [] ), true, 'isEmpty: []' ); + assert.strictEqual( $.isEmpty( {} ), true, 'isEmpty: {}' ); // Documented behaviour - assert.strictEqual( $.isEmpty( { length: 0 } ), true, 'isEmptry: { length: 0 }' ); + assert.strictEqual( $.isEmpty( { length: 0 } ), true, 'isEmpty: { length: 0 }' ); } ); - QUnit.test( 'Comparison functions', function ( assert ) { + QUnit.test( 'Comparison functions', 5, function ( assert ) { assert.ok( $.compareArray( [0, 'a', [], [2, 'b'] ], [0, 'a', [], [2, 'b'] ] ), 'compareArray: Two deep arrays that are excactly the same' ); assert.ok( !$.compareArray( [1], [2] ), 'compareArray: Two different arrays (false)' ); diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js index c61365e271..95a16c89e1 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js @@ -81,7 +81,7 @@ } ); } - QUnit.test( 'Replace', 9, function ( assert ) { + QUnit.test( 'Replace', 7, function ( assert ) { var parser = mw.jqueryMsg.getMessageFunction(); mw.messages.set( 'simple', 'Foo $1 baz $2' ); -- 2.20.1