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": [ "predef": [
"mediaWiki", "mediaWiki",
"jQuery", "jQuery",
"QUnit"
/* Qunit specific rules */
"QUnit",
"module",
"expect",
"start",
"stop",
"ok",
"test",
"strictEqual"
] ]
} }

View File

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