Merge "mediawiki.searchSuggest: Show full article title as a tooltip for each suggestion"
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki / mediawiki.test.js
index f20ce67..0f6b445 100644 (file)
@@ -9,26 +9,24 @@
 
        QUnit.module( 'mediawiki', QUnit.newMwEnvironment( {
                setup: function () {
-                       // Messages used in multiple tests
-                       mw.messages.set( {
-                               'other-message': 'Other Message',
-                               'mediawiki-test-pagetriage-del-talk-page-notify-summary': 'Notifying author of deletion nomination for [[$1]]',
-                               'gender-plural-msg': '{{GENDER:$1|he|she|they}} {{PLURAL:$2|is|are}} awesome',
-                               'grammar-msg': 'Przeszukaj {{GRAMMAR:grammar_case_foo|{{SITENAME}}}}',
-                               'formatnum-msg': '{{formatnum:$1}}',
-                               'int-msg': 'Some {{int:other-message}}',
-                               'mediawiki-test-version-entrypoints-index-php': '[https://www.mediawiki.org/wiki/Manual:index.php index.php]',
-                               'external-link-replace': 'Foo [$1 bar]'
-                       } );
-
-                       mw.config.set( {
-                               wgArticlePath: '/wiki/$1',
-
-                               // For formatnum tests
-                               wgUserLanguage: 'en'
-                       } );
-
                        specialCharactersPageName = '"Who" wants to be a millionaire & live on \'Exotic Island\'?';
+               },
+               config: {
+                       wgArticlePath: '/wiki/$1',
+
+                       // For formatnum tests
+                       wgUserLanguage: 'en'
+               },
+               // Messages used in multiple tests
+               messages: {
+                       'other-message': 'Other Message',
+                       'mediawiki-test-pagetriage-del-talk-page-notify-summary': 'Notifying author of deletion nomination for [[$1]]',
+                       'gender-plural-msg': '{{GENDER:$1|he|she|they}} {{PLURAL:$2|is|are}} awesome',
+                       'grammar-msg': 'Przeszukaj {{GRAMMAR:grammar_case_foo|{{SITENAME}}}}',
+                       'formatnum-msg': '{{formatnum:$1}}',
+                       'int-msg': 'Some {{int:other-message}}',
+                       'mediawiki-test-version-entrypoints-index-php': '[https://www.mediawiki.org/wiki/Manual:index.php index.php]',
+                       'external-link-replace': 'Foo [$1 bar]'
                }
        } ) );
 
                assert.strictEqual( window.$j, window.jQuery, '$j alias to jQuery' );
                this.restoreWarnings();
 
+               // window.mw and window.mediaWiki are not deprecated, but for some reason
+               // PhantomJS is triggerring the accessors on all mw.* properties in this test,
+               // and with that lots of unrelated deprecation notices.
+               this.suppressWarnings();
                assert.ok( window.mediaWiki, 'mediaWiki defined' );
                assert.ok( window.mw, 'mw defined' );
                assert.strictEqual( window.mw, window.mediaWiki, 'mw alias to mediaWiki' );
+               this.restoreWarnings();
        } );
 
        QUnit.test( 'mw.Map', 28, function ( assert ) {
 
        } );
 
-       QUnit.test( 'mw.hook', 12, function ( assert ) {
+       QUnit.test( 'mw.hook', 13, function ( assert ) {
                var hook, add, fire, chars, callback;
 
                mw.hook( 'test.hook.unfired' ).add( function () {
                } );
                mw.hook( 'test.hook.basic' ).fire();
 
+               mw.hook( 'hasOwnProperty' ).add( function () {
+                       assert.ok( true, 'hook with name of predefined method' );
+               } );
+               mw.hook( 'hasOwnProperty' ).fire();
+
                mw.hook( 'test.hook.data' ).add( function ( data1, data2 ) {
                        assert.equal( data1, 'example', 'Fire with data (string param)' );
                        assert.deepEqual( data2, ['two'], 'Fire with data (array param)' );