diff options
Diffstat (limited to 'tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js')
-rw-r--r-- | tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js index 24005b64..2baa4f37 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js @@ -1,24 +1,24 @@ /* Some misc JavaScript compatibility tests, just to make sure the environments we run in are consistent */ -module( 'mediawiki.jscompat', QUnit.newMwEnvironment() ); +QUnit.module( 'mediawiki.jscompat', QUnit.newMwEnvironment() ); -test( 'Variable with Unicode letter in name', function() { - expect(3); +QUnit.test( 'Variable with Unicode letter in name', 3, function ( assert ) { var orig = "some token"; var ŝablono = orig; - deepEqual( ŝablono, orig, 'ŝablono' ); - deepEqual( \u015dablono, orig, '\\u015dablono' ); - deepEqual( \u015Dablono, orig, '\\u015Dablono' ); + + assert.deepEqual( ŝablono, orig, 'ŝablono' ); + assert.deepEqual( \u015dablono, orig, '\\u015dablono' ); + assert.deepEqual( \u015Dablono, orig, '\\u015Dablono' ); }); /* // Not that we need this. ;) // This fails on IE 6-8 // Works on IE 9, Firefox 6, Chrome 14 -test( 'Keyword workaround: "if" as variable name using Unicode escapes', function() { +QUnit.test( 'Keyword workaround: "if" as variable name using Unicode escapes', function ( assert ) { var orig = "another token"; \u0069\u0066 = orig; - deepEqual( \u0069\u0066, orig, '\\u0069\\u0066' ); + assert.deepEqual( \u0069\u0066, orig, '\\u0069\\u0066' ); }); */ @@ -26,37 +26,37 @@ test( 'Keyword workaround: "if" as variable name using Unicode escapes', functio // Not that we need this. ;) // This fails on IE 6-9 // Works on Firefox 6, Chrome 14 -test( 'Keyword workaround: "if" as member variable name using Unicode escapes', function() { +QUnit.test( 'Keyword workaround: "if" as member variable name using Unicode escapes', function ( assert ) { var orig = "another token"; var foo = {}; foo.\u0069\u0066 = orig; - deepEqual( foo.\u0069\u0066, orig, 'foo.\\u0069\\u0066' ); + assert.deepEqual( foo.\u0069\u0066, orig, 'foo.\\u0069\\u0066' ); }); */ -test( 'Stripping of single initial newline from textarea\'s literal contents (bug 12130)', function() { +QUnit.test( 'Stripping of single initial newline from textarea\'s literal contents (bug 12130)', function ( assert ) { var maxn = 4; - expect(maxn * 2); + QUnit.expect( maxn * 2 ); - var repeat = function(str, n) { - if (n <= 0) { + function repeat( str, n ) { + if ( n <= 0 ) { return ''; } else { - var out = Array(n); - for (var i = 0; i < n; i++) { + var out = new Array(n); + for ( var i = 0; i < n; i++ ) { out[i] = str; } return out.join(''); } - }; + } - for (var n = 0; n < maxn; n++) { + for ( var n = 0; n < maxn; n++ ) { var expected = repeat('\n', n) + 'some text'; var $textarea = $('<textarea>\n' + expected + '</textarea>'); - equal($textarea.val(), expected, 'Expecting ' + n + ' newlines (HTML contained ' + (n + 1) + ')'); + assert.equal( $textarea.val(), expected, 'Expecting ' + n + ' newlines (HTML contained ' + (n + 1) + ')' ); var $textarea2 = $('<textarea>').val(expected); - equal($textarea2.val(), expected, 'Expecting ' + n + ' newlines (from DOM set with ' + n + ')'); + assert.equal( $textarea2.val(), expected, 'Expecting ' + n + ' newlines (from DOM set with ' + n + ')' ); } }); |