Better way to fix jslint warnings

Change-Id: Id56aa9c742bdd5dd7cec5848d1b44a4dafaca9c0
This commit is contained in:
Niklas Laxström
2013-05-20 10:56:11 +00:00
committed by Santhosh Thottingal
parent 22ef3d9852
commit 142bdbd7c7
2 changed files with 11 additions and 25 deletions

View File

@@ -35,15 +35,6 @@
"predef": [
"mediaWiki",
"jQuery",
/* Qunit specific rules */
"QUnit",
"module",
"expect",
"start",
"stop",
"ok",
"test",
"strictEqual"
"QUnit"
]
}

View File

@@ -20,25 +20,20 @@
( function ( $, mw ) {
'use strict';
module( 'ext.uls', QUnit.newMwEnvironment() );
QUnit.module( 'ext.uls', QUnit.newMwEnvironment() );
test( '-- Initial check', function () {
expect( 1 );
ok( $.fn.uls, '$.fn.uls is defined' );
QUnit.test( '-- Initial check', 1, function ( assert ) {
assert.ok( $.fn.uls, '$.fn.uls is defined' );
} );
test( '-- Custom langdb', function () {
expect( 1 );
QUnit.test( '-- Custom langdb', 1, function ( assert ) {
// This is a custom non-standard language code used in MW.
// If it's not defined, then, for example,
// its direction cannot be acquired using the langdb utils.
strictEqual( $.uls.data.getDir( 'als' ), 'ltr', 'The direction of custom MW language als is ltr.' );
assert.strictEqual( $.uls.data.getDir( 'als' ), 'ltr', 'The direction of custom MW language als is ltr.' );
} );
test( '-- User preferences', function () {
expect( 2 );
QUnit.asyncTest( '-- User preferences', 2, function ( assert ) {
// 'gofanim' means "fonts" in Hebrew.
// Here it's used as a meaningless word, to test
// the preferences without changing anything useful.
@@ -55,14 +50,14 @@
};
prefs.set( prefName, prefsToSave );
stop();
QUnit.stop();
prefs.save( function ( successSave ) {
start();
ok( successSave, 'Options saving API did not produce an error.' );
QUnit.start();
assert.ok( successSave, 'Options saving API did not produce an error.' );
} );
readPrefs = prefs.get( prefName );
strictEqual( readPrefs[prefName].fonts.qqy, 'Megafont', 'Correct value for the font name' );
assert.strictEqual( readPrefs[prefName].fonts.qqy, 'Megafont', 'Correct value for the font name' );
// Delete old options
prefs.set( prefName, undefined );