1 var liveLangData
= mw
.language
.data
.values
;
2 QUnit
.module( 'mediawiki.language', QUnit
.newMwEnvironment({
4 // New independent copy for this test
5 mw
.language
.data
= $.extend( {}, liveLangData
, true );
7 teardown: function () {
9 mw
.language
.data
= liveLangData
;
13 QUnit
.test( 'mw.language getData and setData', function ( assert
) {
16 mw
.language
.setData( 'en', 'testkey', 'testvalue' );
17 assert
.equal( mw
.language
.getData( 'en', 'testkey' ), 'testvalue', 'Getter setter test for mw.language' );
18 assert
.equal( mw
.language
.getData( 'en', 'invalidkey' ), undefined, 'Getter setter test for mw.language with invalid key' );
21 function grammarTest( langCode
, test
) {
22 // The test works only if the content language is opt.language
23 // because it requires [lang].js to be loaded.
24 QUnit
.test( 'Grammar test for lang=' + langCode
, function ( assert
) {
25 QUnit
.expect( test
.length
);
27 for ( var i
= 0 ; i
< test
.length
; i
++ ) {
29 mw
.language
.convertGrammar( test
[i
].word
, test
[i
].grammarForm
),
41 grammarForm
: 'instrumental',
43 description
: 'Grammar test for instrumental case'
47 grammarForm
: 'lokativ',
49 description
: 'Grammar test for lokativ case'
56 grammarForm
: 'prefixed',
57 expected
: "וויקיפדיה",
58 description
: 'Duplicate the "Waw" if prefixed'
62 grammarForm
: 'prefixed',
64 description
: 'Duplicate the "Waw" if prefixed, but not if it is already duplicated.'
68 grammarForm
: 'prefixed',
70 description
: 'Remove the "He" if prefixed'
74 grammarForm
: 'תחילית',
75 expected
: '־Wikipedia',
76 description
: 'GAdd a hyphen (maqaf) before non-Hebrew letters'
80 grammarForm
: 'תחילית',
82 description
: 'Add a hyphen (maqaf) before numbers'
89 grammarForm
: 'instrumental',
91 description
: 'Grammar test for instrumental case'
95 grammarForm
: 'lokatiw',
97 description
: 'Grammar test for lokatiw case'
104 grammarForm
: 'instrumental',
106 description
: 'Grammar test for instrumental case'
110 grammarForm
: 'lokatiw',
112 description
: 'Grammar test for lokatiw case'
119 grammarForm
: 'genitive',
120 expected
: 'Մաունայի',
121 description
: 'Grammar test for genitive case'
125 grammarForm
: 'genitive',
127 description
: 'Grammar test for genitive case'
131 grammarForm
: 'genitive',
133 description
: 'Grammar test for genitive case'
137 grammarForm
: 'genitive',
138 expected
: 'ժամանակիի',
139 description
: 'Grammar test for genitive case'
146 grammarForm
: 'genitive',
148 description
: 'Grammar test for genitive case'
152 grammarForm
: 'genitive',
154 description
: 'Grammar test for genitive case'
158 grammarForm
: 'elative',
160 description
: 'Grammar test for elative case'
164 grammarForm
: 'partitive',
165 expected
: 'pastöroitua',
166 description
: 'Grammar test for partitive case'
170 grammarForm
: 'partitive',
172 description
: 'Grammar test for partitive case'
176 grammarForm
: 'illative',
178 description
: 'Grammar test for illative case'
182 grammarForm
: 'inessive',
183 expected
: 'linuxissa',
184 description
: 'Grammar test for inessive case'
191 grammarForm
: 'genitive',
193 description
: 'Grammar test for genitive case'
197 grammarForm
: 'genitive',
198 expected
: 'привилегии',
199 description
: 'Grammar test for genitive case'
203 grammarForm
: 'genitive',
204 expected
: 'установки',
205 description
: 'Grammar test for genitive case'
209 grammarForm
: 'genitive',
211 description
: 'Grammar test for genitive case'
215 grammarForm
: 'genitive',
217 description
: 'Grammar test for genitive case'
221 grammarForm
: 'genitive',
222 expected
: 'песчаника',
223 description
: 'Grammar test for genitive case'
232 expected
: 'Wikipédiáról',
233 description
: 'Grammar test for rol case'
238 expected
: 'Wikipédiába',
239 description
: 'Grammar test for ba case'
244 expected
: 'Wikipédiák',
245 description
: 'Grammar test for k case'
252 grammarForm
: 'ainmlae',
253 expected
: 'Dé Domhnaigh',
254 description
: 'Grammar test for ainmlae case'
258 grammarForm
: 'ainmlae',
259 expected
: 'Dé Luain',
260 description
: 'Grammar test for ainmlae case'
264 grammarForm
: 'ainmlae',
265 expected
: 'Dé Sathairn',
266 description
: 'Grammar test for ainmlae case'
273 grammarForm
: 'genitive',
275 description
: 'Grammar test for genitive case'
279 grammarForm
: 'genitive',
280 expected
: 'Вікіпедії',
281 description
: 'Grammar test for genitive case'
285 grammarForm
: 'genitive',
286 expected
: 'установки',
287 description
: 'Grammar test for genitive case'
291 grammarForm
: 'genitive',
293 description
: 'Grammar test for genitive case'
297 grammarForm
: 'genitive',
299 description
: 'Grammar test for genitive case'
303 grammarForm
: 'genitive',
304 expected
: 'песчаника',
305 description
: 'Grammar test for genitive case'
309 grammarForm
: 'accusative',
310 expected
: 'Вікіпедію',
311 description
: 'Grammar test for accusative case'
318 grammarForm
: 'orodnik',
320 description
: 'Grammar test for orodnik case'
324 grammarForm
: 'mestnik',
326 description
: 'Grammar test for mestnik case'
333 grammarForm
: 'genitive',
335 description
: 'Grammar test for genitive case'
339 grammarForm
: 'allative',
341 description
: 'Grammar test for allative case'
345 grammarForm
: 'dative',
347 description
: 'Grammar test for dative case'
351 grammarForm
: 'dative',
352 expected
: 'цъитийæн',
353 description
: 'Grammar test for dative case'
357 grammarForm
: 'genitive',
359 description
: 'Grammar test for genitive case'
363 grammarForm
: 'equative',
365 description
: 'Grammar test for equative case'
372 grammarForm
: 'genitive',
373 expected
: 'Translationis',
374 description
: 'Grammar test for genitive case'
378 grammarForm
: 'accusative',
379 expected
: 'Translationem',
380 description
: 'Grammar test for accusative case'
384 grammarForm
: 'ablative',
385 expected
: 'Translatione',
386 description
: 'Grammar test for ablative case'
391 $.each( grammarTests
, function ( langCode
, test
) {
392 if ( langCode
=== mw
.config
.get( 'wgUserLanguage' ) ) {
393 grammarTest( langCode
, test
);