Return target of redirect languages in mw.uls.getFrequentLanguageList
When mw.uls.getFrequentLanguageList() is requested sometimes the language that is a redirect returned causing other codebases (like Wikibase) to show an invalid language to the user. Bug: T217770 Change-Id: I49c802d584081aa5992dd0ba76144059bcac56c8
This commit is contained in:
committed by
jenkins-bot
parent
cc4c09ed67
commit
76551ed4a7
@@ -90,4 +90,34 @@
|
||||
'Tagalog is one of the languages presented to users in the Philippines.'
|
||||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'Add redirect target', function ( assert ) {
|
||||
var i, foundTagalog, languages, foundFil;
|
||||
|
||||
foundTagalog = false;
|
||||
foundFil = false;
|
||||
mw.uls.getBrowserLanguage = function () {
|
||||
return 'fil';
|
||||
};
|
||||
|
||||
languages = mw.uls.getFrequentLanguageList();
|
||||
|
||||
for ( i = 0; i < languages.length; i++ ) {
|
||||
if ( languages[ i ] === 'tl' ) {
|
||||
foundTagalog = true;
|
||||
}
|
||||
|
||||
if ( languages[ i ] === 'fil' ) {
|
||||
foundFil = true;
|
||||
}
|
||||
}
|
||||
assert.ok(
|
||||
foundTagalog,
|
||||
'Tagalog is one of the languages presented to users when "fil" language is requested'
|
||||
);
|
||||
assert.notOk(
|
||||
foundFil,
|
||||
'"fil" language is redirected to Tagalog'
|
||||
);
|
||||
} );
|
||||
}() );
|
||||
|
||||
Reference in New Issue
Block a user