Tests: Add missing expect numbers in QUnit tests.
authorTimo Tijhof <ttijhof@wikimedia.org>
Wed, 20 Feb 2013 19:25:15 +0000 (20:25 +0100)
committerTimo Tijhof <ttijhof@wikimedia.org>
Wed, 20 Feb 2013 19:25:15 +0000 (20:25 +0100)
Various tests were failing due to missing or incorrect numbers.

Follows-up Iedb304f8

Change-Id: I665b8c4c1501ea058ecdc8e846f8b4efa4eded29

tests/qunit/suites/resources/jquery/jquery.hidpi.test.js
tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js

index 140da38..906369e 100644 (file)
@@ -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
index 2765498..5fae065 100644 (file)
@@ -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,
                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)' );
index c61365e..95a16c8 100644 (file)
@@ -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' );