Merge "(bug 40257) action=info no longer shows subpages where disabled"
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki / mediawiki.cldr.test.js
1 QUnit.module( 'mediawiki.cldr', QUnit.newMwEnvironment() );
2
3 var pluralTestcases = {
4 /*
5 * Sample:
6 * "languagecode" : [
7 * [ number, [ "form1", "form2", ... ], "expected", "description" ]
8 * ];
9 */
10 "en": [
11 [ 0, [ "one", "other" ], "other", "English plural test- 0 is other" ],
12 [ 1, [ "one", "other" ], "one", "English plural test- 1 is one" ]
13 ],
14 "fa": [
15 [ 0, [ "one", "other" ], "other", "Persian plural test- 0 is other" ],
16 [ 1, [ "one", "other" ], "one", "Persian plural test- 1 is one" ],
17 [ 2, [ "one", "other" ], "other", "Persian plural test- 2 is other" ]
18 ],
19 "fr": [
20 [ 0, [ "one", "other" ], "other", "French plural test- 0 is other" ],
21 [ 1, [ "one", "other" ], "one", "French plural test- 1 is one" ]
22 ],
23 "hi": [
24 [ 0, [ "one", "other" ], "one", "Hindi plural test- 0 is one" ],
25 [ 1, [ "one", "other" ], "one", "Hindi plural test- 1 is one" ],
26 [ 2, [ "one", "other" ], "other", "Hindi plural test- 2 is other" ]
27 ],
28 "he": [
29 [ 0, [ "one", "other" ], "other", "Hebrew plural test- 0 is other" ],
30 [ 1, [ "one", "other" ], "one", "Hebrew plural test- 1 is one" ],
31 [ 2, [ "one", "other" ], "other", "Hebrew plural test- 2 is other with 2 forms" ],
32 [ 2, [ "one", "dual", "other" ], "dual", "Hebrew plural test- 2 is dual with 3 forms" ]
33 ],
34 "hu": [
35 [ 0, [ "one", "other" ], "other", "Hungarian plural test- 0 is other" ],
36 [ 1, [ "one", "other" ], "one", "Hungarian plural test- 1 is one" ],
37 [ 2, [ "one", "other" ], "other", "Hungarian plural test- 2 is other" ]
38 ],
39 "ar": [
40 [ 0, [ "zero", "one", "two", "few", "many", "other" ], "zero", "Arabic plural test - 0 is zero" ],
41 [ 1, [ "zero", "one", "two", "few", "many", "other" ], "one", "Arabic plural test - 1 is one" ],
42 [ 2, [ "zero", "one", "two", "few", "many", "other" ], "two", "Arabic plural test - 2 is two" ],
43 [ 3, [ "zero", "one", "two", "few", "many", "other" ], "few", "Arabic plural test - 3 is few" ],
44 [ 9, [ "zero", "one", "two", "few", "many", "other" ], "few", "Arabic plural test - 9 is few" ],
45 [ "9", [ "zero", "one", "two", "few", "many", "other" ], "few", "Arabic plural test - 9 is few" ],
46 [ 110, [ "zero", "one", "two", "few", "many", "other" ], "few", "Arabic plural test - 110 is few" ],
47 [ 11, [ "zero", "one", "two", "few", "many", "other" ], "many", "Arabic plural test - 11 is many" ],
48 [ 15, [ "zero", "one", "two", "few", "many", "other" ], "many", "Arabic plural test - 15 is many" ],
49 [ 99, [ "zero", "one", "two", "few", "many", "other" ], "many", "Arabic plural test - 99 is many" ],
50 [ 9999, [ "zero", "one", "two", "few", "many", "other" ], "many", "Arabic plural test - 9999 is many" ],
51 [ 100, [ "zero", "one", "two", "few", "many", "other" ], "other", "Arabic plural test - 100 is other" ],
52 [ 102, [ "zero", "one", "two", "few", "many", "other" ], "other", "Arabic plural test - 102 is other" ],
53 [ 1000, [ "zero", "one", "two", "few", "many", "other" ], "other", "Arabic plural test - 1000 is other" ]
54 // FIXME plural rules for decimal numbers does not work
55 // [ 1.7, [ "zero", "one", "two", "few", "many", "other" ], "other", "Arabic plural test - 1.7 is other" ],
56 ]
57 };
58
59 function pluralTest( langCode, tests ) {
60 QUnit.test( 'Plural Test for ' + langCode, tests.length, function ( assert ) {
61 for ( var i = 0; i < tests.length; i++ ) {
62 assert.equal(
63 mw.language.convertPlural( tests[i][0], tests[i][1] ),
64 tests[i][2],
65 tests[i][3]
66 );
67 }
68 } );
69 }
70
71 $.each( pluralTestcases, function ( langCode, tests ) {
72 if ( langCode === mw.config.get( 'wgUserLanguage' ) ) {
73 pluralTest( langCode, tests );
74 }
75 } );