X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fmediawiki%2Fmediawiki.Title.test.js;h=52f05388fc47112b7b1b4256dc940d9e412942d5;hb=8d306686cf733f3cc424a41959d284827593d540;hp=a736e121b047d6223517f61623d3bf02576f0fb3;hpb=4c8816746ffc9d8baa647d8cbbf4295b40140f75;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.Title.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.Title.test.js index a736e121b0..52f05388fc 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.Title.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.Title.test.js @@ -1,58 +1,59 @@ -( function () { +( function ( mw ) { // mw.Title relies on these three config vars // Restore them after each test run var config = { - "wgFormattedNamespaces": { - "-2": "Media", - "-1": "Special", - "0": "", - "1": "Talk", - "2": "User", - "3": "User talk", - "4": "Wikipedia", - "5": "Wikipedia talk", - "6": "File", - "7": "File talk", - "8": "MediaWiki", - "9": "MediaWiki talk", - "10": "Template", - "11": "Template talk", - "12": "Help", - "13": "Help talk", - "14": "Category", - "15": "Category talk", + wgFormattedNamespaces: { + '-2': 'Media', + '-1': 'Special', + 0: '', + 1: 'Talk', + 2: 'User', + 3: 'User talk', + 4: 'Wikipedia', + 5: 'Wikipedia talk', + 6: 'File', + 7: 'File talk', + 8: 'MediaWiki', + 9: 'MediaWiki talk', + 10: 'Template', + 11: 'Template talk', + 12: 'Help', + 13: 'Help talk', + 14: 'Category', + 15: 'Category talk', // testing custom / localized namespace - "100": "Penguins" + 100: 'Penguins' }, - "wgNamespaceIds": { - "media": -2, - "special": -1, - "": 0, - "talk": 1, - "user": 2, - "user_talk": 3, - "wikipedia": 4, - "wikipedia_talk": 5, - "file": 6, - "file_talk": 7, - "mediawiki": 8, - "mediawiki_talk": 9, - "template": 10, - "template_talk": 11, - "help": 12, - "help_talk": 13, - "category": 14, - "category_talk": 15, - "image": 6, - "image_talk": 7, - "project": 4, - "project_talk": 5, + wgNamespaceIds: { + /*jshint camelcase: false */ + media: -2, + special: -1, + '': 0, + talk: 1, + user: 2, + user_talk: 3, + wikipedia: 4, + wikipedia_talk: 5, + file: 6, + file_talk: 7, + mediawiki: 8, + mediawiki_talk: 9, + template: 10, + template_talk: 11, + help: 12, + help_talk: 13, + category: 14, + category_talk: 15, + image: 6, + image_talk: 7, + project: 4, + project_talk: 5, /* testing custom / alias */ - "penguins": 100, - "antarctic_waterfowl": 100 + penguins: 100, + antarctic_waterfowl: 100 }, - "wgCaseSensitiveNamespaces": [] + wgCaseSensitiveNamespaces: [] }; QUnit.module( 'mediawiki.Title', QUnit.newMwEnvironment({ config: config }) ); @@ -78,7 +79,7 @@ QUnit.test( 'Transformation', 8, function ( assert ) { 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 - assert.equal( title.getName(), 'Foo_bar_.js', "Merge multiple spaces to a single space." ); + assert.equal( title.getName(), 'Foo_bar_.js', 'Merge multiple spaces to a single space.' ); }); QUnit.test( 'Main text for filename', 8, function ( assert ) { @@ -116,7 +117,7 @@ QUnit.test( 'Namespace detection and conversion', 6, function ( assert ) { QUnit.test( 'Throw error on invalid title', 1, function ( assert ) { assert.throws(function () { - var title = new mw.Title( '' ); + return new mw.Title( '' ); }, 'Throw error on empty string' ); }); @@ -197,4 +198,4 @@ QUnit.test( 'getUrl', 2, function ( assert ) { assert.equal( title.getUrl(), '/wiki/User_talk:John_Doe', 'Escaping in title and namespace for urls' ); }); -}() ); \ No newline at end of file +}( mediaWiki ) ); \ No newline at end of file