2 /* eslint-disable camelcase */
3 var repeat = function ( input, multiplier ) {
4 return new Array( multiplier + 1 ).join( input );
6 // See also TitleTest.php#testSecureAndSplit
19 'File_talk:Example.svg',
24 // Length is 256 total, but only title part matters
25 'Category:' + repeat( 'x', 248 ),
33 // Bad characters forbidden regardless of wgLegalTitleChars
47 // XML/HTML character entity references
48 // Note: The ones with # are commented out as those are interpreted as fragment and
49 // as such end up being valid.
53 // Subject of NS_TALK does not roundtrip to NS_MAIN
54 'Talk:File:Example.svg',
55 // Directory navigation
69 // Extension separation is a js invention, for length
70 // purposes it is part of the title
71 repeat( 'x', 252 ) + '.json',
72 // Namespace prefix without actual title
79 QUnit.module( 'mediawiki.Title', QUnit.newMwEnvironment( {
80 // mw.Title relies on these three config vars
81 // Restore them after each test run
83 wgFormattedNamespaces: {
102 // testing custom / localized namespace
128 // Testing custom namespaces and aliases
130 antarctic_waterfowl: 100
132 wgCaseSensitiveNamespaces: []
136 QUnit.test( 'constructor', function ( assert ) {
138 for ( i = 0; i < cases.valid.length; i++ ) {
139 title = new mw.Title( cases.valid[ i ] );
141 for ( i = 0; i < cases.invalid.length; i++ ) {
142 title = cases.invalid[ i ];
143 // eslint-disable-next-line no-loop-func
144 assert.throws( function () {
145 return new mw.Title( title );
146 }, cases.invalid[ i ] );
150 QUnit.test( 'newFromText', function ( assert ) {
152 for ( i = 0; i < cases.valid.length; i++ ) {
154 $.type( mw.Title.newFromText( cases.valid[ i ] ) ),
159 for ( i = 0; i < cases.invalid.length; i++ ) {
161 $.type( mw.Title.newFromText( cases.invalid[ i ] ) ),
168 QUnit.test( 'makeTitle', function ( assert ) {
169 var cases, i, title, expected,
175 [ NS_TEMPLATE, 'Foo', 'Template:Foo' ],
176 [ NS_TEMPLATE, 'Category:Foo', 'Template:Category:Foo' ],
177 [ NS_TEMPLATE, 'Template:Foo', 'Template:Template:Foo' ],
178 [ NS_TALK, 'Help:Foo', null ],
179 [ NS_TEMPLATE, '<', null ],
180 [ NS_MAIN, 'Help:Foo', 'Help:Foo' ]
183 for ( i = 0; i < cases.length; i++ ) {
184 title = mw.Title.makeTitle( cases[ i ][ 0 ], cases[ i ][ 1 ] );
185 expected = cases[ i ][ 2 ];
186 if ( expected === null ) {
187 assert.strictEqual( title, expected );
189 assert.strictEqual( title.getPrefixedText(), expected );
194 QUnit.test( 'Basic parsing', function ( assert ) {
196 title = new mw.Title( 'File:Foo_bar.JPG' );
198 assert.equal( title.getNamespaceId(), 6 );
199 assert.equal( title.getNamespacePrefix(), 'File:' );
200 assert.equal( title.getName(), 'Foo_bar' );
201 assert.equal( title.getNameText(), 'Foo bar' );
202 assert.equal( title.getExtension(), 'JPG' );
203 assert.equal( title.getDotExtension(), '.JPG' );
204 assert.equal( title.getMain(), 'Foo_bar.JPG' );
205 assert.equal( title.getMainText(), 'Foo bar.JPG' );
206 assert.equal( title.getPrefixedDb(), 'File:Foo_bar.JPG' );
207 assert.equal( title.getPrefixedText(), 'File:Foo bar.JPG' );
209 title = new mw.Title( 'Foo#bar' );
210 assert.equal( title.getPrefixedText(), 'Foo' );
211 assert.equal( title.getFragment(), 'bar' );
213 title = new mw.Title( '.foo' );
214 assert.equal( title.getPrefixedText(), '.foo' );
215 assert.equal( title.getName(), '' );
216 assert.equal( title.getNameText(), '' );
217 assert.equal( title.getExtension(), 'foo' );
218 assert.equal( title.getDotExtension(), '.foo' );
219 assert.equal( title.getMain(), '.foo' );
220 assert.equal( title.getMainText(), '.foo' );
221 assert.equal( title.getPrefixedDb(), '.foo' );
222 assert.equal( title.getPrefixedText(), '.foo' );
225 QUnit.test( 'Transformation', function ( assert ) {
228 title = new mw.Title( 'File:quux pif.jpg' );
229 assert.equal( title.getNameText(), 'Quux pif', 'First character of title' );
231 title = new mw.Title( 'File:Glarg_foo_glang.jpg' );
232 assert.equal( title.getNameText(), 'Glarg foo glang', 'Underscores' );
234 title = new mw.Title( 'User:ABC.DEF' );
235 assert.equal( title.toText(), 'User:ABC.DEF', 'Round trip text' );
236 assert.equal( title.getNamespaceId(), 2, 'Parse canonical namespace prefix' );
238 title = new mw.Title( 'Image:quux pix.jpg' );
239 assert.equal( title.getNamespacePrefix(), 'File:', 'Transform alias to canonical namespace' );
241 title = new mw.Title( 'uSEr:hAshAr' );
242 assert.equal( title.toText(), 'User:HAshAr' );
243 assert.equal( title.getNamespaceId(), 2, 'Case-insensitive namespace prefix' );
245 title = new mw.Title( 'Foo \u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000 bar' );
246 assert.equal( title.getMain(), 'Foo_bar', 'Merge multiple types of whitespace/underscores into a single underscore' );
248 title = new mw.Title( 'Foo\u200E\u200F\u202A\u202B\u202C\u202D\u202Ebar' );
249 assert.equal( title.getMain(), 'Foobar', 'Strip Unicode bidi override characters' );
251 // Regression test: Previously it would only detect an extension if there is no space after it
252 title = new mw.Title( 'Example.js ' );
253 assert.equal( title.getExtension(), 'js', 'Space after an extension is stripped' );
255 title = new mw.Title( 'Example#foo' );
256 assert.equal( title.getFragment(), 'foo', 'Fragment' );
258 title = new mw.Title( 'Example#_foo_bar baz_' );
259 assert.equal( title.getFragment(), ' foo bar baz', 'Fragment' );
262 QUnit.test( 'Namespace detection and conversion', function ( assert ) {
265 title = new mw.Title( 'File:User:Example' );
266 assert.equal( title.getNamespaceId(), 6, 'Titles can contain namespace prefixes, which are otherwise ignored' );
268 title = new mw.Title( 'Example', 6 );
269 assert.equal( title.getNamespaceId(), 6, 'Default namespace passed is used' );
271 title = new mw.Title( 'User:Example', 6 );
272 assert.equal( title.getNamespaceId(), 2, 'Included namespace prefix overrides the given default' );
274 title = new mw.Title( ':Example', 6 );
275 assert.equal( title.getNamespaceId(), 0, 'Colon forces main namespace' );
277 title = new mw.Title( 'something.PDF', 6 );
278 assert.equal( title.toString(), 'File:Something.PDF' );
280 title = new mw.Title( 'NeilK', 3 );
281 assert.equal( title.toString(), 'User_talk:NeilK' );
282 assert.equal( title.toText(), 'User talk:NeilK' );
284 title = new mw.Title( 'Frobisher', 100 );
285 assert.equal( title.toString(), 'Penguins:Frobisher' );
287 title = new mw.Title( 'antarctic_waterfowl:flightless_yet_cute.jpg' );
288 assert.equal( title.toString(), 'Penguins:Flightless_yet_cute.jpg' );
290 title = new mw.Title( 'Penguins:flightless_yet_cute.jpg' );
291 assert.equal( title.toString(), 'Penguins:Flightless_yet_cute.jpg' );
294 QUnit.test( 'Throw error on invalid title', function ( assert ) {
295 assert.throws( function () {
296 return new mw.Title( '' );
297 }, 'Throw error on empty string' );
300 QUnit.test( 'Case-sensivity', function ( assert ) {
304 mw.config.set( 'wgCaseSensitiveNamespaces', [] );
306 title = new mw.Title( 'article' );
307 assert.equal( title.toString(), 'Article', 'Default config: No sensitive namespaces by default. First-letter becomes uppercase' );
309 title = new mw.Title( 'ß' );
310 assert.equal( title.toString(), 'ß', 'Uppercasing matches PHP behaviour (ß -> ß, not SS)' );
312 title = new mw.Title( 'dž (digraph)' );
313 assert.equal( title.toString(), 'Dž_(digraph)', 'Uppercasing matches PHP behaviour (dž -> Dž, not DŽ)' );
315 // $wgCapitalLinks = false;
316 mw.config.set( 'wgCaseSensitiveNamespaces', [ 0, -2, 1, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15 ] );
318 title = new mw.Title( 'article' );
319 assert.equal( title.toString(), 'article', '$wgCapitalLinks=false: Article namespace is sensitive, first-letter case stays lowercase' );
321 title = new mw.Title( 'john', 2 );
322 assert.equal( title.toString(), 'User:John', '$wgCapitalLinks=false: User namespace is insensitive, first-letter becomes uppercase' );
325 QUnit.test( 'toString / toText', function ( assert ) {
326 var title = new mw.Title( 'Some random page' );
328 assert.equal( title.toString(), title.getPrefixedDb() );
329 assert.equal( title.toText(), title.getPrefixedText() );
332 QUnit.test( 'getExtension', function ( assert ) {
333 function extTest( pagename, ext, description ) {
334 var title = new mw.Title( pagename );
335 assert.equal( title.getExtension(), ext, description || pagename );
338 extTest( 'MediaWiki:Vector.js', 'js' );
339 extTest( 'User:Example/common.css', 'css' );
340 extTest( 'File:Example.longextension', 'longextension', 'Extension parsing not limited (T38151)' );
341 extTest( 'Example/information.json', 'json', 'Extension parsing not restricted from any namespace' );
342 extTest( 'Foo.', null, 'Trailing dot is not an extension' );
343 extTest( 'Foo..', null, 'Trailing dots are not an extension' );
344 extTest( 'Foo.a.', null, 'Page name with dots and ending in a dot does not have an extension' );
346 // @broken: Throws an exception
347 // extTest( '.NET', null, 'Leading dot is (or is not?) an extension' );
350 QUnit.test( 'exists', function ( assert ) {
353 // Empty registry, checks default to null
355 title = new mw.Title( 'Some random page', 4 );
356 assert.strictEqual( title.exists(), null, 'Return null with empty existance registry' );
358 // Basic registry, checks default to boolean
359 mw.Title.exist.set( [ 'Does_exist', 'User_talk:NeilK', 'Wikipedia:Sandbox_rules' ], true );
360 mw.Title.exist.set( [ 'Does_not_exist', 'User:John', 'Foobar' ], false );
362 title = new mw.Title( 'Project:Sandbox rules' );
363 assert.assertTrue( title.exists(), 'Return true for page titles marked as existing' );
364 title = new mw.Title( 'Foobar' );
365 assert.assertFalse( title.exists(), 'Return false for page titles marked as nonexistent' );
369 QUnit.test( 'getUrl', function ( assert ) {
372 wgScript: '/w/index.php',
373 wgArticlePath: '/wiki/$1'
376 title = new mw.Title( 'Foobar' );
377 assert.equal( title.getUrl(), '/wiki/Foobar', 'Basic functionality, getUrl uses mw.util.getUrl' );
378 assert.equal( title.getUrl( { action: 'edit' } ), '/w/index.php?title=Foobar&action=edit', 'Basic functionality, \'params\' parameter' );
380 title = new mw.Title( 'John Doe', 3 );
381 assert.equal( title.getUrl(), '/wiki/User_talk:John_Doe', 'Escaping in title and namespace for urls' );
383 title = new mw.Title( 'John Cena#And_His_Name_Is', 3 );
384 assert.equal( title.getUrl( { meme: true } ), '/w/index.php?title=User_talk:John_Cena&meme=true#And_His_Name_Is', 'title with fragment and query parameter' );
387 QUnit.test( 'newFromImg', function ( assert ) {
388 var title, i, thisCase, prefix,
391 url: '//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Princess_Alexandra_of_Denmark_%28later_Queen_Alexandra%2C_wife_of_Edward_VII%29_with_her_two_eldest_sons%2C_Prince_Albert_Victor_%28Eddy%29_and_George_Frederick_Ernest_Albert_%28later_George_V%29.jpg/939px-thumbnail.jpg',
392 typeOfUrl: 'Hashed thumb with shortened path',
393 nameText: 'Princess Alexandra of Denmark (later Queen Alexandra, wife of Edward VII) with her two eldest sons, Prince Albert Victor (Eddy) and George Frederick Ernest Albert (later George V)',
394 prefixedText: 'File:Princess Alexandra of Denmark (later Queen Alexandra, wife of Edward VII) with her two eldest sons, Prince Albert Victor (Eddy) and George Frederick Ernest Albert (later George V).jpg'
398 url: '//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Princess_Alexandra_of_Denmark_%28later_Queen_Alexandra%2C_wife_of_Edward_VII%29_with_her_two_eldest_sons%2C_Prince_Albert_Victor_%28Eddy%29_and_George_Frederick_Ernest_Albert_%28later_George_V%29.jpg/939px-ki708pr1r6g2dl5lbhvwdqxenhait13.jpg',
399 typeOfUrl: 'Hashed thumb with sha1-ed path',
400 nameText: 'Princess Alexandra of Denmark (later Queen Alexandra, wife of Edward VII) with her two eldest sons, Prince Albert Victor (Eddy) and George Frederick Ernest Albert (later George V)',
401 prefixedText: 'File:Princess Alexandra of Denmark (later Queen Alexandra, wife of Edward VII) with her two eldest sons, Prince Albert Victor (Eddy) and George Frederick Ernest Albert (later George V).jpg'
405 url: '/wiki/images/thumb/9/91/Anticlockwise_heliotrope%27s.jpg/99px-Anticlockwise_heliotrope%27s.jpg',
406 typeOfUrl: 'Normal hashed directory thumbnail',
407 nameText: 'Anticlockwise heliotrope\'s',
408 prefixedText: 'File:Anticlockwise heliotrope\'s.jpg'
412 url: '/wiki/images/thumb/8/80/Wikipedia-logo-v2.svg/langde-150px-Wikipedia-logo-v2.svg.png',
413 typeOfUrl: 'Normal hashed directory thumbnail with complex thumbnail parameters',
414 nameText: 'Wikipedia-logo-v2',
415 prefixedText: 'File:Wikipedia-logo-v2.svg'
419 url: '//upload.wikimedia.org/wikipedia/commons/thumb/8/80/Wikipedia-logo-v2.svg/150px-Wikipedia-logo-v2.svg.png',
420 typeOfUrl: 'Commons thumbnail',
421 nameText: 'Wikipedia-logo-v2',
422 prefixedText: 'File:Wikipedia-logo-v2.svg'
426 url: '/wiki/images/9/91/Anticlockwise_heliotrope%27s.jpg',
427 typeOfUrl: 'Full image',
428 nameText: 'Anticlockwise heliotrope\'s',
429 prefixedText: 'File:Anticlockwise heliotrope\'s.jpg'
433 url: 'http://localhost/thumb.php?f=Stuffless_Figaro%27s.jpg&width=180',
434 typeOfUrl: 'thumb.php-based thumbnail',
435 nameText: 'Stuffless Figaro\'s',
436 prefixedText: 'File:Stuffless Figaro\'s.jpg'
440 url: '/wikipedia/commons/thumb/Wikipedia-logo-v2.svg/150px-Wikipedia-logo-v2.svg.png',
441 typeOfUrl: 'Commons unhashed thumbnail',
442 nameText: 'Wikipedia-logo-v2',
443 prefixedText: 'File:Wikipedia-logo-v2.svg'
447 url: '/wikipedia/commons/thumb/Wikipedia-logo-v2.svg/langde-150px-Wikipedia-logo-v2.svg.png',
448 typeOfUrl: 'Commons unhashed thumbnail with complex thumbnail parameters',
449 nameText: 'Wikipedia-logo-v2',
450 prefixedText: 'File:Wikipedia-logo-v2.svg'
454 url: '/wiki/images/Anticlockwise_heliotrope%27s.jpg',
455 typeOfUrl: 'Unhashed local file',
456 nameText: 'Anticlockwise heliotrope\'s',
457 prefixedText: 'File:Anticlockwise heliotrope\'s.jpg'
462 typeOfUrl: 'Empty string'
467 typeOfUrl: 'String with only alphabet characters'
471 url: 'foobar.foobar',
472 typeOfUrl: 'Not a file path'
476 url: '/a/a0/blah blah blah',
477 typeOfUrl: 'Space characters'
481 for ( i = 0; i < cases.length; i++ ) {
482 thisCase = cases[ i ];
483 title = mw.Title.newFromImg( { src: thisCase.url } );
485 if ( thisCase.nameText !== undefined ) {
486 prefix = '[' + thisCase.typeOfUrl + ' URL] ';
488 assert.notStrictEqual( title, null, prefix + 'Parses successfully' );
489 assert.equal( title.getNameText(), thisCase.nameText, prefix + 'Filename matches original' );
490 assert.equal( title.getPrefixedText(), thisCase.prefixedText, prefix + 'File page title matches original' );
491 assert.equal( title.getNamespaceId(), 6, prefix + 'Namespace ID matches File namespace' );
493 assert.strictEqual( title, null, thisCase.typeOfUrl + ', should not produce an mw.Title object' );
498 QUnit.test( 'getRelativeText', function ( assert ) {
499 var i, thisCase, title,
504 expectedResult: ':Asd'
509 expectedResult: 'Dfg'
512 text: 'Template:Ghj',
514 expectedResult: 'Template:Ghj'
524 expectedResult: 'User:Hi'
528 for ( i = 0; i < cases.length; i++ ) {
529 thisCase = cases[ i ];
531 title = mw.Title.newFromText( thisCase.text );
532 assert.equal( title.getRelativeText( thisCase.relativeTo ), thisCase.expectedResult );
536 QUnit.test( 'normalizeExtension', function ( assert ) {
537 var extension, i, thisCase, prefix,
542 description: 'Extension already in canonical form'
547 description: 'Extension lowercased in canonical form'
552 description: 'Extension changed in canonical form'
557 description: 'Extension lowercased and changed in canonical form'
562 description: 'Extension invalid and discarded'
566 for ( i = 0; i < cases.length; i++ ) {
567 thisCase = cases[ i ];
568 extension = mw.Title.normalizeExtension( thisCase.extension );
570 prefix = '[' + thisCase.description + '] ';
571 assert.equal( extension, thisCase.expected, prefix + 'Extension as expected' );
575 QUnit.test( 'newFromUserInput', function ( assert ) {
576 var title, i, thisCase, prefix,
579 title: 'DCS0001557854455.JPG',
580 expected: 'DCS0001557854455.JPG',
581 description: 'Title in normal namespace without anything invalid but with "file extension"'
584 title: 'MediaWiki:Msg-awesome',
585 expected: 'MediaWiki:Msg-awesome',
586 description: 'Full title (page in MediaWiki namespace) supplied as string'
589 title: 'The/Mw/Sound.flac',
590 defaultNamespace: -2,
591 expected: 'Media:The-Mw-Sound.flac',
592 description: 'Page in Media-namespace without explicit options'
595 title: 'File:The/Mw/Sound.kml',
600 expected: 'File:The/Mw/Sound.kml',
601 description: 'Page in File-namespace without explicit options'
604 title: 'File:Foo.JPEG',
605 expected: 'File:Foo.JPEG',
606 description: 'Page in File-namespace with non-canonical extension'
609 title: 'File:Foo.JPEG ',
610 expected: 'File:Foo.JPEG',
611 description: 'Page in File-namespace with trailing whitespace'
615 for ( i = 0; i < cases.length; i++ ) {
616 thisCase = cases[ i ];
617 title = mw.Title.newFromUserInput( thisCase.title, thisCase.defaultNamespace, thisCase.options );
619 if ( thisCase.expected !== undefined ) {
620 prefix = '[' + thisCase.description + '] ';
622 assert.notStrictEqual( title, null, prefix + 'Parses successfully' );
623 assert.equal( title.toText(), thisCase.expected, prefix + 'Title as expected' );
625 assert.strictEqual( title, null, thisCase.description + ', should not produce an mw.Title object' );
630 QUnit.test( 'newFromFileName', function ( assert ) {
631 var title, i, thisCase, prefix,
634 fileName: 'DCS0001557854455.JPG',
635 typeOfName: 'Standard camera output',
636 nameText: 'DCS0001557854455',
637 prefixedText: 'File:DCS0001557854455.JPG'
640 fileName: 'File:Sample.png',
641 typeOfName: 'Carrying namespace',
642 nameText: 'File-Sample',
643 prefixedText: 'File:File-Sample.png'
646 fileName: 'Treppe 2222 Test upload.jpg',
647 typeOfName: 'File name with spaces in it and lower case file extension',
648 nameText: 'Treppe 2222 Test upload',
649 prefixedText: 'File:Treppe 2222 Test upload.jpg'
652 fileName: 'I contain a \ttab.jpg',
653 typeOfName: 'Name containing a tab character',
654 nameText: 'I contain a tab',
655 prefixedText: 'File:I contain a tab.jpg'
658 fileName: 'I_contain multiple__ ___ _underscores.jpg',
659 typeOfName: 'Name containing multiple underscores',
660 nameText: 'I contain multiple underscores',
661 prefixedText: 'File:I contain multiple underscores.jpg'
664 fileName: 'I like ~~~~~~~~es.jpg',
665 typeOfName: 'Name containing more than three consecutive tilde characters',
666 nameText: 'I like ~~es',
667 prefixedText: 'File:I like ~~es.jpg'
670 fileName: 'BI\u200EDI.jpg',
671 typeOfName: 'Name containing BIDI overrides',
673 prefixedText: 'File:BIDI.jpg'
676 fileName: '100%ab progress.jpg',
677 typeOfName: 'File name with URL encoding',
678 nameText: '100% ab progress',
679 prefixedText: 'File:100% ab progress.jpg'
682 fileName: '<([>]):/#.jpg',
683 typeOfName: 'File name with characters not permitted in titles that are replaced',
684 nameText: '((()))---',
685 prefixedText: 'File:((()))---.jpg'
688 fileName: 'spaces\u0009\u2000\u200A\u200Bx.djvu',
689 typeOfName: 'File name with different kind of spaces',
690 nameText: 'Spaces \u200Bx',
691 prefixedText: 'File:Spaces \u200Bx.djvu'
694 fileName: 'dot.dot.dot.dot.dotdot',
695 typeOfName: 'File name with a lot of dots',
696 nameText: 'Dot.dot.dot.dot',
697 prefixedText: 'File:Dot.dot.dot.dot.dotdot'
700 fileName: 'dot. dot ._dot',
701 typeOfName: 'File name with multiple dots and spaces',
702 nameText: 'Dot. dot',
703 prefixedText: 'File:Dot. dot. dot'
706 fileName: '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢𠻗𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵𢫕𢭃𢯊𢱑𢱕𢳂𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵𢫕𢭃𢯊𢱑𢱕𢳂.png',
707 typeOfName: 'File name longer than 240 bytes',
708 nameText: '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢𠻗𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵𢫕𢭃𢯊𢱑𢱕𢳂𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵',
709 prefixedText: 'File:𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢𠻗𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵𢫕𢭃𢯊𢱑𢱕𢳂𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵.png'
713 typeOfName: 'Empty string'
717 typeOfName: 'String with only alphabet characters'
721 for ( i = 0; i < cases.length; i++ ) {
722 thisCase = cases[ i ];
723 title = mw.Title.newFromFileName( thisCase.fileName );
725 if ( thisCase.nameText !== undefined ) {
726 prefix = '[' + thisCase.typeOfName + '] ';
728 assert.notStrictEqual( title, null, prefix + 'Parses successfully' );
729 assert.equal( title.getNameText(), thisCase.nameText, prefix + 'Filename matches original' );
730 assert.equal( title.getPrefixedText(), thisCase.prefixedText, prefix + 'File page title matches original' );
731 assert.equal( title.getNamespaceId(), 6, prefix + 'Namespace ID matches File namespace' );
733 assert.strictEqual( title, null, thisCase.typeOfName + ', should not produce an mw.Title object' );
738 }( mediaWiki, jQuery ) );