Prevent appearance of redirects in the rendered list
utils.getLanguagesByScriptGroup() runs on the object's languages property and not on all the langdb languages. This caused the redirects to be counted as languages. I fixed this, and added a test to prevent it. Also update JS langdb, because it went out of sync in of the previous commits.
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
assert.ok( $.fn.uls, "$.fn.uls is defined" );
|
||||
} );
|
||||
|
||||
test( "-- $.uls.data testing", 45, function ( assert ) {
|
||||
test( "-- $.uls.data testing", 46, function ( assert ) {
|
||||
// Add a language in run time.
|
||||
// This is done early to make sure that it doesn't break other functions.
|
||||
$.uls.data.addLanguage( 'qqq', {
|
||||
@@ -198,6 +198,24 @@
|
||||
assert.strictEqual( $.uls.data.getAutonym( 'pa' ), 'ਪੰਜਾਬੀ', 'Correct autonym of the Punjabi language was selected using code pa.' );
|
||||
assert.strictEqual( $.uls.data.getAutonym( 'pa-guru' ), 'ਪੰਜਾਬੀ', 'Correct autonym of the Punjabi language was selected using code pa-guru.' );
|
||||
|
||||
var languagesToGroup = {
|
||||
'en': 'English',
|
||||
'fiu-vro': 'Võro', // Alias before target
|
||||
'ru': 'русский',
|
||||
'sr': 'српски', // Alias before target
|
||||
'sr-cyrl': 'српски', // Target before alias
|
||||
'sr-latn': 'srpski', // Target before alias
|
||||
'sr-el': 'srpski', // Alias after target
|
||||
'vro': 'Võro' // Target after alias
|
||||
},
|
||||
groupedLanguages = {
|
||||
Latin: [ 'en', 'vro', 'sr-latn' ],
|
||||
Cyrillic: [ 'ru', 'sr-cyrl' ]
|
||||
};
|
||||
|
||||
assert.deepEqual( $.uls.data.getLanguagesByScriptGroup( languagesToGroup ), groupedLanguages,
|
||||
'A custom list of languages is grouped correctly using getLanguagesByScriptGroup.' );
|
||||
|
||||
var languagesByScriptGroupInEMEA = $.uls.data.getLanguagesByScriptGroupInRegions( $.uls.data.getRegionsInGroup( 3 ) );
|
||||
assert.deepEqual( languagesByScriptGroupInEMEA['WestCaucasian'], [
|
||||
'hy', 'ka', 'xmf'
|
||||
|
||||
Reference in New Issue
Block a user