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
: 'genitive',
270 expected
: 'Викисклада',
271 description
: 'Grammar test for genitive case, Викисклад -> Викисклада'
275 grammarForm
: 'prepositional',
276 expected
: 'песчанике',
277 description
: 'Grammar test for prepositional case, песчаник -> песчанике'
281 grammarForm
: 'prepositional',
283 description
: 'Grammar test for prepositional case, данные -> данных'
291 expected
: 'Wikipédiáról',
292 description
: 'Grammar test for rol case'
297 expected
: 'Wikipédiába',
298 description
: 'Grammar test for ba case'
303 expected
: 'Wikipédiák',
304 description
: 'Grammar test for k case'
311 grammarForm
: 'ainmlae',
312 expected
: 'Dé Domhnaigh',
313 description
: 'Grammar test for ainmlae case'
317 grammarForm
: 'ainmlae',
318 expected
: 'Dé Luain',
319 description
: 'Grammar test for ainmlae case'
323 grammarForm
: 'ainmlae',
324 expected
: 'Dé Sathairn',
325 description
: 'Grammar test for ainmlae case'
332 grammarForm
: 'genitive',
334 description
: 'Grammar test for genitive case'
338 grammarForm
: 'genitive',
339 expected
: 'Вікіпедії',
340 description
: 'Grammar test for genitive case'
344 grammarForm
: 'genitive',
345 expected
: 'установки',
346 description
: 'Grammar test for genitive case'
350 grammarForm
: 'genitive',
352 description
: 'Grammar test for genitive case'
356 grammarForm
: 'genitive',
358 description
: 'Grammar test for genitive case'
362 grammarForm
: 'genitive',
363 expected
: 'песчаника',
364 description
: 'Grammar test for genitive case'
368 grammarForm
: 'accusative',
369 expected
: 'Вікіпедію',
370 description
: 'Grammar test for accusative case'
377 grammarForm
: 'orodnik',
379 description
: 'Grammar test for orodnik case'
383 grammarForm
: 'mestnik',
385 description
: 'Grammar test for mestnik case'
392 grammarForm
: 'genitive',
394 description
: 'Grammar test for genitive case'
398 grammarForm
: 'allative',
400 description
: 'Grammar test for allative case'
404 grammarForm
: 'dative',
406 description
: 'Grammar test for dative case'
410 grammarForm
: 'dative',
411 expected
: 'цъитийæн',
412 description
: 'Grammar test for dative case'
416 grammarForm
: 'genitive',
418 description
: 'Grammar test for genitive case'
422 grammarForm
: 'equative',
424 description
: 'Grammar test for equative case'
431 grammarForm
: 'genitive',
432 expected
: 'Translationis',
433 description
: 'Grammar test for genitive case'
437 grammarForm
: 'accusative',
438 expected
: 'Translationem',
439 description
: 'Grammar test for accusative case'
443 grammarForm
: 'ablative',
444 expected
: 'Translatione',
445 description
: 'Grammar test for ablative case'
450 $.each( grammarTests
, function ( langCode
, test
) {
451 if ( langCode
=== mw
.config
.get( 'wgUserLanguage' ) ) {
452 grammarTest( langCode
, test
);
455 }( mediaWiki
, jQuery
) );