diff options
Diffstat (limited to 'MLEB/UniversalLanguageSelector/tests/qunit/ext.uls.tests.js')
-rw-r--r-- | MLEB/UniversalLanguageSelector/tests/qunit/ext.uls.tests.js | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/MLEB/UniversalLanguageSelector/tests/qunit/ext.uls.tests.js b/MLEB/UniversalLanguageSelector/tests/qunit/ext.uls.tests.js index db968513..4d7e428c 100644 --- a/MLEB/UniversalLanguageSelector/tests/qunit/ext.uls.tests.js +++ b/MLEB/UniversalLanguageSelector/tests/qunit/ext.uls.tests.js @@ -1,4 +1,4 @@ -/** +/*! * QUnit tests for ULS. * * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, @@ -17,20 +17,16 @@ * @licence MIT License */ -( function ( $, mw ) { +( function () { 'use strict'; QUnit.module( 'ext.uls', QUnit.newMwEnvironment() ); QUnit.test( 'Initial check', function ( assert ) { - QUnit.expect( 1 ); - assert.ok( $.fn.uls, '$.fn.uls is defined' ); } ); QUnit.test( 'Custom langdb', function ( assert ) { - QUnit.expect( 1 ); - // 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. @@ -38,17 +34,16 @@ } ); QUnit.test( 'User preferences', function ( assert ) { - QUnit.expect( 2 ); + var prefName, prefs, prefsToSave, readPrefs, done; // 'gofanim' means "fonts" in Hebrew. // Here it's used as a meaningless word, to test // the preferences without changing anything useful. - var prefName = 'gofanim', - prefs = mw.uls.preferences(), - prefsToSave = {}, - readPrefs; + prefName = 'gofanim'; + prefs = mw.uls.preferences(); + prefsToSave = {}; - prefsToSave[prefName] = { + prefsToSave[ prefName ] = { fonts: { qqy: 'Megafont' } @@ -58,21 +53,18 @@ readPrefs = prefs.get( prefName ); assert.strictEqual( - readPrefs[prefName].fonts.qqy, + readPrefs[ prefName ].fonts.qqy, 'Megafont', 'Correct value for the font name' ); - QUnit.stop(); + done = assert.async(); prefs.save( function ( successSave ) { - QUnit.start(); assert.ok( successSave, 'Options saving API did not produce an error.' ); - // Delete old options prefs.set( prefName, undefined ); - QUnit.stop(); prefs.save( function () { - QUnit.start(); + done(); } ); } ); } ); @@ -80,15 +72,13 @@ QUnit.test( 'Common languages', function ( assert ) { var i, foundTagalog, languagesInPH; - QUnit.expect( 1 ); - // Bug 49847 foundTagalog = false; languagesInPH = mw.uls.getFrequentLanguageList( 'PH' ); for ( i = 0; i < languagesInPH.length; i++ ) { - if ( $.uls.data.isRedirect( languagesInPH[i] ) === 'tl' || - languagesInPH[i] === 'tl' + if ( $.uls.data.isRedirect( languagesInPH[ i ] ) === 'tl' || + languagesInPH[ i ] === 'tl' ) { foundTagalog = true; @@ -100,4 +90,4 @@ 'Tagalog is one of the languages presented to users in the Philippines.' ); } ); -}( jQuery, mediaWiki ) ); +}() ); |