jenkins-bot has submitted this change and it was merged.

Change subject: Hygiene: Apply jscs rules to search, talk, references tests
......................................................................


Hygiene: Apply jscs rules to search, talk, references tests

Ignore jsDoc rule

Bug: T85876
Change-Id: Iae1c63f2fa7b33e7879900cf4b6d439c1700b9cf
---
M tests/qunit/modules/references/test_init.js
M tests/qunit/modules/search/test_SearchApi.js
M tests/qunit/modules/talk/test_TalkOverlay.js
M tests/qunit/modules/talk/test_TalkSectionAddOverlay.js
4 files changed, 165 insertions(+), 147 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/qunit/modules/references/test_init.js 
b/tests/qunit/modules/references/test_init.js
index 2671daa..1cf0267 100644
--- a/tests/qunit/modules/references/test_init.js
+++ b/tests/qunit/modules/references/test_init.js
@@ -1,27 +1,28 @@
-( function( $, M ) {
+//jscs:disable jsDoc
+( function ( $, M ) {
 
-var R = mw.mobileFrontend.require( 'references' ),
-       ReferencesDrawer = M.require( 'modules/references/ReferencesDrawer' );
+       var R = mw.mobileFrontend.require( 'references' ),
+               ReferencesDrawer = M.require( 
'modules/references/ReferencesDrawer' );
 
-QUnit.module( "MobileFrontend references.js", {
-       setup: function() {
-               $('<div id="mfe-test-references"><sup><a 
href="#ref-foo">[1]</a></sup></div><ol class="references"><li 
id="ref-foo"><a>test reference</a></li></ol>').appendTo('#qunit-fixture');
-               // prevent events from being logged.
-               this.sandbox.stub( ReferencesDrawer.prototype, 'show' );
-               this.sandbox.stub( M, 'isBetaGroupMember' ).returns( false );
-       },
-       teardown: function() {
-               $( '#mfe-test-references' ).remove();
-       }
-});
-
-QUnit.test( 'Standard', 2, function( assert ) {
-       R.setup( {
-               $el: $( '#mfe-test-references' )
+       QUnit.module( 'MobileFrontend references.js', {
+               setup: function () {
+                       $( '<div id="mfe-test-references"><sup><a 
href="#ref-foo">[1]</a></sup></div><ol class="references"><li 
id="ref-foo"><a>test reference</a></li></ol>' ).appendTo( '#qunit-fixture' );
+                       // prevent events from being logged.
+                       this.sandbox.stub( ReferencesDrawer.prototype, 'show' );
+                       this.sandbox.stub( M, 'isBetaGroupMember' ).returns( 
false );
+               },
+               teardown: function () {
+                       $( '#mfe-test-references' ).remove();
+               }
        } );
-       $("#mfe-test-references sup a").trigger("click");
-       assert.strictEqual( $( '.drawer.references h3' ).text(), '[1]' );
-       assert.strictEqual( $( '.drawer.references a' ).text(), 'test 
reference' );
-});
+
+       QUnit.test( 'Standard', 2, function ( assert ) {
+               R.setup( {
+                       $el: $( '#mfe-test-references' )
+               } );
+               $( '#mfe-test-references sup a' ).trigger( 'click' );
+               assert.strictEqual( $( '.drawer.references h3' ).text(), '[1]' 
);
+               assert.strictEqual( $( '.drawer.references a' ).text(), 'test 
reference' );
+       } );
 
 } )( jQuery, mw.mobileFrontend );
diff --git a/tests/qunit/modules/search/test_SearchApi.js 
b/tests/qunit/modules/search/test_SearchApi.js
index a83580c..595fe3b 100644
--- a/tests/qunit/modules/search/test_SearchApi.js
+++ b/tests/qunit/modules/search/test_SearchApi.js
@@ -1,62 +1,67 @@
+//jscs:disable jsDoc
 ( function ( $, M ) {
 
        var SearchApi = M.require( 'modules/search/SearchApi' ),
                api;
 
        QUnit.module( 'MobileFrontend: SearchApi', {
-               setup: function() {
+               setup: function () {
                        api = new SearchApi();
-                       this.sandbox.stub( SearchApi.prototype, 'get', 
function() {
+                       this.sandbox.stub( SearchApi.prototype, 'get', function 
() {
                                return $.Deferred().resolve( {
-                                       "warnings": { "query": { "*": 
"Formatting of continuation data will be changing soon. To continue using the 
current formatting, use the 'rawcontinue' parameter. To begin using the new 
format, pass an empty string for 'continue' in the initial query." } },
-                                       "query": {
-                                               "redirects": [
+                                       warnings: {
+                                               query: {
+                                                       '*': 'Formatting of 
continuation data will be changing soon. To continue using the current 
formatting, use the "rawcontinue" parameter. To begin using the new format, 
pass an empty string for "continue" in the initial query.'
+                                               }
+                                       },
+                                       query: {
+                                               redirects: [
                                                        {
-                                                               "from": "Barack 
obama",
-                                                               "to": "Barack 
Obama"
+                                                               from: 'Barack 
obama',
+                                                               to: 'Barack 
Obama'
                                                        },
                                                        {
-                                                               "from": 
"Barack",
-                                                               "to": "Claude 
Monet"
+                                                               from: 'Barack',
+                                                               to: 'Claude 
Monet'
                                                        }
                                                ],
-                                               "pages": {
-                                                       "2": {
-                                                               "pageid": 2,
-                                                               "ns": 0,
-                                                               "title": 
"Claude Monet",
-                                                               "thumbnail": {
-                                                                       
"source": 
"http://127.0.0.1:8080/images/thumb/5/54/Claude_Monet%2C_Impression%2C_soleil_levant.jpg/80px-Claude_Monet%2C_Impression%2C_soleil_levant.jpg";,
-                                                                       
"width": 80,
-                                                                       
"height": 62
+                                               pages: {
+                                                       2: {
+                                                               pageid: 2,
+                                                               ns: 0,
+                                                               title: 'Claude 
Monet',
+                                                               thumbnail: {
+                                                                       source: 
'http://127.0.0.1:8080/images/thumb/5/54/Claude_Monet%2C_Impression%2C_soleil_levant.jpg/80px-Claude_Monet%2C_Impression%2C_soleil_levant.jpg',
+                                                                       width: 
80,
+                                                                       height: 
62
                                                                }
                                                        },
-                                                       "60": {
-                                                               "pageid": 60,
-                                                               "ns": 0,
-                                                               "title": 
"Barack Obama",
-                                                               "thumbnail": {
-                                                                       
"source": 
"http://127.0.0.1:8080/images/thumb/8/8d/President_Barack_Obama.jpg/64px-President_Barack_Obama.jpg";,
-                                                                       
"width": 64,
-                                                                       
"height": 80
+                                                       60: {
+                                                               pageid: 60,
+                                                               ns: 0,
+                                                               title: 'Barack 
Obama',
+                                                               thumbnail: {
+                                                                       source: 
'http://127.0.0.1:8080/images/thumb/8/8d/President_Barack_Obama.jpg/64px-President_Barack_Obama.jpg',
+                                                                       width: 
64,
+                                                                       height: 
80
                                                                }
                                                        }
                                                },
-                                               "prefixsearch": [
+                                               prefixsearch: [
                                                        {
-                                                               "ns": 0,
-                                                               "title": 
"Barack",
-                                                               "pageid": 245
+                                                               ns: 0,
+                                                               title: 'Barack',
+                                                               pageid: 245
                                                        },
                                                        {
-                                                               "ns": 0,
-                                                               "title": 
"Barack Obama",
-                                                               "pageid": 60
+                                                               ns: 0,
+                                                               title: 'Barack 
Obama',
+                                                               pageid: 60
                                                        },
                                                        {
-                                                               "ns": 0,
-                                                               "title": 
"Barack obama",
-                                                               "pageid": 244
+                                                               ns: 0,
+                                                               title: 'Barack 
obama',
+                                                               pageid: 244
                                                        }
                                                ]
                                        }
@@ -65,7 +70,7 @@
                }
        } );
 
-       QUnit.test( '._highlightSearchTerm', 14, function( assert ) {
+       QUnit.test( '._highlightSearchTerm', 14, function ( assert ) {
                var data = [
                        [ 'Hello World', 'Hel', '<strong>Hel</strong>lo World' 
],
                        [ 'Hello kitty', 'el', 'Hello kitty' ], // not at start
@@ -74,57 +79,56 @@
                        [ 'Belle & the Beast', 'Belle &amp;', 'Belle &amp; the 
Beast' ],
                        [ 'with ? in it', 'with ?', '<strong>with ?</strong> in 
it' ], // not at start
                        [ 'Title with ? in it', 'with ?', 'Title with ? in it' 
], // not at start
-                       [ 'AT&T', 'a', '<strong>A</strong>T&amp;T'],
-                       [ 'AT&T', 'at&', '<strong>AT&amp;</strong>T'],
+                       [ 'AT&T', 'a', '<strong>A</strong>T&amp;T' ],
+                       [ 'AT&T', 'at&', '<strong>AT&amp;</strong>T' ],
                        [ '<tag', '&lt;tag', '&lt;tag' ],
                        [ '& this is a weird title', '&', 
'<strong>&amp;</strong> this is a weird title' ],
                        [ '& this is a weird title', '&a', '&amp; this is a 
weird title' ],
                        [ '&lt;t', '<t', '&amp;lt;t' ],
-                       [ "<script>alert('FAIL')</script> should be safe",
-                               "<script>alert('FAIL'", 
"<strong>&lt;script&gt;alert('FAIL'</strong>)&lt;/script&gt; should be safe" ]
+                       [ '<script>alert("FAIL")</script> should be safe',
+                               '<script>alert("FAIL"', 
'<strong>&lt;script&gt;alert("FAIL"</strong>)&lt;/script&gt; should be safe' ]
                ];
 
-               $.each( data, function( i, item ) {
-                       assert.strictEqual( SearchApi._highlightSearchTerm( 
item[0], item[1] ), item[2], 'highlightSearchTerm test ' + i );
+               $.each( data, function ( i, item ) {
+                       assert.strictEqual( SearchApi._highlightSearchTerm( 
item[ 0 ], item[ 1 ] ), item[ 2 ], 'highlightSearchTerm test ' + i );
                } );
        } );
 
-
-       QUnit.test( 'show redirect targets', 6, function( assert ) {
+       QUnit.test( 'show redirect targets', 6, function ( assert ) {
                var results = [
                        {
-                               "heading": "Claude Monet",
-                               "title": "Claude Monet",
-                               "url": "/wiki/Claude_Monet",
-                               "thumbnail": {
-                                       "source": 
"http://127.0.0.1:8080/images/thumb/5/54/Claude_Monet%2C_Impression%2C_soleil_levant.jpg/80px-Claude_Monet%2C_Impression%2C_soleil_levant.jpg";,
-                                       "width": 80,
-                                       "height": 62
+                               heading: 'Claude Monet',
+                               title: 'Claude Monet',
+                               url: '/wiki/Claude_Monet',
+                               thumbnail: {
+                                       source: 
'http://127.0.0.1:8080/images/thumb/5/54/Claude_Monet%2C_Impression%2C_soleil_levant.jpg/80px-Claude_Monet%2C_Impression%2C_soleil_levant.jpg',
+                                       width: 80,
+                                       height: 62
                                },
-                               "listThumbStyleAttribute": "background-image: 
url(http://127.0.0.1:8080/images/thumb/5/54/Claude_Monet%2C_Impression%2C_soleil_levant.jpg/80px-Claude_Monet%2C_Impression%2C_soleil_levant.jpg)",
-                               "pageimageClass": "list-thumb-y"
+                               listThumbStyleAttribute: 'background-image: 
url(http://127.0.0.1:8080/images/thumb/5/54/Claude_Monet%2C_Impression%2C_soleil_levant.jpg/80px-Claude_Monet%2C_Impression%2C_soleil_levant.jpg)',
+                               pageimageClass: 'list-thumb-y'
                        },
                        {
-                               "heading": "<strong>Barack</strong> Obama",
-                               "title": "Barack Obama",
-                               "url": "/wiki/Barack_Obama",
-                               "thumbnail": {
-                                       "source": 
"http://127.0.0.1:8080/images/thumb/8/8d/President_Barack_Obama.jpg/64px-President_Barack_Obama.jpg";,
-                                       "width": 64,
-                                       "height": 80
+                               heading: '<strong>Barack</strong> Obama',
+                               title: 'Barack Obama',
+                               url: '/wiki/Barack_Obama',
+                               thumbnail: {
+                                       source: 
'http://127.0.0.1:8080/images/thumb/8/8d/President_Barack_Obama.jpg/64px-President_Barack_Obama.jpg',
+                                       width: 64,
+                                       height: 80
                                },
-                               "listThumbStyleAttribute": "background-image: 
url(http://127.0.0.1:8080/images/thumb/8/8d/President_Barack_Obama.jpg/64px-President_Barack_Obama.jpg)",
-                               "pageimageClass": "list-thumb-x"
+                               listThumbStyleAttribute: 'background-image: 
url(http://127.0.0.1:8080/images/thumb/8/8d/President_Barack_Obama.jpg/64px-President_Barack_Obama.jpg)',
+                               pageimageClass: 'list-thumb-x'
                        }
                ];
 
                api.search( 'barack' ).done( function ( response ) {
                        assert.strictEqual( response.query, 'barack' );
                        assert.strictEqual( response.results.length, 2 );
-                       assert.strictEqual( response.results[0].heading, 
results[0].heading );
-                       assert.strictEqual( 
response.results[0].thumbnail.width, results[0].thumbnail.width );
-                       assert.strictEqual( response.results[1].heading, 
results[1 ].heading );
-                       assert.strictEqual( response.results[1].title, 
results[1].title );
+                       assert.strictEqual( response.results[ 0 ].heading, 
results[ 0 ].heading );
+                       assert.strictEqual( response.results[ 0 
].thumbnail.width, results[ 0 ].thumbnail.width );
+                       assert.strictEqual( response.results[ 1 ].heading, 
results[ 1 ].heading );
+                       assert.strictEqual( response.results[ 1 ].title, 
results[ 1 ].title );
                } );
        } );
 
diff --git a/tests/qunit/modules/talk/test_TalkOverlay.js 
b/tests/qunit/modules/talk/test_TalkOverlay.js
index 5b92961..6af1009 100644
--- a/tests/qunit/modules/talk/test_TalkOverlay.js
+++ b/tests/qunit/modules/talk/test_TalkOverlay.js
@@ -1,67 +1,77 @@
+//jscs:disable jsDoc
 ( function ( M, $ ) {
 
-var TalkOverlay = M.require( 'modules/talk/TalkOverlay' );
+       var TalkOverlay = M.require( 'modules/talk/TalkOverlay' );
 
-QUnit.module( 'MobileFrontend TalkOverlay', {
-       setup: function() {
-               this.sandbox.stub( M.pageApi, 'getPage' ).withArgs( 'Talk:No 
exist' ).returns(
-                       $.Deferred().reject( 'missingtitle' )
-               ).withArgs( 'Talk:Topic' ).returns(
-                       $.Deferred().resolve( {
-                               title: 'Talk:Topic',
-                               id: 1,
-                               lead: '',
-                               sections: [
-                                       { id: 50, line: 'Topic 1' }
-                               ]
-                       } )
-               );
+       QUnit.module( 'MobileFrontend TalkOverlay', {
+               setup: function () {
+                       this.sandbox.stub( M.pageApi, 'getPage' ).withArgs( 
'Talk:No exist' ).returns(
+                               $.Deferred().reject( 'missingtitle' )
+                       ).withArgs( 'Talk:Topic' ).returns(
+                               $.Deferred().resolve( {
+                                       title: 'Talk:Topic',
+                                       id: 1,
+                                       lead: '',
+                                       sections: [
+                                               {
+                                                       id: 50,
+                                                       line: 'Topic 1'
+                                               }
+                                       ]
+                               } )
+                       );
 
-               this.user = mw.user.getName() || '';
-       },
-       teardown: function() {
-               mw.config.set( 'wgUserName', this.user );
-       }
-} );
+                       this.user = mw.user.getName() || '';
+               },
+               teardown: function () {
+                       mw.config.set( 'wgUserName', this.user );
+               }
+       } );
 
-QUnit.test( '#TalkOverlay (new page; anonymous)', 4, function( assert ) {
-       mw.config.set( 'wgUserName', null );
-       var options = { title: 'Talk:No exist' }, overlay = new TalkOverlay( 
options ),
-               page = overlay.page;
+       QUnit.test( '#TalkOverlay (new page; anonymous)', 4, function ( assert 
) {
+               mw.config.set( 'wgUserName', null );
+               var options = {
+                               title: 'Talk:No exist'
+                       },
+                       overlay = new TalkOverlay( options ),
+                       page = overlay.page;
 
-       assert.strictEqual( page.title, 'Talk:No exist', 'Title set' );
-       assert.strictEqual( page.getSections().length, 0, 'A page was setup 
with no sections' );
+               assert.strictEqual( page.title, 'Talk:No exist', 'Title set' );
+               assert.strictEqual( page.getSections().length, 0, 'A page was 
setup with no sections' );
 
-       // reload discussion board via ajax
-       overlay._loadContent( options );
-       assert.strictEqual( page.getSections().length, 0, 'Discussions 
reloaded, still no sections' );
+               // reload discussion board via ajax
+               overlay._loadContent( options );
+               assert.strictEqual( page.getSections().length, 0, 'Discussions 
reloaded, still no sections' );
 
-       // check whether there is an Add discussion button
-       assert.strictEqual( overlay.$( '.add' ).length, 0, 'There is no "Add 
discussion" button' );
-} );
+               // check whether there is an Add discussion button
+               assert.strictEqual( overlay.$( '.add' ).length, 0, 'There is no 
"Add discussion" button' );
+       } );
 
-QUnit.test( '#TalkOverlay (logged in)', 2, function( assert ) {
-       mw.config.set( 'wgUserName', 'FlorianSW' );
-       var overlay = new TalkOverlay( { title: 'Talk:No exist' } );
+       QUnit.test( '#TalkOverlay (logged in)', 2, function ( assert ) {
+               mw.config.set( 'wgUserName', 'FlorianSW' );
+               var overlay = new TalkOverlay( {
+                       title: 'Talk:No exist'
+               } );
 
-       assert.ok( overlay.$( '.add' ).length > 0, 'There is an "Add 
discussion" button' );
-       assert.strictEqual( $.trim( overlay.$( '.content-header' ).text() ),
-               mw.msg( 'mobile-frontend-talk-explained-empty' ),
-               'Check the header knows it is empty.' );
-} );
+               assert.ok( overlay.$( '.add' ).length > 0, 'There is an "Add 
discussion" button' );
+               assert.strictEqual( $.trim( overlay.$( '.content-header' 
).text() ),
+                       mw.msg( 'mobile-frontend-talk-explained-empty' ),
+                       'Check the header knows it is empty.' );
+       } );
 
+       QUnit.test( '#TalkOverlay (existing page lists section headings)', 4, 
function ( assert ) {
+               var overlay = new TalkOverlay( {
+                       title: 'Talk:Topic'
+               } );
 
-QUnit.test( '#TalkOverlay (existing page lists section headings)', 4, 
function( assert ) {
-       var overlay = new TalkOverlay( { title: 'Talk:Topic' } );
-
-       assert.ok( overlay.$( '.topic-title-list li' ).length === 1, 'One topic 
heading is listed' );
-       assert.strictEqual( overlay.$( '.topic-title-list li a' ).eq( 0 
).text(), 'Topic 1',
-               'The text of the second item is the section heading.' );
-       assert.strictEqual( overlay.$( '.topic-title-list li a' ).data( 'id' ), 
50,
-               'The data id is set.' );
-       assert.strictEqual( $.trim( overlay.$( '.content-header' ).text() ),
-               mw.msg( 'mobile-frontend-talk-explained' ),
-               'Check the header knows it is not empty.' );
-} );
+               assert.ok( overlay.$( '.topic-title-list li' ).length === 1, 
'One topic heading is listed' );
+               assert.strictEqual( overlay.$( '.topic-title-list li a' ).eq( 0 
).text(), 'Topic 1',
+                       'The text of the second item is the section heading.' );
+               assert.strictEqual( overlay.$( '.topic-title-list li a' ).data( 
'id' ), 50,
+                       'The data id is set.' );
+               assert.strictEqual( $.trim( overlay.$( '.content-header' 
).text() ),
+                       mw.msg( 'mobile-frontend-talk-explained' ),
+                       'Check the header knows it is not empty.' );
+       } );
 
 }( mw.mobileFrontend, jQuery ) );
diff --git a/tests/qunit/modules/talk/test_TalkSectionAddOverlay.js 
b/tests/qunit/modules/talk/test_TalkSectionAddOverlay.js
index 6571f14..81d7a11 100644
--- a/tests/qunit/modules/talk/test_TalkSectionAddOverlay.js
+++ b/tests/qunit/modules/talk/test_TalkSectionAddOverlay.js
@@ -1,16 +1,19 @@
+//jscs:disable jsDoc
 ( function ( M, $ ) {
 
        var TalkSectionAddOverlay = M.require( 
'modules/talk/TalkSectionAddOverlay' ),
                api = M.require( 'api' );
 
        QUnit.module( 'MobileFrontend TalkSectionAddOverlay', {
-               setup: function() {
+               setup: function () {
                        this.sandbox.stub( api, 'postWithToken' ).returns( 
$.Deferred().resolve() );
                }
        } );
 
-       QUnit.test( 'Test "add new discussion" Overlay and save process', 4, 
function( assert ) {
-               var overlay = new TalkSectionAddOverlay( { title: 'Talk:No 
exist' } );
+       QUnit.test( 'Test "add new discussion" Overlay and save process', 4, 
function ( assert ) {
+               var overlay = new TalkSectionAddOverlay( {
+                       title: 'Talk:No exist'
+               } );
                // set the content of the new discussion
                overlay.$( 'input' ).val( 'Testtitle' );
                overlay.$( 'textarea' ).val( 'Testcontent' );
@@ -19,10 +22,10 @@
                assert.strictEqual( overlay.$( 'textarea' ).val(), 
'Testcontent', 'Testcontent set' );
                // Test the save of the new dicsussion
                QUnit.stop();
-               overlay.save().done( function( status ) {
+               overlay.save().done( function ( status ) {
                        assert.strictEqual( status, 'ok', 'The new discussion 
was saved' );
                        QUnit.start();
-               } ).fail( function( error ) {
+               } ).fail( function ( error ) {
                        assert.strictEqual( error, 'ok', 'The new discussion 
was saved' );
                        QUnit.start();
                } );

-- 
To view, visit https://gerrit.wikimedia.org/r/183562
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iae1c63f2fa7b33e7879900cf4b6d439c1700b9cf
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to