Merge "Update QUnit test for modern standards"

This commit is contained in:
jenkins-bot
2017-02-22 14:04:14 +00:00
committed by Gerrit Code Review

View File

@@ -23,14 +23,10 @@
QUnit.module( 'ext.uls', QUnit.newMwEnvironment() ); QUnit.module( 'ext.uls', QUnit.newMwEnvironment() );
QUnit.test( 'Initial check', function ( assert ) { QUnit.test( 'Initial check', function ( assert ) {
QUnit.expect( 1 );
assert.ok( $.fn.uls, '$.fn.uls is defined' ); assert.ok( $.fn.uls, '$.fn.uls is defined' );
} ); } );
QUnit.test( 'Custom langdb', function ( assert ) { QUnit.test( 'Custom langdb', function ( assert ) {
QUnit.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.
@@ -38,9 +34,7 @@
} ); } );
QUnit.test( 'User preferences', function ( assert ) { QUnit.test( 'User preferences', function ( assert ) {
var prefName, prefs, prefsToSave, readPrefs; var prefName, prefs, prefsToSave, readPrefs, done;
QUnit.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
@@ -64,25 +58,18 @@
'Correct value for the font name' 'Correct value for the font name'
); );
QUnit.stop(); done = assert.async();
prefs.save( function ( successSave ) { prefs.save( function ( successSave ) {
QUnit.start();
assert.ok( successSave, 'Options saving API did not produce an error.' ); assert.ok( successSave, 'Options saving API did not produce an error.' );
// Delete old options // Delete old options
prefs.set( prefName, undefined ); prefs.set( prefName, undefined );
QUnit.stop(); prefs.save( done );
prefs.save( function () {
QUnit.start();
} );
} ); } );
} ); } );
QUnit.test( 'Common languages', function ( assert ) { QUnit.test( 'Common languages', function ( assert ) {
var i, foundTagalog, languagesInPH; var i, foundTagalog, languagesInPH;
QUnit.expect( 1 );
// Bug 49847 // Bug 49847
foundTagalog = false; foundTagalog = false;
languagesInPH = mw.uls.getFrequentLanguageList( 'PH' ); languagesInPH = mw.uls.getFrequentLanguageList( 'PH' );