Merge "Preferences tests"
This commit is contained in:
@@ -35,4 +35,37 @@
|
|||||||
// 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.' );
|
strictEqual( $.uls.data.getDir( 'als' ), 'ltr', 'The direction of custom MW language als is ltr.' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
test( '-- User preferences', function () {
|
||||||
|
expect( 2 );
|
||||||
|
|
||||||
|
// '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;
|
||||||
|
|
||||||
|
prefsToSave[prefName] = {
|
||||||
|
'fonts': {
|
||||||
|
'qqy': 'Megafont'
|
||||||
|
},
|
||||||
|
'webfonts-enabled': true
|
||||||
|
};
|
||||||
|
|
||||||
|
prefs.set( prefName, prefsToSave );
|
||||||
|
stop();
|
||||||
|
prefs.save( function ( successSave ) {
|
||||||
|
start();
|
||||||
|
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' );
|
||||||
|
|
||||||
|
// Delete old options
|
||||||
|
prefs.set( prefName, undefined );
|
||||||
|
prefs.save();
|
||||||
|
} );
|
||||||
}( jQuery ) );
|
}( jQuery ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user