-module( 'mediawiki.cldr' );
-
-test( '-- Initial check', function() {
- expect( 1 );
- ok( mw.cldr, 'mw.cldr defined' );
-} );
+QUnit.module( 'mediawiki.cldr', QUnit.newMwEnvironment() );
var pluralTestcases = {
/*
* Sample:
- *"languagecode" : [
- * [ number, [ "form1", "form2", ... ], "expected", "description" ],
- * ]
+ * "languagecode" : [
+ * [ number, [ "form1", "form2", ... ], "expected", "description" ]
+ * ];
*/
"en": [
[ 0, [ "one", "other" ], "other", "English plural test- 0 is other" ],
[ 1, [ "one", "other" ], "one", "English plural test- 1 is one" ]
],
+ "fa": [
+ [ 0, [ "one", "other" ], "other", "Persian plural test- 0 is other" ],
+ [ 1, [ "one", "other" ], "one", "Persian plural test- 1 is one" ],
+ [ 2, [ "one", "other" ], "other", "Persian plural test- 2 is other" ]
+ ],
+ "fr": [
+ [ 0, [ "one", "other" ], "other", "French plural test- 0 is other" ],
+ [ 1, [ "one", "other" ], "one", "French plural test- 1 is one" ]
+ ],
"hi": [
[ 0, [ "one", "other" ], "one", "Hindi plural test- 0 is one" ],
[ 1, [ "one", "other" ], "one", "Hindi plural test- 1 is one" ],
[ 2, [ "one", "other" ], "other", "Hebrew plural test- 2 is other with 2 forms" ],
[ 2, [ "one", "dual", "other" ], "dual", "Hebrew plural test- 2 is dual with 3 forms" ]
],
+ "hu": [
+ [ 0, [ "one", "other" ], "other", "Hungarian plural test- 0 is other" ],
+ [ 1, [ "one", "other" ], "one", "Hungarian plural test- 1 is one" ],
+ [ 2, [ "one", "other" ], "other", "Hungarian plural test- 2 is other" ]
+ ],
"ar": [
[ 0, [ "zero", "one", "two", "few", "many", "other" ], "zero", "Arabic plural test - 0 is zero" ],
[ 1, [ "zero", "one", "two", "few", "many", "other" ], "one", "Arabic plural test - 1 is one" ],
};
function pluralTest( langCode, tests ) {
- QUnit.test('-- Plural Test for ' + langCode, function( assert ) {
- QUnit.expect( tests.length );
+ QUnit.test( 'Plural Test for ' + langCode, tests.length, function ( assert ) {
for ( var i = 0; i < tests.length; i++ ) {
assert.equal(
mw.language.convertPlural( tests[i][0], tests[i][1] ),
- tests[i][2], // Expected plural form
- tests[i][3] // Description
+ tests[i][2],
+ tests[i][3]
);
}
} );
}
-$.each( pluralTestcases, function( langCode, tests ) {
+$.each( pluralTestcases, function ( langCode, tests ) {
if ( langCode === mw.config.get( 'wgUserLanguage' ) ) {
pluralTest( langCode, tests );
}