* When I first passed "Foobar___.js" to mw.Title and saw that it was stripping away (some) spaces, I thought it was a bug (since extension is part of the title and should be kept as is). Anyway, as it turns out it's not stripping them away because they are between 'title' and 'extension', it's a general rule that there should not two or more spaces next to each other in a title. Adding test to assert and confirm this behavior.
ok( mw.Title, 'mw.Title defined' );
});
-test( 'Transform between Text and Db', function() {
- expect(2);
+test( 'Transformation', function() {
+ expect(3);
_titleConfig();
var title;
title = new mw.Title( 'File:Glarg_foo_glang.jpg' );
equal( title.getNameText(), 'Glarg foo glang' );
+
+ title = new mw.Title( ' MediaWiki: Foo bar .js ' );
+ // Don't ask why, it's the way the backend works. One space is kept of each set
+ equal( title.getName(), 'Foo_bar_.js', "Merge multiple spaces to a single space." );
});
test( 'Main text for filename', function() {