3 QUnit
.module( 'mediawiki.language', QUnit
.newMwEnvironment( {
5 this.liveLangData
= mw
.language
.data
.values
;
6 mw
.language
.data
.values
= $.extend( true, {}, this.liveLangData
);
8 teardown: function () {
9 mw
.language
.data
.values
= this.liveLangData
;
13 QUnit
.test( 'mw.language getData and setData', 2, function ( assert
) {
14 mw
.language
.setData( 'en', 'testkey', 'testvalue' );
15 assert
.equal( mw
.language
.getData( 'en', 'testkey' ), 'testvalue', 'Getter setter test for mw.language' );
16 assert
.equal( mw
.language
.getData( 'en', 'invalidkey' ), undefined, 'Getter setter test for mw.language with invalid key' );
19 function grammarTest( langCode
, test
) {
20 // The test works only if the content language is opt.language
21 // because it requires [lang].js to be loaded.
22 QUnit
.test( 'Grammar test for lang=' + langCode
, function ( assert
) {
23 QUnit
.expect( test
.length
);
25 for ( var i
= 0; i
< test
.length
; i
++ ) {
27 mw
.language
.convertGrammar( test
[i
].word
, test
[i
].grammarForm
),
39 grammarForm
: 'instrumental',
41 description
: 'Grammar test for instrumental case'
45 grammarForm
: 'lokativ',
47 description
: 'Grammar test for lokativ case'
54 grammarForm
: 'prefixed',
55 expected
: 'וויקיפדיה',
56 description
: 'Duplicate the "Waw" if prefixed'
60 grammarForm
: 'prefixed',
62 description
: 'Duplicate the "Waw" if prefixed, but not if it is already duplicated.'
66 grammarForm
: 'prefixed',
68 description
: 'Remove the "He" if prefixed'
72 grammarForm
: 'תחילית',
73 expected
: '־Wikipedia',
74 description
: 'GAdd a hyphen (maqaf) before non-Hebrew letters'
78 grammarForm
: 'תחילית',
80 description
: 'Add a hyphen (maqaf) before numbers'
87 grammarForm
: 'instrumental',
89 description
: 'Grammar test for instrumental case'
93 grammarForm
: 'lokatiw',
95 description
: 'Grammar test for lokatiw case'
102 grammarForm
: 'instrumental',
104 description
: 'Grammar test for instrumental case'
108 grammarForm
: 'lokatiw',
110 description
: 'Grammar test for lokatiw case'
117 grammarForm
: 'genitive',
118 expected
: 'Մաունայի',
119 description
: 'Grammar test for genitive case'
123 grammarForm
: 'genitive',
125 description
: 'Grammar test for genitive case'
129 grammarForm
: 'genitive',
131 description
: 'Grammar test for genitive case'
135 grammarForm
: 'genitive',
136 expected
: 'ժամանակիի',
137 description
: 'Grammar test for genitive case'
144 grammarForm
: 'genitive',
146 description
: 'Grammar test for genitive case'
150 grammarForm
: 'genitive',
152 description
: 'Grammar test for genitive case'
156 grammarForm
: 'elative',
158 description
: 'Grammar test for elative case'
162 grammarForm
: 'partitive',
163 expected
: 'pastöroitua',
164 description
: 'Grammar test for partitive case'
168 grammarForm
: 'partitive',
170 description
: 'Grammar test for partitive case'
174 grammarForm
: 'illative',
176 description
: 'Grammar test for illative case'
180 grammarForm
: 'inessive',
181 expected
: 'linuxissa',
182 description
: 'Grammar test for inessive case'
189 grammarForm
: 'genitive',
191 description
: 'Grammar test for genitive case'
195 grammarForm
: 'genitive',
196 expected
: 'привилегии',
197 description
: 'Grammar test for genitive case'
201 grammarForm
: 'genitive',
202 expected
: 'установки',
203 description
: 'Grammar test for genitive case'
207 grammarForm
: 'genitive',
209 description
: 'Grammar test for genitive case'
213 grammarForm
: 'genitive',
215 description
: 'Grammar test for genitive case'
219 grammarForm
: 'genitive',
220 expected
: 'песчаника',
221 description
: 'Grammar test for genitive case'
230 expected
: 'Wikipédiáról',
231 description
: 'Grammar test for rol case'
236 expected
: 'Wikipédiába',
237 description
: 'Grammar test for ba case'
242 expected
: 'Wikipédiák',
243 description
: 'Grammar test for k case'
250 grammarForm
: 'ainmlae',
251 expected
: 'Dé Domhnaigh',
252 description
: 'Grammar test for ainmlae case'
256 grammarForm
: 'ainmlae',
257 expected
: 'Dé Luain',
258 description
: 'Grammar test for ainmlae case'
262 grammarForm
: 'ainmlae',
263 expected
: 'Dé Sathairn',
264 description
: 'Grammar test for ainmlae case'
271 grammarForm
: 'genitive',
273 description
: 'Grammar test for genitive case'
277 grammarForm
: 'genitive',
278 expected
: 'Вікіпедії',
279 description
: 'Grammar test for genitive case'
283 grammarForm
: 'genitive',
284 expected
: 'установки',
285 description
: 'Grammar test for genitive case'
289 grammarForm
: 'genitive',
291 description
: 'Grammar test for genitive case'
295 grammarForm
: 'genitive',
297 description
: 'Grammar test for genitive case'
301 grammarForm
: 'genitive',
302 expected
: 'песчаника',
303 description
: 'Grammar test for genitive case'
307 grammarForm
: 'accusative',
308 expected
: 'Вікіпедію',
309 description
: 'Grammar test for accusative case'
316 grammarForm
: 'orodnik',
318 description
: 'Grammar test for orodnik case'
322 grammarForm
: 'mestnik',
324 description
: 'Grammar test for mestnik case'
331 grammarForm
: 'genitive',
333 description
: 'Grammar test for genitive case'
337 grammarForm
: 'allative',
339 description
: 'Grammar test for allative case'
343 grammarForm
: 'dative',
345 description
: 'Grammar test for dative case'
349 grammarForm
: 'dative',
350 expected
: 'цъитийæн',
351 description
: 'Grammar test for dative case'
355 grammarForm
: 'genitive',
357 description
: 'Grammar test for genitive case'
361 grammarForm
: 'equative',
363 description
: 'Grammar test for equative case'
370 grammarForm
: 'genitive',
371 expected
: 'Translationis',
372 description
: 'Grammar test for genitive case'
376 grammarForm
: 'accusative',
377 expected
: 'Translationem',
378 description
: 'Grammar test for accusative case'
382 grammarForm
: 'ablative',
383 expected
: 'Translatione',
384 description
: 'Grammar test for ablative case'
389 $.each( grammarTests
, function ( langCode
, test
) {
390 if ( langCode
=== mw
.config
.get( 'wgUserLanguage' ) ) {
391 grammarTest( langCode
, test
);
394 }( mediaWiki
, jQuery
) );