3fa2b0997d6d10ff6d6efaac6b37a8134f2d68f2
1 QUnit
.module( 'mediawiki.language', QUnit
.newMwEnvironment({
3 this.liveLangData
= mw
.language
.data
.values
;
4 mw
.language
.data
.values
= $.extend( true, {}, this.liveLangData
);
6 teardown: function () {
8 mw
.language
.data
.values
= this.liveLangData
;
12 QUnit
.test( 'mw.language getData and setData', 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
),
40 grammarForm
: 'instrumental',
42 description
: 'Grammar test for instrumental case'
46 grammarForm
: 'lokativ',
48 description
: 'Grammar test for lokativ case'
55 grammarForm
: 'prefixed',
56 expected
: "וויקיפדיה",
57 description
: 'Duplicate the "Waw" if prefixed'
61 grammarForm
: 'prefixed',
63 description
: 'Duplicate the "Waw" if prefixed, but not if it is already duplicated.'
67 grammarForm
: 'prefixed',
69 description
: 'Remove the "He" if prefixed'
73 grammarForm
: 'תחילית',
74 expected
: '־Wikipedia',
75 description
: 'GAdd a hyphen (maqaf) before non-Hebrew letters'
79 grammarForm
: 'תחילית',
81 description
: 'Add a hyphen (maqaf) before numbers'
88 grammarForm
: 'instrumental',
90 description
: 'Grammar test for instrumental case'
94 grammarForm
: 'lokatiw',
96 description
: 'Grammar test for lokatiw case'
103 grammarForm
: 'instrumental',
105 description
: 'Grammar test for instrumental case'
109 grammarForm
: 'lokatiw',
111 description
: 'Grammar test for lokatiw case'
118 grammarForm
: 'genitive',
119 expected
: 'Մաունայի',
120 description
: 'Grammar test for genitive case'
124 grammarForm
: 'genitive',
126 description
: 'Grammar test for genitive case'
130 grammarForm
: 'genitive',
132 description
: 'Grammar test for genitive case'
136 grammarForm
: 'genitive',
137 expected
: 'ժամանակիի',
138 description
: 'Grammar test for genitive case'
145 grammarForm
: 'genitive',
147 description
: 'Grammar test for genitive case'
151 grammarForm
: 'genitive',
153 description
: 'Grammar test for genitive case'
157 grammarForm
: 'elative',
159 description
: 'Grammar test for elative case'
163 grammarForm
: 'partitive',
164 expected
: 'pastöroitua',
165 description
: 'Grammar test for partitive case'
169 grammarForm
: 'partitive',
171 description
: 'Grammar test for partitive case'
175 grammarForm
: 'illative',
177 description
: 'Grammar test for illative case'
181 grammarForm
: 'inessive',
182 expected
: 'linuxissa',
183 description
: 'Grammar test for inessive case'
190 grammarForm
: 'genitive',
192 description
: 'Grammar test for genitive case'
196 grammarForm
: 'genitive',
197 expected
: 'привилегии',
198 description
: 'Grammar test for genitive case'
202 grammarForm
: 'genitive',
203 expected
: 'установки',
204 description
: 'Grammar test for genitive case'
208 grammarForm
: 'genitive',
210 description
: 'Grammar test for genitive case'
214 grammarForm
: 'genitive',
216 description
: 'Grammar test for genitive case'
220 grammarForm
: 'genitive',
221 expected
: 'песчаника',
222 description
: 'Grammar test for genitive case'
231 expected
: 'Wikipédiáról',
232 description
: 'Grammar test for rol case'
237 expected
: 'Wikipédiába',
238 description
: 'Grammar test for ba case'
243 expected
: 'Wikipédiák',
244 description
: 'Grammar test for k case'
251 grammarForm
: 'ainmlae',
252 expected
: 'Dé Domhnaigh',
253 description
: 'Grammar test for ainmlae case'
257 grammarForm
: 'ainmlae',
258 expected
: 'Dé Luain',
259 description
: 'Grammar test for ainmlae case'
263 grammarForm
: 'ainmlae',
264 expected
: 'Dé Sathairn',
265 description
: 'Grammar test for ainmlae case'
272 grammarForm
: 'genitive',
274 description
: 'Grammar test for genitive case'
278 grammarForm
: 'genitive',
279 expected
: 'Вікіпедії',
280 description
: 'Grammar test for genitive case'
284 grammarForm
: 'genitive',
285 expected
: 'установки',
286 description
: 'Grammar test for genitive case'
290 grammarForm
: 'genitive',
292 description
: 'Grammar test for genitive case'
296 grammarForm
: 'genitive',
298 description
: 'Grammar test for genitive case'
302 grammarForm
: 'genitive',
303 expected
: 'песчаника',
304 description
: 'Grammar test for genitive case'
308 grammarForm
: 'accusative',
309 expected
: 'Вікіпедію',
310 description
: 'Grammar test for accusative case'
317 grammarForm
: 'orodnik',
319 description
: 'Grammar test for orodnik case'
323 grammarForm
: 'mestnik',
325 description
: 'Grammar test for mestnik case'
332 grammarForm
: 'genitive',
334 description
: 'Grammar test for genitive case'
338 grammarForm
: 'allative',
340 description
: 'Grammar test for allative case'
344 grammarForm
: 'dative',
346 description
: 'Grammar test for dative case'
350 grammarForm
: 'dative',
351 expected
: 'цъитийæн',
352 description
: 'Grammar test for dative case'
356 grammarForm
: 'genitive',
358 description
: 'Grammar test for genitive case'
362 grammarForm
: 'equative',
364 description
: 'Grammar test for equative case'
371 grammarForm
: 'genitive',
372 expected
: 'Translationis',
373 description
: 'Grammar test for genitive case'
377 grammarForm
: 'accusative',
378 expected
: 'Translationem',
379 description
: 'Grammar test for accusative case'
383 grammarForm
: 'ablative',
384 expected
: 'Translatione',
385 description
: 'Grammar test for ablative case'
390 $.each( grammarTests
, function ( langCode
, test
) {
391 if ( langCode
=== mw
.config
.get( 'wgUserLanguage' ) ) {
392 grammarTest( langCode
, test
);