Adding utility functions for the ULS langdb

* More functions for making useful queries to the langdb.
* Tests.

Change-Id: I29a3a25ef1b15d5925df2aa3d06f9221f8e5231e
This commit is contained in:
Amir E. Aharoni
2012-06-26 22:55:32 +03:00
parent 03df48a609
commit 43d7604203
3 changed files with 127 additions and 3 deletions

View File

@@ -31,10 +31,34 @@ test( "-- Initial check", function() {
} );
test( "-- $.uls.data testing", function() {
expect( 1 );
expect( 8 );
// Unless we actually want some scripts to be in the 'Other' group.
strictEqual( orphanScript(), '', 'No orphan scripts found.' );
deepEqual( $.uls.data.languagesInRegion( 'AU' ), ["en", "en-gb", "hif", "hif-latn", "mi", "na"], "languages of region AU are selected correctly" );
deepEqual( $.uls.data.languagesInRegions( ['NA', 'WW'] ),
[
"avk", "cho", "chr", "chy", "cr", "en", "en-ca", "eo", "es",
"haw", "ht", "ia", "ie", "ik", "ike-cans", "ike-latn", "io",
"iu", "jam", "jbo", "kl", "lfn", "mus", "nah", "nov", "nv",
"pdc", "pdt", "rue", "sei", "simple", "srn", "tokipona",
"uk", "vo", "yi"
],
"languages of regions NA and WW are selected correctly"
);
deepEqual( $.uls.data.languagesInScript( 'Knda' ), ["kn", "tcy"], "languages in script Knda are selected correctly" );
deepEqual( $.uls.data.languagesInScripts( ['Geor', 'Armn'] ),
["hy", "ka", "xmf"],
"languages in scripts Geor and Armn are selected correctly"
);
deepEqual( $.uls.data.regionsInGroup( 1 ), ["NA", "LA", "SA"], "regions in group 1 are selected correctly" );
deepEqual( $.uls.data.regionsInGroup( 4 ), ["WW"], "regions in group 4 are selected correctly" );
languagesByScriptInNA = $.uls.data.languagesByScriptInRegion( 'NA' );
deepEqual( languagesByScriptInNA['Cans'], ["cr", "ike-cans", "iu"], "correct languages in Cans in NA selected" );
} );
}());
}() );