4 QUnit
.module( 'mediawiki.language', QUnit
.newMwEnvironment( {
6 this.liveLangData
= mw
.language
.data
.values
;
7 mw
.language
.data
.values
= $.extend( true, {}, this.liveLangData
);
9 teardown: function () {
10 mw
.language
.data
.values
= this.liveLangData
;
14 QUnit
.test( 'mw.language getData and setData', 2, function ( assert
) {
15 mw
.language
.setData( 'en', 'testkey', 'testvalue' );
16 assert
.equal( mw
.language
.getData( 'en', 'testkey' ), 'testvalue', 'Getter setter test for mw.language' );
17 assert
.equal( mw
.language
.getData( 'en', 'invalidkey' ), undefined, 'Getter setter test for mw.language with invalid key' );
20 function grammarTest( langCode
, test
) {
21 // The test works only if the content language is opt.language
22 // because it requires [lang].js to be loaded.
23 QUnit
.test( 'Grammar test for lang=' + langCode
, function ( assert
) {
24 QUnit
.expect( test
.length
);
26 for ( var i
= 0; i
< test
.length
; i
++ ) {
28 mw
.language
.convertGrammar( test
[i
].word
, test
[i
].grammarForm
),
36 // These tests run only for the current UI language.
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, песчаник -> песчаника'
227 grammarForm
: 'genitive',
229 description
: 'Grammar test for genitive case, данные -> данных'
233 grammarForm
: 'prepositional',
235 description
: 'Grammar test for prepositional case, тесть -> тесте'
239 grammarForm
: 'prepositional',
240 expected
: 'привилегии',
241 description
: 'Grammar test for prepositional case, привилегия -> привилегии'
245 grammarForm
: 'prepositional',
246 expected
: 'установке',
247 description
: 'Grammar test for prepositional case, установка -> установке'
251 grammarForm
: 'prepositional',
253 description
: 'Grammar test for prepositional case, похоти -> похотях'
257 grammarForm
: 'prepositional',
259 description
: 'Grammar test for prepositional case, доводы -> доводах'
263 grammarForm
: 'prepositional',
264 expected
: 'песчанике',
265 description
: 'Grammar test for prepositional case, песчаник -> песчанике'
269 grammarForm
: 'prepositional',
271 description
: 'Grammar test for prepositional case, данные -> данных'
279 expected
: 'Wikipédiáról',
280 description
: 'Grammar test for rol case'
285 expected
: 'Wikipédiába',
286 description
: 'Grammar test for ba case'
291 expected
: 'Wikipédiák',
292 description
: 'Grammar test for k case'
299 grammarForm
: 'ainmlae',
300 expected
: 'Dé Domhnaigh',
301 description
: 'Grammar test for ainmlae case'
305 grammarForm
: 'ainmlae',
306 expected
: 'Dé Luain',
307 description
: 'Grammar test for ainmlae case'
311 grammarForm
: 'ainmlae',
312 expected
: 'Dé Sathairn',
313 description
: 'Grammar test for ainmlae case'
320 grammarForm
: 'genitive',
322 description
: 'Grammar test for genitive case'
326 grammarForm
: 'genitive',
327 expected
: 'Вікіпедії',
328 description
: 'Grammar test for genitive case'
332 grammarForm
: 'genitive',
333 expected
: 'установки',
334 description
: 'Grammar test for genitive case'
338 grammarForm
: 'genitive',
340 description
: 'Grammar test for genitive case'
344 grammarForm
: 'genitive',
346 description
: 'Grammar test for genitive case'
350 grammarForm
: 'genitive',
351 expected
: 'песчаника',
352 description
: 'Grammar test for genitive case'
356 grammarForm
: 'accusative',
357 expected
: 'Вікіпедію',
358 description
: 'Grammar test for accusative case'
365 grammarForm
: 'orodnik',
367 description
: 'Grammar test for orodnik case'
371 grammarForm
: 'mestnik',
373 description
: 'Grammar test for mestnik case'
380 grammarForm
: 'genitive',
382 description
: 'Grammar test for genitive case'
386 grammarForm
: 'allative',
388 description
: 'Grammar test for allative case'
392 grammarForm
: 'dative',
394 description
: 'Grammar test for dative case'
398 grammarForm
: 'dative',
399 expected
: 'цъитийæн',
400 description
: 'Grammar test for dative case'
404 grammarForm
: 'genitive',
406 description
: 'Grammar test for genitive case'
410 grammarForm
: 'equative',
412 description
: 'Grammar test for equative case'
419 grammarForm
: 'genitive',
420 expected
: 'Translationis',
421 description
: 'Grammar test for genitive case'
425 grammarForm
: 'accusative',
426 expected
: 'Translationem',
427 description
: 'Grammar test for accusative case'
431 grammarForm
: 'ablative',
432 expected
: 'Translatione',
433 description
: 'Grammar test for ablative case'
438 $.each( grammarTests
, function ( langCode
, test
) {
439 if ( langCode
=== mw
.config
.get( 'wgUserLanguage' ) ) {
440 grammarTest( langCode
, test
);
443 }( mediaWiki
, jQuery
) );