2 var repeat = function ( input
, multiplier
) {
3 return new Array( multiplier
+ 1 ).join( input
);
6 // See also TitleTest.php#testSecureAndSplit
18 'File_talk:Example.svg',
23 // Length is 256 total, but only title part matters
24 'Category:' + repeat( 'x', 248 ),
32 // Bad characters forbidden regardless of wgLegalTitleChars
46 // XML/HTML character entity references
47 // Note: The ones with # are commented out as those are interpreted as fragment and
48 // as such end up being valid.
52 // Subject of NS_TALK does not roundtrip to NS_MAIN
53 'Talk:File:Example.svg',
54 // Directory navigation
68 // Extension separation is a js invention, for length
69 // purposes it is part of the title
70 repeat( 'x', 252 ) + '.json',
71 // Namespace prefix without actual title
78 QUnit
.module( 'mediawiki.Title', QUnit
.newMwEnvironment( {
79 // mw.Title relies on these three config vars
80 // Restore them after each test run
82 wgFormattedNamespaces
: {
101 // testing custom / localized namespace
127 // Testing custom namespaces and aliases
129 antarctic_waterfowl
: 100
131 wgCaseSensitiveNamespaces
: []
135 QUnit
.test( 'constructor', function ( assert
) {
137 for ( i
= 0; i
< cases
.valid
.length
; i
++ ) {
138 title
= new mw
.Title( cases
.valid
[ i
] );
140 for ( i
= 0; i
< cases
.invalid
.length
; i
++ ) {
141 title
= cases
.invalid
[ i
];
142 assert
.throws( function () {
143 return new mw
.Title( title
);
144 }, cases
.invalid
[ i
] );
148 QUnit
.test( 'newFromText', function ( assert
) {
150 for ( i
= 0; i
< cases
.valid
.length
; i
++ ) {
152 $.type( mw
.Title
.newFromText( cases
.valid
[ i
] ) ),
157 for ( i
= 0; i
< cases
.invalid
.length
; i
++ ) {
159 $.type( mw
.Title
.newFromText( cases
.invalid
[ i
] ) ),
166 QUnit
.test( 'makeTitle', function ( assert
) {
167 var cases
, i
, title
, expected
,
173 [ NS_TEMPLATE
, 'Foo', 'Template:Foo' ],
174 [ NS_TEMPLATE
, 'Category:Foo', 'Template:Category:Foo' ],
175 [ NS_TEMPLATE
, 'Template:Foo', 'Template:Template:Foo' ],
176 [ NS_TALK
, 'Help:Foo', null ],
177 [ NS_TEMPLATE
, '<', null ],
178 [ NS_MAIN
, 'Help:Foo', 'Help:Foo' ]
181 for ( i
= 0; i
< cases
.length
; i
++ ) {
182 title
= mw
.Title
.makeTitle( cases
[ i
][ 0 ], cases
[ i
][ 1 ] );
183 expected
= cases
[ i
][ 2 ];
184 if ( expected
=== null ) {
185 assert
.strictEqual( title
, expected
);
187 assert
.strictEqual( title
.getPrefixedText(), expected
);
192 QUnit
.test( 'Basic parsing', function ( assert
) {
194 title
= new mw
.Title( 'File:Foo_bar.JPG' );
196 assert
.equal( title
.getNamespaceId(), 6 );
197 assert
.equal( title
.getNamespacePrefix(), 'File:' );
198 assert
.equal( title
.getName(), 'Foo_bar' );
199 assert
.equal( title
.getNameText(), 'Foo bar' );
200 assert
.equal( title
.getExtension(), 'JPG' );
201 assert
.equal( title
.getDotExtension(), '.JPG' );
202 assert
.equal( title
.getMain(), 'Foo_bar.JPG' );
203 assert
.equal( title
.getMainText(), 'Foo bar.JPG' );
204 assert
.equal( title
.getPrefixedDb(), 'File:Foo_bar.JPG' );
205 assert
.equal( title
.getPrefixedText(), 'File:Foo bar.JPG' );
207 title
= new mw
.Title( 'Foo#bar' );
208 assert
.equal( title
.getPrefixedText(), 'Foo' );
209 assert
.equal( title
.getFragment(), 'bar' );
211 title
= new mw
.Title( '.foo' );
212 assert
.equal( title
.getPrefixedText(), '.foo' );
213 assert
.equal( title
.getName(), '' );
214 assert
.equal( title
.getNameText(), '' );
215 assert
.equal( title
.getExtension(), 'foo' );
216 assert
.equal( title
.getDotExtension(), '.foo' );
217 assert
.equal( title
.getMain(), '.foo' );
218 assert
.equal( title
.getMainText(), '.foo' );
219 assert
.equal( title
.getPrefixedDb(), '.foo' );
220 assert
.equal( title
.getPrefixedText(), '.foo' );
223 QUnit
.test( 'Transformation', function ( assert
) {
226 title
= new mw
.Title( 'File:quux pif.jpg' );
227 assert
.equal( title
.getNameText(), 'Quux pif', 'First character of title' );
229 title
= new mw
.Title( 'File:Glarg_foo_glang.jpg' );
230 assert
.equal( title
.getNameText(), 'Glarg foo glang', 'Underscores' );
232 title
= new mw
.Title( 'User:ABC.DEF' );
233 assert
.equal( title
.toText(), 'User:ABC.DEF', 'Round trip text' );
234 assert
.equal( title
.getNamespaceId(), 2, 'Parse canonical namespace prefix' );
236 title
= new mw
.Title( 'Image:quux pix.jpg' );
237 assert
.equal( title
.getNamespacePrefix(), 'File:', 'Transform alias to canonical namespace' );
239 title
= new mw
.Title( 'uSEr:hAshAr' );
240 assert
.equal( title
.toText(), 'User:HAshAr' );
241 assert
.equal( title
.getNamespaceId(), 2, 'Case-insensitive namespace prefix' );
243 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' );
244 assert
.equal( title
.getMain(), 'Foo_bar', 'Merge multiple types of whitespace/underscores into a single underscore' );
246 title
= new mw
.Title( 'Foo\u200E\u200F\u202A\u202B\u202C\u202D\u202Ebar' );
247 assert
.equal( title
.getMain(), 'Foobar', 'Strip Unicode bidi override characters' );
249 // Regression test: Previously it would only detect an extension if there is no space after it
250 title
= new mw
.Title( 'Example.js ' );
251 assert
.equal( title
.getExtension(), 'js', 'Space after an extension is stripped' );
253 title
= new mw
.Title( 'Example#foo' );
254 assert
.equal( title
.getFragment(), 'foo', 'Fragment' );
256 title
= new mw
.Title( 'Example#_foo_bar baz_' );
257 assert
.equal( title
.getFragment(), ' foo bar baz', 'Fragment' );
260 QUnit
.test( 'Namespace detection and conversion', function ( assert
) {
263 title
= new mw
.Title( 'File:User:Example' );
264 assert
.equal( title
.getNamespaceId(), 6, 'Titles can contain namespace prefixes, which are otherwise ignored' );
266 title
= new mw
.Title( 'Example', 6 );
267 assert
.equal( title
.getNamespaceId(), 6, 'Default namespace passed is used' );
269 title
= new mw
.Title( 'User:Example', 6 );
270 assert
.equal( title
.getNamespaceId(), 2, 'Included namespace prefix overrides the given default' );
272 title
= new mw
.Title( ':Example', 6 );
273 assert
.equal( title
.getNamespaceId(), 0, 'Colon forces main namespace' );
275 title
= new mw
.Title( 'something.PDF', 6 );
276 assert
.equal( title
.toString(), 'File:Something.PDF' );
278 title
= new mw
.Title( 'NeilK', 3 );
279 assert
.equal( title
.toString(), 'User_talk:NeilK' );
280 assert
.equal( title
.toText(), 'User talk:NeilK' );
282 title
= new mw
.Title( 'Frobisher', 100 );
283 assert
.equal( title
.toString(), 'Penguins:Frobisher' );
285 title
= new mw
.Title( 'antarctic_waterfowl:flightless_yet_cute.jpg' );
286 assert
.equal( title
.toString(), 'Penguins:Flightless_yet_cute.jpg' );
288 title
= new mw
.Title( 'Penguins:flightless_yet_cute.jpg' );
289 assert
.equal( title
.toString(), 'Penguins:Flightless_yet_cute.jpg' );
292 QUnit
.test( 'Throw error on invalid title', function ( assert
) {
293 assert
.throws( function () {
294 return new mw
.Title( '' );
295 }, 'Throw error on empty string' );
298 QUnit
.test( 'Case-sensivity', function ( assert
) {
302 mw
.config
.set( 'wgCaseSensitiveNamespaces', [] );
304 title
= new mw
.Title( 'article' );
305 assert
.equal( title
.toString(), 'Article', 'Default config: No sensitive namespaces by default. First-letter becomes uppercase' );
307 title
= new mw
.Title( 'ß' );
308 assert
.equal( title
.toString(), 'ß', 'Uppercasing matches PHP behaviour (ß -> ß, not SS)' );
310 title
= new mw
.Title( 'dž (digraph)' );
311 assert
.equal( title
.toString(), 'Dž_(digraph)', 'Uppercasing matches PHP behaviour (dž -> Dž, not DŽ)' );
313 // $wgCapitalLinks = false;
314 mw
.config
.set( 'wgCaseSensitiveNamespaces', [ 0, -2, 1, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15 ] );
316 title
= new mw
.Title( 'article' );
317 assert
.equal( title
.toString(), 'article', '$wgCapitalLinks=false: Article namespace is sensitive, first-letter case stays lowercase' );
319 title
= new mw
.Title( 'john', 2 );
320 assert
.equal( title
.toString(), 'User:John', '$wgCapitalLinks=false: User namespace is insensitive, first-letter becomes uppercase' );
323 QUnit
.test( 'toString / toText', function ( assert
) {
324 var title
= new mw
.Title( 'Some random page' );
326 assert
.equal( title
.toString(), title
.getPrefixedDb() );
327 assert
.equal( title
.toText(), title
.getPrefixedText() );
330 QUnit
.test( 'getExtension', function ( assert
) {
331 function extTest( pagename
, ext
, description
) {
332 var title
= new mw
.Title( pagename
);
333 assert
.equal( title
.getExtension(), ext
, description
|| pagename
);
336 extTest( 'MediaWiki:Vector.js', 'js' );
337 extTest( 'User:Example/common.css', 'css' );
338 extTest( 'File:Example.longextension', 'longextension', 'Extension parsing not limited (T38151)' );
339 extTest( 'Example/information.json', 'json', 'Extension parsing not restricted from any namespace' );
340 extTest( 'Foo.', null, 'Trailing dot is not an extension' );
341 extTest( 'Foo..', null, 'Trailing dots are not an extension' );
342 extTest( 'Foo.a.', null, 'Page name with dots and ending in a dot does not have an extension' );
344 // @broken: Throws an exception
345 // extTest( '.NET', null, 'Leading dot is (or is not?) an extension' );
348 QUnit
.test( 'exists', function ( assert
) {
351 // Empty registry, checks default to null
353 title
= new mw
.Title( 'Some random page', 4 );
354 assert
.strictEqual( title
.exists(), null, 'Return null with empty existance registry' );
356 // Basic registry, checks default to boolean
357 mw
.Title
.exist
.set( [ 'Does_exist', 'User_talk:NeilK', 'Wikipedia:Sandbox_rules' ], true );
358 mw
.Title
.exist
.set( [ 'Does_not_exist', 'User:John', 'Foobar' ], false );
360 title
= new mw
.Title( 'Project:Sandbox rules' );
361 assert
.assertTrue( title
.exists(), 'Return true for page titles marked as existing' );
362 title
= new mw
.Title( 'Foobar' );
363 assert
.assertFalse( title
.exists(), 'Return false for page titles marked as nonexistent' );
367 QUnit
.test( 'getUrl', function ( assert
) {
370 wgScript
: '/w/index.php',
371 wgArticlePath
: '/wiki/$1'
374 title
= new mw
.Title( 'Foobar' );
375 assert
.equal( title
.getUrl(), '/wiki/Foobar', 'Basic functionality, getUrl uses mw.util.getUrl' );
376 assert
.equal( title
.getUrl( { action
: 'edit' } ), '/w/index.php?title=Foobar&action=edit', 'Basic functionality, \'params\' parameter' );
378 title
= new mw
.Title( 'John Doe', 3 );
379 assert
.equal( title
.getUrl(), '/wiki/User_talk:John_Doe', 'Escaping in title and namespace for urls' );
381 title
= new mw
.Title( 'John Cena#And_His_Name_Is', 3 );
382 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' );
385 QUnit
.test( 'newFromImg', function ( assert
) {
386 var title
, i
, thisCase
, prefix
,
389 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',
390 typeOfUrl
: 'Hashed thumb with shortened path',
391 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)',
392 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'
396 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',
397 typeOfUrl
: 'Hashed thumb with sha1-ed path',
398 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)',
399 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'
403 url
: '/wiki/images/thumb/9/91/Anticlockwise_heliotrope%27s.jpg/99px-Anticlockwise_heliotrope%27s.jpg',
404 typeOfUrl
: 'Normal hashed directory thumbnail',
405 nameText
: 'Anticlockwise heliotrope\'s',
406 prefixedText
: 'File:Anticlockwise heliotrope\'s.jpg'
410 url
: '/wiki/images/thumb/8/80/Wikipedia-logo-v2.svg/langde-150px-Wikipedia-logo-v2.svg.png',
411 typeOfUrl
: 'Normal hashed directory thumbnail with complex thumbnail parameters',
412 nameText
: 'Wikipedia-logo-v2',
413 prefixedText
: 'File:Wikipedia-logo-v2.svg'
417 url
: '//upload.wikimedia.org/wikipedia/commons/thumb/8/80/Wikipedia-logo-v2.svg/150px-Wikipedia-logo-v2.svg.png',
418 typeOfUrl
: 'Commons thumbnail',
419 nameText
: 'Wikipedia-logo-v2',
420 prefixedText
: 'File:Wikipedia-logo-v2.svg'
424 url
: '/wiki/images/9/91/Anticlockwise_heliotrope%27s.jpg',
425 typeOfUrl
: 'Full image',
426 nameText
: 'Anticlockwise heliotrope\'s',
427 prefixedText
: 'File:Anticlockwise heliotrope\'s.jpg'
431 url
: 'http://localhost/thumb.php?f=Stuffless_Figaro%27s.jpg&width=180',
432 typeOfUrl
: 'thumb.php-based thumbnail',
433 nameText
: 'Stuffless Figaro\'s',
434 prefixedText
: 'File:Stuffless Figaro\'s.jpg'
438 url
: '/wikipedia/commons/thumb/Wikipedia-logo-v2.svg/150px-Wikipedia-logo-v2.svg.png',
439 typeOfUrl
: 'Commons unhashed thumbnail',
440 nameText
: 'Wikipedia-logo-v2',
441 prefixedText
: 'File:Wikipedia-logo-v2.svg'
445 url
: '/wikipedia/commons/thumb/Wikipedia-logo-v2.svg/langde-150px-Wikipedia-logo-v2.svg.png',
446 typeOfUrl
: 'Commons unhashed thumbnail with complex thumbnail parameters',
447 nameText
: 'Wikipedia-logo-v2',
448 prefixedText
: 'File:Wikipedia-logo-v2.svg'
452 url
: '/wiki/images/Anticlockwise_heliotrope%27s.jpg',
453 typeOfUrl
: 'Unhashed local file',
454 nameText
: 'Anticlockwise heliotrope\'s',
455 prefixedText
: 'File:Anticlockwise heliotrope\'s.jpg'
460 typeOfUrl
: 'Empty string'
465 typeOfUrl
: 'String with only alphabet characters'
469 url
: 'foobar.foobar',
470 typeOfUrl
: 'Not a file path'
474 url
: '/a/a0/blah blah blah',
475 typeOfUrl
: 'Space characters'
479 for ( i
= 0; i
< cases
.length
; i
++ ) {
480 thisCase
= cases
[ i
];
481 title
= mw
.Title
.newFromImg( { src
: thisCase
.url
} );
483 if ( thisCase
.nameText
!== undefined ) {
484 prefix
= '[' + thisCase
.typeOfUrl
+ ' URL' + '] ';
486 assert
.notStrictEqual( title
, null, prefix
+ 'Parses successfully' );
487 assert
.equal( title
.getNameText(), thisCase
.nameText
, prefix
+ 'Filename matches original' );
488 assert
.equal( title
.getPrefixedText(), thisCase
.prefixedText
, prefix
+ 'File page title matches original' );
489 assert
.equal( title
.getNamespaceId(), 6, prefix
+ 'Namespace ID matches File namespace' );
491 assert
.strictEqual( title
, null, thisCase
.typeOfUrl
+ ', should not produce an mw.Title object' );
496 QUnit
.test( 'getRelativeText', function ( assert
) {
497 var i
, thisCase
, title
,
502 expectedResult
: ':Asd'
507 expectedResult
: 'Dfg'
510 text
: 'Template:Ghj',
512 expectedResult
: 'Template:Ghj'
522 expectedResult
: 'User:Hi'
526 for ( i
= 0; i
< cases
.length
; i
++ ) {
527 thisCase
= cases
[ i
];
529 title
= mw
.Title
.newFromText( thisCase
.text
);
530 assert
.equal( title
.getRelativeText( thisCase
.relativeTo
), thisCase
.expectedResult
);
534 QUnit
.test( 'normalizeExtension', function ( assert
) {
535 var extension
, i
, thisCase
, prefix
,
540 description
: 'Extension already in canonical form'
545 description
: 'Extension lowercased in canonical form'
550 description
: 'Extension changed in canonical form'
555 description
: 'Extension lowercased and changed in canonical form'
560 description
: 'Extension invalid and discarded'
564 for ( i
= 0; i
< cases
.length
; i
++ ) {
565 thisCase
= cases
[ i
];
566 extension
= mw
.Title
.normalizeExtension( thisCase
.extension
);
568 prefix
= '[' + thisCase
.description
+ '] ';
569 assert
.equal( extension
, thisCase
.expected
, prefix
+ 'Extension as expected' );
573 QUnit
.test( 'newFromUserInput', function ( assert
) {
574 var title
, i
, thisCase
, prefix
,
577 title
: 'DCS0001557854455.JPG',
578 expected
: 'DCS0001557854455.JPG',
579 description
: 'Title in normal namespace without anything invalid but with "file extension"'
582 title
: 'MediaWiki:Msg-awesome',
583 expected
: 'MediaWiki:Msg-awesome',
584 description
: 'Full title (page in MediaWiki namespace) supplied as string'
587 title
: 'The/Mw/Sound.flac',
588 defaultNamespace
: -2,
589 expected
: 'Media:The-Mw-Sound.flac',
590 description
: 'Page in Media-namespace without explicit options'
593 title
: 'File:The/Mw/Sound.kml',
598 expected
: 'File:The/Mw/Sound.kml',
599 description
: 'Page in File-namespace without explicit options'
602 title
: 'File:Foo.JPEG',
603 expected
: 'File:Foo.JPEG',
604 description
: 'Page in File-namespace with non-canonical extension'
607 title
: 'File:Foo.JPEG ',
608 expected
: 'File:Foo.JPEG',
609 description
: 'Page in File-namespace with trailing whitespace'
613 for ( i
= 0; i
< cases
.length
; i
++ ) {
614 thisCase
= cases
[ i
];
615 title
= mw
.Title
.newFromUserInput( thisCase
.title
, thisCase
.defaultNamespace
, thisCase
.options
);
617 if ( thisCase
.expected
!== undefined ) {
618 prefix
= '[' + thisCase
.description
+ '] ';
620 assert
.notStrictEqual( title
, null, prefix
+ 'Parses successfully' );
621 assert
.equal( title
.toText(), thisCase
.expected
, prefix
+ 'Title as expected' );
623 assert
.strictEqual( title
, null, thisCase
.description
+ ', should not produce an mw.Title object' );
628 QUnit
.test( 'newFromFileName', function ( assert
) {
629 var title
, i
, thisCase
, prefix
,
632 fileName
: 'DCS0001557854455.JPG',
633 typeOfName
: 'Standard camera output',
634 nameText
: 'DCS0001557854455',
635 prefixedText
: 'File:DCS0001557854455.JPG'
638 fileName
: 'File:Sample.png',
639 typeOfName
: 'Carrying namespace',
640 nameText
: 'File-Sample',
641 prefixedText
: 'File:File-Sample.png'
644 fileName
: 'Treppe 2222 Test upload.jpg',
645 typeOfName
: 'File name with spaces in it and lower case file extension',
646 nameText
: 'Treppe 2222 Test upload',
647 prefixedText
: 'File:Treppe 2222 Test upload.jpg'
650 fileName
: 'I contain a \ttab.jpg',
651 typeOfName
: 'Name containing a tab character',
652 nameText
: 'I contain a tab',
653 prefixedText
: 'File:I contain a tab.jpg'
656 fileName
: 'I_contain multiple__ ___ _underscores.jpg',
657 typeOfName
: 'Name containing multiple underscores',
658 nameText
: 'I contain multiple underscores',
659 prefixedText
: 'File:I contain multiple underscores.jpg'
662 fileName
: 'I like ~~~~~~~~es.jpg',
663 typeOfName
: 'Name containing more than three consecutive tilde characters',
664 nameText
: 'I like ~~es',
665 prefixedText
: 'File:I like ~~es.jpg'
668 fileName
: 'BI\u200EDI.jpg',
669 typeOfName
: 'Name containing BIDI overrides',
671 prefixedText
: 'File:BIDI.jpg'
674 fileName
: '100%ab progress.jpg',
675 typeOfName
: 'File name with URL encoding',
676 nameText
: '100% ab progress',
677 prefixedText
: 'File:100% ab progress.jpg'
680 fileName
: '<([>]):/#.jpg',
681 typeOfName
: 'File name with characters not permitted in titles that are replaced',
682 nameText
: '((()))---',
683 prefixedText
: 'File:((()))---.jpg'
686 fileName
: 'spaces\u0009\u2000\u200A\u200Bx.djvu',
687 typeOfName
: 'File name with different kind of spaces',
688 nameText
: 'Spaces \u200Bx',
689 prefixedText
: 'File:Spaces \u200Bx.djvu'
692 fileName
: 'dot.dot.dot.dot.dotdot',
693 typeOfName
: 'File name with a lot of dots',
694 nameText
: 'Dot.dot.dot.dot',
695 prefixedText
: 'File:Dot.dot.dot.dot.dotdot'
698 fileName
: 'dot. dot ._dot',
699 typeOfName
: 'File name with multiple dots and spaces',
700 nameText
: 'Dot. dot',
701 prefixedText
: 'File:Dot. dot. dot'
704 fileName
: '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢𠻗𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵𢫕𢭃𢯊𢱑𢱕𢳂𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵𢫕𢭃𢯊𢱑𢱕𢳂.png',
705 typeOfName
: 'File name longer than 240 bytes',
706 nameText
: '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢𠻗𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵𢫕𢭃𢯊𢱑𢱕𢳂𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵',
707 prefixedText
: 'File:𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢𠻗𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵𢫕𢭃𢯊𢱑𢱕𢳂𠻹𠻺𠼭𠼮𠽌𠾴𠾼𠿪𡁜𡁯𡁵𡁶𡁻𡃁𡃉𡇙𢃇𢞵.png'
711 typeOfName
: 'Empty string'
715 typeOfName
: 'String with only alphabet characters'
719 for ( i
= 0; i
< cases
.length
; i
++ ) {
720 thisCase
= cases
[ i
];
721 title
= mw
.Title
.newFromFileName( thisCase
.fileName
);
723 if ( thisCase
.nameText
!== undefined ) {
724 prefix
= '[' + thisCase
.typeOfName
+ '] ';
726 assert
.notStrictEqual( title
, null, prefix
+ 'Parses successfully' );
727 assert
.equal( title
.getNameText(), thisCase
.nameText
, prefix
+ 'Filename matches original' );
728 assert
.equal( title
.getPrefixedText(), thisCase
.prefixedText
, prefix
+ 'File page title matches original' );
729 assert
.equal( title
.getNamespaceId(), 6, prefix
+ 'Namespace ID matches File namespace' );
731 assert
.strictEqual( title
, null, thisCase
.typeOfName
+ ', should not produce an mw.Title object' );
736 }( mediaWiki
, jQuery
) );