Bmansurov has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/183412

Change subject: WIP: Apply jscs to test files
......................................................................

WIP: Apply jscs to test files

Ignore jsDoc rule

Bug: T85876
Change-Id: Ic21f10a3de12e2e5bd13e7ba90f045cc94a54b68
---
M Gruntfile.js
M tests/qunit/test_Overlay.js
M tests/qunit/test_OverlayManager.js
M tests/qunit/test_Page.js
M tests/qunit/test_PageApi.js
M tests/qunit/test_Router.js
M tests/qunit/test_Schema.js
M tests/qunit/test_Skin.js
M tests/qunit/test_api.js
M tests/qunit/test_application.js
M tests/qunit/test_browser.js
11 files changed, 618 insertions(+), 405 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/12/183412/1

diff --git a/Gruntfile.js b/Gruntfile.js
index 703dbe9..51409ab 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -40,7 +40,10 @@
                        ]
                },
                jscs: {
-                       main: [ '<%= jshint.sources %>' ]
+                       main: [
+                               '<%= jshint.sources %>',
+                               '<%= files.jsTests %>'
+                       ]
                },
                qunit: {
                        all: {
diff --git a/tests/qunit/test_Overlay.js b/tests/qunit/test_Overlay.js
index c380b1a..563bec9 100644
--- a/tests/qunit/test_Overlay.js
+++ b/tests/qunit/test_Overlay.js
@@ -1,16 +1,20 @@
-(function ( M, $ ) {
+//jscs:disable jsDoc
+( function ( M, $ ) {
        var Overlay = M.require( 'Overlay' );
 
        QUnit.module( 'MobileFrontend: Overlay.js', {
-               setup: function() {
+               setup: function () {
                        this.clock = this.sandbox.useFakeTimers();
                }
        } );
 
        QUnit.test( 'Simple overlay', 1, function ( assert ) {
-               var overlay = new Overlay( { heading: '<h2>Title</h2>', 
content: 'Text' } );
+               var overlay = new Overlay( {
+                       heading: '<h2>Title</h2>',
+                       content: 'Text'
+               } );
                overlay.show();
-               assert.strictEqual( overlay.$el[0].parentNode, $( 
'#mw-mf-viewport' )[0], 'In DOM' );
+               assert.strictEqual( overlay.$el[ 0 ].parentNode, $( 
'#mw-mf-viewport' )[ 0 ], 'In DOM' );
                overlay.hide();
        } );
 
@@ -22,16 +26,21 @@
                                content: mw.template.compile( '<div 
class="content">YO</div>', 'hogan' )
                        }
                } );
-               overlay = new TestOverlay( { heading: 'Awesome' } );
+               overlay = new TestOverlay( {
+                       heading: 'Awesome'
+               } );
                assert.strictEqual( overlay.$el.find( 'h2' ).html(), 'Awesome' 
);
                assert.strictEqual( overlay.$el.find( '.content' ).text(), 'YO' 
);
        } );
 
        QUnit.test( 'Close overlay', 1, function ( assert ) {
-               var overlay = new Overlay( { heading: '<h2>Title</h2>', 
content: 'Text' } );
+               var overlay = new Overlay( {
+                       heading: '<h2>Title</h2>',
+                       content: 'Text'
+               } );
                overlay.show();
                overlay.hide();
                this.clock.tick( 1000 );
-               assert.strictEqual( overlay.$el[0].parentNode, null, 'No longer 
in DOM' );
+               assert.strictEqual( overlay.$el[ 0 ].parentNode, null, 'No 
longer in DOM' );
        } );
-})( mw.mobileFrontend, jQuery );
+} )( mw.mobileFrontend, jQuery );
diff --git a/tests/qunit/test_OverlayManager.js 
b/tests/qunit/test_OverlayManager.js
index 5d4e5a0..92a8073 100644
--- a/tests/qunit/test_OverlayManager.js
+++ b/tests/qunit/test_OverlayManager.js
@@ -1,15 +1,16 @@
-( function( M, $ ) {
+//jscs:disable jsDoc
+( function ( M, $ ) {
        var
                OverlayManager = M.require( 'OverlayManager' ),
                EventEmitter = M.require( 'eventemitter' ),
                fakeRouter, overlayManager;
 
        QUnit.module( 'MobileFrontend OverlayManager', {
-               setup: function() {
-                       this.createFakeOverlay = function( options ) {
+               setup: function () {
+                       this.createFakeOverlay = function ( options ) {
                                var fakeOverlay = new EventEmitter();
                                fakeOverlay.show = this.sandbox.spy();
-                               fakeOverlay.hide = function() {
+                               fakeOverlay.hide = function () {
                                        this.emit( 'hide' );
                                        return true;
                                };
@@ -25,98 +26,119 @@
                }
        } );
 
-       QUnit.test( '#add', 1, function( assert ) {
+       QUnit.test( '#add', 1, function ( assert ) {
                var fakeOverlay = this.createFakeOverlay();
 
-               overlayManager.add( /^test$/, function() {
+               overlayManager.add( /^test$/, function () {
                        return fakeOverlay;
                } );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test' } ) 
);
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test'
+               } ) );
 
                assert.ok( fakeOverlay.show.calledOnce, 'show registered 
overlay' );
        } );
 
-       QUnit.test( '#add, with $.Deferred factory', 2, function( assert ) {
-               var deferred = $.Deferred(), fakeOverlay = 
this.createFakeOverlay();
+       QUnit.test( '#add, with $.Deferred factory', 2, function ( assert ) {
+               var deferred = $.Deferred(),
+                       fakeOverlay = this.createFakeOverlay();
                deferred.show = this.sandbox.spy();
 
-               overlayManager.add( /^test$/, function() {
+               overlayManager.add( /^test$/, function () {
                        return deferred;
                } );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test' } ) 
);
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test'
+               } ) );
                deferred.resolve( fakeOverlay );
 
-               assert.ok( !deferred.show.called, "don't call show on Deferred" 
);
+               assert.ok( !deferred.show.called, 'don\'t call show on 
Deferred' );
                assert.ok( fakeOverlay.show.calledOnce, 'show registered 
overlay' );
        } );
 
-       QUnit.test( '#add, with current path', 1, function( assert ) {
+       QUnit.test( '#add, with current path', 1, function ( assert ) {
                var fakeOverlay = this.createFakeOverlay();
                fakeRouter.getPath = this.sandbox.stub().returns( 'test' );
 
-               overlayManager.add( /^test$/, function() {
+               overlayManager.add( /^test$/, function () {
                        return fakeOverlay;
                } );
 
                assert.ok( fakeOverlay.show.calledOnce, 'show registered 
overlay' );
        } );
 
-       QUnit.test( '#replaceCurrent', 3, function( assert ) {
+       QUnit.test( '#replaceCurrent', 3, function ( assert ) {
                var fakeOverlay = this.createFakeOverlay(),
                        anotherFakeOverlay = this.createFakeOverlay();
 
-               overlayManager.add( /^test$/, function() {
+               overlayManager.add( /^test$/, function () {
                        return fakeOverlay;
                } );
 
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test' } ) 
);
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test'
+               } ) );
                overlayManager.replaceCurrent( anotherFakeOverlay );
                assert.ok( fakeOverlay.hide.calledOnce, 'hide overlay' );
                assert.ok( anotherFakeOverlay.show.calledOnce, 'show another 
overlay' );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: '' } ) );
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: ''
+               } ) );
                assert.ok( anotherFakeOverlay.hide.calledOnce, 'hide another 
overlay' );
        } );
 
-       QUnit.test( 'route with params', 1, function( assert ) {
+       QUnit.test( 'route with params', 1, function ( assert ) {
                var
                        fakeOverlay = this.createFakeOverlay(),
                        factoryStub = this.sandbox.stub().returns( fakeOverlay 
);
 
                overlayManager.add( /^test\/(\d+)$/, factoryStub );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test/123' 
} ) );
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test/123'
+               } ) );
 
                assert.ok( factoryStub.calledWith( '123' ), 'pass params from 
the route' );
        } );
 
-       QUnit.test( 'hide when route changes', 3, function( assert ) {
+       QUnit.test( 'hide when route changes', 3, function ( assert ) {
                var
                        fakeOverlay = this.createFakeOverlay(),
                        factoryStub = this.sandbox.stub().returns( fakeOverlay 
);
 
                overlayManager.add( /^test$/, factoryStub );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test' } ) 
);
-               fakeRouter.emit( 'route', $.Event( 'route', { path: '' } ) );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test' } ) 
);
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'other' } ) 
);
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test'
+               } ) );
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: ''
+               } ) );
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test'
+               } ) );
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'other'
+               } ) );
 
                assert.ok( fakeOverlay.hide.calledTwice, 'hide overlay' );
-               assert.ok( fakeOverlay.hide.getCall( 0 ).notCalledWith( true ), 
"don't force hide (first)" );
-               assert.ok( fakeOverlay.hide.getCall( 1 ).notCalledWith( true ), 
"don't force hide (second)" );
+               assert.ok( fakeOverlay.hide.getCall( 0 ).notCalledWith( true ), 
'don\'t force hide (first)' );
+               assert.ok( fakeOverlay.hide.getCall( 1 ).notCalledWith( true ), 
'don\'t force hide (second)' );
        } );
 
-       QUnit.test( "go back (change route) if overlay hidden but not by route 
change", 1, function( assert ) {
+       QUnit.test( 'go back (change route) if overlay hidden but not by route 
change', 1, function ( assert ) {
                var
                        fakeOverlay = this.createFakeOverlay(),
                        factoryStub = this.sandbox.stub().returns( fakeOverlay 
);
 
                overlayManager.add( /^test$/, factoryStub );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test' } ) 
);
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test'
+               } ) );
                fakeOverlay.hide();
 
-               assert.ok( fakeRouter.back.calledOnce, "route back" );
+               assert.ok( fakeRouter.back.calledOnce, 'route back' );
        } );
 
-       QUnit.test( 'stacked overlays', 7, function( assert ) {
+       QUnit.test( 'stacked overlays', 7, function ( assert ) {
                var
                        fakeOverlay = this.createFakeOverlay(),
                        factoryStub = this.sandbox.stub().returns( fakeOverlay 
),
@@ -126,28 +148,40 @@
                overlayManager.add( /^parent$/, parentFactoryStub );
                overlayManager.add( /^test$/, factoryStub );
 
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'parent' } 
) );
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'parent'
+               } ) );
                assert.ok( parentFakeOverlay.show.calledOnce, 'show parent' );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test' } ) 
);
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test'
+               } ) );
                assert.ok( parentFakeOverlay.hide.calledOnce, 'hide parent' );
                assert.ok( parentFakeOverlay.hide.calledWith( true ), 'hide 
parent forcefully (no confirmation)' );
                assert.ok( fakeOverlay.show.calledOnce, 'show child' );
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'parent' } 
) );
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'parent'
+               } ) );
                assert.ok( fakeOverlay.hide.calledOnce, 'hide child' );
                assert.ok( parentFakeOverlay.show.calledTwice, 'show parent 
again' );
 
                assert.ok( parentFactoryStub.calledOnce, 'create parent only 
once' );
        } );
 
-       QUnit.test( 'prevent route change', 1, function( assert ) {
+       QUnit.test( 'prevent route change', 1, function ( assert ) {
                var
-                       fakeOverlay = this.createFakeOverlay( { hide: 
this.sandbox.stub().returns( false ) } ),
+                       fakeOverlay = this.createFakeOverlay( {
+                               hide: this.sandbox.stub().returns( false )
+                       } ),
                        factoryStub = this.sandbox.stub().returns( fakeOverlay 
),
-                       ev = $.Event( 'route', { path: '' } );
+                       ev = $.Event( 'route', {
+                               path: ''
+                       } );
 
                overlayManager.add( /^test$/, factoryStub );
 
-               fakeRouter.emit( 'route', $.Event( 'route', { path: 'test' } ) 
);
+               fakeRouter.emit( 'route', $.Event( 'route', {
+                       path: 'test'
+               } ) );
                fakeRouter.emit( 'route', ev );
                assert.ok( ev.isDefaultPrevented(), 'prevent route change' );
        } );
diff --git a/tests/qunit/test_Page.js b/tests/qunit/test_Page.js
index 8645662..0f57cee 100644
--- a/tests/qunit/test_Page.js
+++ b/tests/qunit/test_Page.js
@@ -1,16 +1,22 @@
-( function( M, $ ) {
+//jscs:disable jsDoc
+( function ( M, $ ) {
        var Page = M.require( 'Page' );
 
        QUnit.module( 'MobileFrontend Page' );
 
-       QUnit.test( '#isMainPage', 2, function( assert ) {
-               var p = new Page( { title: 'Main Page', isMainPage: true } ),
-                       p2 = new Page( { title: 'Foo' } );
+       QUnit.test( '#isMainPage', 2, function ( assert ) {
+               var p = new Page( {
+                               title: 'Main Page',
+                               isMainPage: true
+                       } ),
+                       p2 = new Page( {
+                               title: 'Foo'
+                       } );
                assert.strictEqual( p.isMainPage(), true, 'check main page flag 
is updated' );
                assert.strictEqual( p2.isMainPage(), false, 'check not marked 
as main page' );
        } );
 
-       QUnit.test( '#getNamespaceId', 8, function( assert ) {
+       QUnit.test( '#getNamespaceId', 8, function ( assert ) {
                var testCases = [
                        [ 'Main Page', 0 ],
                        [ 'San Francisco', 0 ],
@@ -21,13 +27,15 @@
                        [ 'User talk:Jon', 3 ],
                        [ 'Special:Nearby', -1 ]
                ];
-               $.each( testCases, function( i, tc ) {
-                       var p = new Page( { title: tc[0] } );
-                       assert.strictEqual( p.getNamespaceId(), tc[1], 'Check 
namespace is as expected' );
+               $.each( testCases, function ( i, tc ) {
+                       var p = new Page( {
+                               title: tc[ 0 ]
+                       } );
+                       assert.strictEqual( p.getNamespaceId(), tc[ 1 ], 'Check 
namespace is as expected' );
                } );
        } );
 
-       QUnit.test( '#isTalkPage', 8, function( assert ) {
+       QUnit.test( '#isTalkPage', 8, function ( assert ) {
                var testCases = [
                        [ 'Main Page', false ],
                        [ 'San Francisco', false ],
@@ -38,9 +46,11 @@
                        [ 'User talk:Jon', true ],
                        [ 'Special:Nearby', false ]
                ];
-               $.each( testCases, function( i, tc ) {
-                       var p = new Page( { title: tc[0] } );
-                       assert.strictEqual( p.isTalkPage(), tc[1], 'Check test 
is as expected' );
+               $.each( testCases, function ( i, tc ) {
+                       var p = new Page( {
+                               title: tc[ 0 ]
+                       } );
+                       assert.strictEqual( p.isTalkPage(), tc[ 1 ], 'Check 
test is as expected' );
                } );
        } );
 
diff --git a/tests/qunit/test_PageApi.js b/tests/qunit/test_PageApi.js
index 531f85a..b55f5b9 100644
--- a/tests/qunit/test_PageApi.js
+++ b/tests/qunit/test_PageApi.js
@@ -1,37 +1,68 @@
-( function( M, $ ) {
-       var PageApi = M.require( 'PageApi' ), pageApi;
+//jscs:disable jsDoc
+( function ( M, $ ) {
+       var PageApi = M.require( 'PageApi' ),
+               pageApi;
 
        QUnit.module( 'MobileFrontend PageApi', {
-               setup: function() {
+               setup: function () {
                        pageApi = new PageApi();
                }
        } );
 
-       QUnit.test( '#getPage (h1s)', 1, function( assert ) {
+       QUnit.test( '#getPage (h1s)', 1, function ( assert ) {
                this.sandbox.stub( PageApi.prototype, 'get' ).returns( 
$.Deferred().resolve( {
-                       "mobileview": {
-                               "id": -1,
+                       mobileview: {
+                               id: -1,
                                displaytitle: 'Test',
                                revId: 42,
-                               "lastmodifiedby": {
-                                       "name": "bob",
-                                       "gender": "unknown"
+                               lastmodifiedby: {
+                                       name: 'bob',
+                                       gender: 'unknown'
                                },
-                               "protection": [],
-                               "lastmodified": "2013-10-28T18:49:56Z",
-                               "languagecount": 10,
-                               "sections":[
-                                       {"id":0,"text":""},
-                                       
{"level":"1","line":"1","anchor":"1","id":1,"text":"<p>Text of 1\n</p>"},
-                                       
{"level":"2","line":"<i>1.1</i>","anchor":"1.1","id":2,"text":"<p>Text of 
1.1\n</p>"},
-                                       
{"level":"1","line":"2","anchor":"2","id":3,"text":"<p>Text of 2\n</p>"},
-                                       
{"level":"2","line":"2.1","anchor":"2.1","id":4,"text":"<p>Text of 2.1\n</p>"} ]
+                               protection: [],
+                               lastmodified: '2013-10-28T18:49:56Z',
+                               languagecount: 10,
+                               sections: [
+                                       {
+                                               id: 0,
+                                               text: ''
+                                       },
+                                       {
+                                               level: '1',
+                                               line: '1',
+                                               anchor: '1',
+                                               id: 1,
+                                               text: '<p>Text of 1\n</p>'
+                                       },
+                                       {
+                                               level: '2',
+                                               line: '<i>1.1</i>',
+                                               anchor: '1.1',
+                                               id: 2,
+                                               text: '<p>Text of 1.1\n</p>'
+                                       },
+                                       {
+                                               level: '1',
+                                               line: '2',
+                                               anchor: '2',
+                                               id: 3,
+                                               text: '<p>Text of 2\n</p>'
+                                       },
+                                       {
+                                               level: '2',
+                                               line: '2.1',
+                                               anchor: '2.1',
+                                               id: 4,
+                                               text: '<p>Text of 2.1\n</p>'
+                                       } ]
                        }
                } ) );
 
-               pageApi.getPage( 'Test' ).done( function( resp ) {
+               pageApi.getPage( 'Test' ).done( function ( resp ) {
                        assert.deepEqual( resp, {
-                               historyUrl: mw.util.getUrl( 'Test', { action: 
'history' } ),
+                               historyUrl: mw.util.getUrl( 'Test', {
+                                       action: 'history'
+                               } ),
                                lastModifiedUserName: 'bob',
                                lastModifiedUserGender: 'unknown',
                                lastModifiedTimestamp: 1382986196,
@@ -48,25 +79,37 @@
                                lead: '',
                                sections: [
                                        {
-                                               "level": "1",
-                                               "line": "1",
-                                               "anchor": "1",
-                                               "id": 1,
-                                               "text": '<p>Text of 1\n</p><h2 
id="1.1"><i>1.1</i></h2>\n<p>Text of 1.1\n</p>\n',
-                                               "children": [
-                                                       {"level":"2","line": 
"<i>1.1</i>",
-                                                               
"anchor":"1.1","id":2,"text":"<p>Text of 1.1\n</p>", children: [] }
+                                               level: '1',
+                                               line: '1',
+                                               anchor: '1',
+                                               id: 1,
+                                               text: '<p>Text of 1\n</p><h2 
id="1.1"><i>1.1</i></h2>\n<p>Text of 1.1\n</p>\n',
+                                               children: [
+                                                       {
+                                                               level: '2',
+                                                               line: 
'<i>1.1</i>',
+                                                               anchor: '1.1',
+                                                               id: 2,
+                                                               text: '<p>Text 
of 1.1\n</p>',
+                                                               children: []
+                                                       }
                                                ]
                                        },
                                        {
-                                               "level": "1",
-                                               "line": "2",
-                                               "anchor": "2",
-                                               "id": 3,
-                                               "text": '<p>Text of 2\n</p><h2 
id="2.1">2.1</h2>\n<p>Text of 2.1\n</p>\n',
-                                               "children": [
-                                                       
{"level":"2","line":"2.1",
-                                                               
"anchor":"2.1","id":4,"text":"<p>Text of 2.1\n</p>", children: [] }
+                                               level: '1',
+                                               line: '2',
+                                               anchor: '2',
+                                               id: 3,
+                                               text: '<p>Text of 2\n</p><h2 
id="2.1">2.1</h2>\n<p>Text of 2.1\n</p>\n',
+                                               children: [
+                                                       {
+                                                               level: '2',
+                                                               line: '2.1',
+                                                               anchor: '2.1',
+                                                               id: 4,
+                                                               text: '<p>Text 
of 2.1\n</p>',
+                                                               children: []
+                                                       }
                                                ]
                                        }
                                ]
@@ -75,59 +118,64 @@
                PageApi.prototype.get.restore();
        } );
 
-       QUnit.test( '#getPage', 2, function( assert ) {
+       QUnit.test( '#getPage', 2, function ( assert ) {
                this.sandbox.stub( PageApi.prototype, 'get' ).returns( 
$.Deferred().resolve( {
-                       "mobileview": {
-                               "id": -1,
+                       mobileview: {
+                               id: -1,
                                protection: {
                                        edit: [ 'sysop' ]
                                },
-                               "lastmodifiedby": {
-                                       "name": "Melissa",
-                                       "gender": "female"
+                               lastmodifiedby: {
+                                       name: 'Melissa',
+                                       gender: 'female'
                                },
                                revId: 42,
                                displaytitle: 'Test',
-                               "lastmodified": "2013-10-28T18:49:56Z",
-                               "languagecount": 10,
-                               "sections": [
-                                       { "id": 0, "text": "lead content" },
+                               lastmodified: '2013-10-28T18:49:56Z',
+                               languagecount: 10,
+                               sections: [
                                        {
-                                               "level": "2",
-                                               "line": "Aaa section",
-                                               "anchor": "Aaa_section",
-                                               "id": 1,
-                                               "text": "aaa content"
+                                               id: 0,
+                                               text: 'lead content'
                                        },
                                        {
-                                               "level": "3",
-                                               "line": "Subaaa section",
-                                               "anchor": "Subaaa_section",
-                                               "id": 2,
-                                               "text": "subaaa content"
+                                               level: '2',
+                                               line: 'Aaa section',
+                                               anchor: 'Aaa_section',
+                                               id: 1,
+                                               text: 'aaa content'
                                        },
                                        {
-                                               "level": "2",
-                                               "line": "Bbb section",
-                                               "anchor": "Bbb_section",
-                                               "id": 3,
-                                               "text": "bbb content"
+                                               level: '3',
+                                               line: 'Subaaa section',
+                                               anchor: 'Subaaa_section',
+                                               id: 2,
+                                               text: 'subaaa content'
                                        },
                                        {
-                                               "level": "2",
-                                               "line": "References",
-                                               "references": "",
-                                               "anchor": "References",
-                                               "id": 4,
-                                               "text": "references"
+                                               level: '2',
+                                               line: 'Bbb section',
+                                               anchor: 'Bbb_section',
+                                               id: 3,
+                                               text: 'bbb content'
+                                       },
+                                       {
+                                               level: '2',
+                                               line: 'References',
+                                               references: '',
+                                               anchor: 'References',
+                                               id: 4,
+                                               text: 'references'
                                        }
                                ]
                        }
                } ) );
 
-               pageApi.getPage( 'Test' ).done( function( resp ) {
+               pageApi.getPage( 'Test' ).done( function ( resp ) {
                        assert.deepEqual( resp, {
-                               historyUrl: mw.util.getUrl( 'Test', { action: 
'history' } ),
+                               historyUrl: mw.util.getUrl( 'Test', {
+                                       action: 'history'
+                               } ),
                                lastModifiedUserName: 'Melissa',
                                lastModifiedUserGender: 'female',
                                lastModifiedTimestamp: 1382986196,
@@ -144,38 +192,38 @@
                                lead: 'lead content',
                                sections: [
                                        {
-                                               "level": "2",
-                                               "line": "Aaa section",
-                                               "anchor": "Aaa_section",
-                                               "id": 1,
-                                               "text": 'aaa content<h3 
id="Subaaa_section">Subaaa section</h3>\nsubaaa content\n',
-                                               "children": [
+                                               level: '2',
+                                               line: 'Aaa section',
+                                               anchor: 'Aaa_section',
+                                               id: 1,
+                                               text: 'aaa content<h3 
id="Subaaa_section">Subaaa section</h3>\nsubaaa content\n',
+                                               children: [
                                                        {
-                                                               "level": "3",
-                                                               "line": "Subaaa 
section",
-                                                               "anchor": 
"Subaaa_section",
-                                                               "id": 2,
-                                                               "text": "subaaa 
content",
-                                                               "children": []
+                                                               level: '3',
+                                                               line: 'Subaaa 
section',
+                                                               anchor: 
'Subaaa_section',
+                                                               id: 2,
+                                                               text: 'subaaa 
content',
+                                                               children: []
                                                        }
                                                ]
                                        },
                                        {
-                                               "level": "2",
-                                               "line": "Bbb section",
-                                               "anchor": "Bbb_section",
-                                               "id": 3,
-                                               "text": "bbb content",
-                                               "children": []
+                                               level: '2',
+                                               line: 'Bbb section',
+                                               anchor: 'Bbb_section',
+                                               id: 3,
+                                               text: 'bbb content',
+                                               children: []
                                        },
                                        {
-                                               "level": "2",
-                                               "line": "References",
-                                               "references": "",
-                                               "anchor": "References",
-                                               "id": 4,
-                                               "text": "references",
-                                               "children": []
+                                               level: '2',
+                                               line: 'References',
+                                               references: '',
+                                               anchor: 'References',
+                                               id: 4,
+                                               text: 'references',
+                                               children: []
                                        }
                                ]
                        }, 'return lead and sections test 2' );
@@ -186,118 +234,118 @@
                PageApi.prototype.get.restore();
        } );
 
-       QUnit.test( '#getPageLanguages', 2, function( assert ) {
+       QUnit.test( '#getPageLanguages', 2, function ( assert ) {
                this.sandbox.stub( PageApi.prototype, 'get' ).returns( 
$.Deferred().resolve( {
-                       "query":{
-                               "pages":{
-                                       "94":{
-                                               "pageid":94,
-                                               "ns":0,
-                                               "title":"San Francisco",
-                                               "langlinks":[
+                       query: {
+                               pages: {
+                                       94: {
+                                               pageid: 94,
+                                               ns: 0,
+                                               title: 'San Francisco',
+                                               langlinks: [
                                                        {
-                                                               "lang":"es",
-                                                               
"url":"http://es.wikipedia.org/wiki/San_Francisco_(California)",
-                                                               "*":"San 
Francisco (California)"
+                                                               lang: 'es',
+                                                               url: 
'http://es.wikipedia.org/wiki/San_Francisco_(California)',
+                                                               '*': 'San 
Francisco (California)'
                                                        },
                                                        {
-                                                               "lang":"pl",
-                                                               
"url":"http://pl.wikipedia.org/wiki/San_Francisco";,
-                                                               "*":"San 
Francisco"
+                                                               lang: 'pl',
+                                                               url: 
'http://pl.wikipedia.org/wiki/San_Francisco',
+                                                               '*': 'San 
Francisco'
                                                        },
                                                        {
-                                                               "lang":"sr",
-                                                               
"url":"http://sr.wikipedia.org/wiki/%D0%A1%D0%B0%D0%BD_%D0%A4%D1%80%D0%B0%D0%BD%D1%86%D0%B8%D1%81%D0%BA%D0%BE";,
-                                                               
"*":"\u0421\u0430\u043d \u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e"
+                                                               lang: 'sr',
+                                                               url: 
'http://sr.wikipedia.org/wiki/%D0%A1%D0%B0%D0%BD_%D0%A4%D1%80%D0%B0%D0%BD%D1%86%D0%B8%D1%81%D0%BA%D0%BE',
+                                                               '*': 
'\u0421\u0430\u043d \u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e'
                                                        }
                                                ]
                                        }
                                },
-                               "general": {
-                                       "variants": [
+                               general: {
+                                       variants: [
                                                {
-                                                       "code": "sr",
-                                                       "name": "sr"
+                                                       code: 'sr',
+                                                       name: 'sr'
                                                },
                                                {
-                                                       "code": "sr-ec",
-                                                       "name": 
"\u040b\u0438\u0440\u0438\u043b\u0438\u0446\u0430"
+                                                       code: 'sr-ec',
+                                                       name: 
'\u040b\u0438\u0440\u0438\u043b\u0438\u0446\u0430'
                                                },
                                                {
-                                                       "code": "sr-el",
-                                                       "name": "Latinica"
+                                                       code: 'sr-el',
+                                                       name: 'Latinica'
                                                }
                                        ],
-                                       "variantarticlepath": "/$2/$1"
+                                       variantarticlepath: '/$2/$1'
                                },
-                               "languages": [
+                               languages: [
                                        {
-                                               "code": "sr",
-                                               "*": 
"\u0441\u0440\u043f\u0441\u043a\u0438 / srpski"
+                                               code: 'sr',
+                                               '*': 
'\u0441\u0440\u043f\u0441\u043a\u0438 / srpski'
                                        },
                                        {
-                                               "code": "sr-ec",
-                                               "*": 
"\u0441\u0440\u043f\u0441\u043a\u0438 
(\u045b\u0438\u0440\u0438\u043b\u0438\u0446\u0430)\u200e"
+                                               code: 'sr-ec',
+                                               '*': 
'\u0441\u0440\u043f\u0441\u043a\u0438 
(\u045b\u0438\u0440\u0438\u043b\u0438\u0446\u0430)\u200e'
                                        },
                                        {
-                                               "code": "sr-el",
-                                               "*": "srpski (latinica)\u200e"
+                                               code: 'sr-el',
+                                               '*': 'srpski (latinica)\u200e'
                                        },
                                        {
-                                               "code": "es",
-                                               "*": "espa\u00f1ol"
+                                               code: 'es',
+                                               '*': 'espa\u00f1ol'
                                        },
                                        {
-                                               "code": "pl",
-                                               "*": "polski"
+                                               code: 'pl',
+                                               '*': 'polski'
                                        }
                                ]
                        },
-                       "limits":{
-                               "langlinks":500
+                       limits: {
+                               langlinks: 500
                        }
                } ) );
 
-               pageApi.getPageLanguages( 'Test' ).done( function( resp ) {
+               pageApi.getPageLanguages( 'Test' ).done( function ( resp ) {
                        assert.deepEqual( resp.languages, [
                                {
-                                       "lang":"es",
-                                       
"url":"http://es.wikipedia.org/wiki/San_Francisco_(California)",
-                                       "*":"San Francisco (California)",
-                                       "title":"San Francisco (California)",
-                                       langname: "espa\u00f1ol"
+                                       lang: 'es',
+                                       url: 
'http://es.wikipedia.org/wiki/San_Francisco_(California)',
+                                       '*': 'San Francisco (California)',
+                                       title: 'San Francisco (California)',
+                                       langname: 'espa\u00f1ol'
                                },
                                {
-                                       "lang":"pl",
-                                       
"url":"http://pl.wikipedia.org/wiki/San_Francisco";,
-                                       "*":"San Francisco",
-                                       "title":"San Francisco",
-                                       langname: "polski"
+                                       lang: 'pl',
+                                       url: 
'http://pl.wikipedia.org/wiki/San_Francisco',
+                                       '*': 'San Francisco',
+                                       title: 'San Francisco',
+                                       langname: 'polski'
                                },
                                {
-                                       "lang":"sr",
-                                       
"url":"http://sr.wikipedia.org/wiki/%D0%A1%D0%B0%D0%BD_%D0%A4%D1%80%D0%B0%D0%BD%D1%86%D0%B8%D1%81%D0%BA%D0%BE";,
-                                       "*":"\u0421\u0430\u043d 
\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e",
-                                       "title":"\u0421\u0430\u043d 
\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e",
-                                       langname: 
"\u0441\u0440\u043f\u0441\u043a\u0438 / srpski"
+                                       lang: 'sr',
+                                       url: 
'http://sr.wikipedia.org/wiki/%D0%A1%D0%B0%D0%BD_%D0%A4%D1%80%D0%B0%D0%BD%D1%86%D0%B8%D1%81%D0%BA%D0%BE',
+                                       '*': '\u0421\u0430\u043d 
\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e',
+                                       title: '\u0421\u0430\u043d 
\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e',
+                                       langname: 
'\u0441\u0440\u043f\u0441\u043a\u0438 / srpski'
                                }
                        ], 'return augmented language links' );
 
                        assert.deepEqual( resp.variants, [
                                {
-                                       "lang":"sr",
-                                       "langname":"sr",
-                                       "url":"/sr/Test"
+                                       lang: 'sr',
+                                       langname: 'sr',
+                                       url: '/sr/Test'
                                },
                                {
-                                       "lang":"sr-ec",
-                                       
"langname":"\u040b\u0438\u0440\u0438\u043b\u0438\u0446\u0430",
-                                       "url":"/sr-ec/Test"
+                                       lang: 'sr-ec',
+                                       langname: 
'\u040b\u0438\u0440\u0438\u043b\u0438\u0446\u0430',
+                                       url: '/sr-ec/Test'
                                },
                                {
-                                       "lang":"sr-el",
-                                       "langname":"Latinica",
-                                       "url":"/sr-el/Test"
+                                       lang: 'sr-el',
+                                       langname: 'Latinica',
+                                       url: '/sr-el/Test'
                                }
                        ], 'return augmented language variant links' );
                } );
@@ -305,53 +353,111 @@
                PageApi.prototype.get.restore();
        } );
 
-       QUnit.test( '#_getAPIResponseFromHTML', 1, function( assert ) {
+       QUnit.test( '#_getAPIResponseFromHTML', 1, function ( assert ) {
                var resp = pageApi._getAPIResponseFromHTML( $( '<div><h1><span 
id="1.0">A1</span></h1><h2><span>A2.1</span></h2><h2><span>A2.2</span></h2><h1><span>A2</span></h1><h2><span>A2.1</span></h2></div>'
 ) );
                assert.deepEqual( resp, [
-                       { line: 'A1', level: '1', anchor: '1.0', text: '' },
-                       { line: 'A2.1', level: '2', anchor: '', text: '' },
-                       { line: 'A2.2', level: '2', anchor: '', text: '' },
-                       { line: 'A2', level: '1', anchor: '', text: '' },
-                       { line: 'A2.1', level: '2', anchor: '', text: '' }
+                       {
+                               line: 'A1',
+                               level: '1',
+                               anchor: '1.0',
+                               text: ''
+                       },
+                       {
+                               line: 'A2.1',
+                               level: '2',
+                               anchor: '',
+                               text: ''
+                       },
+                       {
+                               line: 'A2.2',
+                               level: '2',
+                               anchor: '',
+                               text: ''
+                       },
+                       {
+                               line: 'A2',
+                               level: '1',
+                               anchor: '',
+                               text: ''
+                       },
+                       {
+                               line: 'A2.1',
+                               level: '2',
+                               anchor: '',
+                               text: ''
+                       }
                ] );
        } );
 
-       QUnit.test( '#getSectionsFromHTML malformed (h2 before h1)', 1, 
function( assert ) {
+       QUnit.test( '#getSectionsFromHTML malformed (h2 before h1)', 1, 
function ( assert ) {
                var resp = pageApi.getSectionsFromHTML(
                        $( '<div><h2><span 
id="1.0">A1</span></h2><h3><span>A2.1</span></h3><h2><span>A2.2</span></h2><h1><span>A2</span></h1><h2><span>A2.1</span></h2></div>'
 ) );
                assert.deepEqual( resp, [
-                       { line: 'A1', level: '2', anchor: '1.0', text: '<h3 
id="">A2.1</h3>\n\n', children: [{
-                               line: 'A2.1', level: '3', anchor: '', text: '', 
children: [] }] },
-                       { line: 'A2.2', level: '2', anchor: '', text: '', 
children: [] },
-                       { line: 'A2', level: '1', anchor: '', text: '<h2 
id="">A2.1</h2>\n\n', children: [{
-                               line: 'A2.1', level: '2', anchor: '', text: '', 
children: [] }] }
+                       {
+                               line: 'A1',
+                               level: '2',
+                               anchor: '1.0',
+                               text: '<h3 id="">A2.1</h3>\n\n',
+                               children: [ {
+                                       line: 'A2.1',
+                                       level: '3',
+                                       anchor: '',
+                                       text: '',
+                                       children: []
+                               } ]
+                       },
+                       {
+                               line: 'A2.2',
+                               level: '2',
+                               anchor: '',
+                               text: '',
+                               children: []
+                       },
+                       {
+                               line: 'A2',
+                               level: '1',
+                               anchor: '',
+                               text: '<h2 id="">A2.1</h2>\n\n',
+                               children: [ {
+                                       line: 'A2.1',
+                                       level: '2',
+                                       anchor: '',
+                                       text: '',
+                                       children: []
+                               } ]
+                       }
                ] );
        } );
 
-       QUnit.test( '#getPage (move protected page)', 1, function( assert ) {
+       QUnit.test( '#getPage (move protected page)', 1, function ( assert ) {
                var expected = {
                        edit: [ '*' ],
                        move: [ 'sysop' ]
                };
                this.sandbox.stub( PageApi.prototype, 'get' ).returns( 
$.Deferred().resolve( {
-                       "mobileview": {
-                               "id": -1,
+                       mobileview: {
+                               id: -1,
                                displaytitle: 'Test',
                                revId: 42,
-                               "lastmodifiedby": {
-                                       "name": "bob",
-                                       "gender": "unknown"
+                               lastmodifiedby: {
+                                       name: 'bob',
+                                       gender: 'unknown'
                                },
-                               "protection": { "move":["sysop"] },
-                               "lastmodified": "2013-10-28T18:49:56Z",
-                               "languagecount": 10,
-                               "sections":[
-                                       {"id":0,"text":""}
+                               protection: {
+                                       move: [ 'sysop' ]
+                               },
+                               lastmodified: '2013-10-28T18:49:56Z',
+                               languagecount: 10,
+                               sections: [
+                                       {
+                                               id: 0,
+                                               text: ''
+                                       }
                                ]
                        }
                } ) );
 
-               pageApi.getPage( 'Test' ).done( function( resp ) {
+               pageApi.getPage( 'Test' ).done( function ( resp ) {
                        assert.deepEqual( resp.protection, expected );
                } );
        } );
diff --git a/tests/qunit/test_Router.js b/tests/qunit/test_Router.js
index eec1483..d834848 100644
--- a/tests/qunit/test_Router.js
+++ b/tests/qunit/test_Router.js
@@ -1,5 +1,8 @@
-( function( M, $ ) {
-       var Router = M.require( 'Router' ), hashQueue = [], interval, router;
+//jscs:disable jsDoc
+( function ( M, $ ) {
+       var Router = M.require( 'Router' ),
+               hashQueue = [],
+               interval, router;
 
        // we can't change hash too quickly because hashchange callbacks are 
async
        // (don't fire immediately after the hash is changed) and all the 
callbacks
@@ -9,9 +12,9 @@
        }
 
        QUnit.module( 'MobileFrontend Router', {
-               setup: function() {
+               setup: function () {
                        router = new Router();
-                       interval = setInterval( function() {
+                       interval = setInterval( function () {
                                var hash = hashQueue.pop();
                                if ( hash !== undefined ) {
                                        window.location.hash = hash;
@@ -19,9 +22,9 @@
                        }, 10 );
                },
 
-               teardown: function() {
+               teardown: function () {
                        // hashchange is async, we need to wait
-                       $( window ).one( 'hashchange.test', function() {
+                       $( window ).one( 'hashchange.test', function () {
                                $( window ).off( 'hashchange.test' );
                                clearInterval( interval );
                                QUnit.start();
@@ -31,16 +34,16 @@
                }
        } );
 
-       QUnit.asyncTest( '#route, string', 1, function( assert ) {
-               router.route( 'teststring', function() {
+       QUnit.asyncTest( '#route, string', 1, function ( assert ) {
+               router.route( 'teststring', function () {
                        assert.ok( true, 'run callback for route' );
                        QUnit.start();
                } );
                setHash( '#teststring' );
        } );
 
-       QUnit.asyncTest( '#route, RegExp', 1, function( assert ) {
-               router.route( /^testre-(\d+)$/, function( param ) {
+       QUnit.asyncTest( '#route, RegExp', 1, function ( assert ) {
+               router.route( /^testre-(\d+)$/, function ( param ) {
                        assert.strictEqual( param, '123', 'run callback for 
route with correct params' );
                        QUnit.start();
                } );
@@ -48,31 +51,32 @@
                setHash( '#testre-123' );
        } );
 
-       QUnit.asyncTest( 'on route', 2, function( assert ) {
-               var count = 0, spy = this.sandbox.spy();
+       QUnit.asyncTest( 'on route', 2, function ( assert ) {
+               var count = 0,
+                       spy = this.sandbox.spy();
 
                router.route( 'testprevent', spy );
 
                // try preventing second route (#testprevent)
-               router.once( 'route', function() {
+               router.once( 'route', function () {
                        setHash( '#testprevent' );
-                       router.once( 'route', function( ev ) {
+                       router.once( 'route', function ( ev ) {
                                ev.preventDefault();
                        } );
                } );
                setHash( '#initial' );
 
-               $( window ).on( 'hashchange.test', function() {
+               $( window ).on( 'hashchange.test', function () {
                        ++count;
                        if ( count === 3 ) {
                                assert.strictEqual( window.location.hash, 
'#initial', 'reset hash' );
-                               assert.ok( !spy.called, "don't run callback for 
prevented route" );
+                               assert.ok( !spy.called, 'don\'t run callback 
for prevented route' );
                                QUnit.start();
                        }
                } );
        } );
 
-       QUnit.asyncTest( 'on back', 2, function( assert ) {
+       QUnit.asyncTest( 'on back', 2, function ( assert ) {
                router.back().done( function () {
                        assert.ok( true, 'back 1 complete' );
                } );
diff --git a/tests/qunit/test_Schema.js b/tests/qunit/test_Schema.js
index c3ecbad..6d66442 100644
--- a/tests/qunit/test_Schema.js
+++ b/tests/qunit/test_Schema.js
@@ -1,3 +1,4 @@
+//jscs:disable jsDoc
 ( function ( $, M ) {
        var Schema = M.require( 'Schema' );
 
diff --git a/tests/qunit/test_Skin.js b/tests/qunit/test_Skin.js
index 84ef27d..b9f883d 100644
--- a/tests/qunit/test_Skin.js
+++ b/tests/qunit/test_Skin.js
@@ -1,8 +1,9 @@
-( function( M, $ ) {
+//jscs:disable jsDoc
+( function ( M, $ ) {
        var Skin = M.require( 'Skin' );
 
        QUnit.module( 'MobileFrontend Skin.js', {
-               setup: function() {
+               setup: function () {
                        this.$el = $( '<div>' );
                        this.skin = new Skin( {
                                el: this.$el
@@ -10,7 +11,7 @@
                }
        } );
 
-       QUnit.test( '#setupPositionFixedEmulation', 1, function( assert ) {
+       QUnit.test( '#setupPositionFixedEmulation', 1, function ( assert ) {
                this.skin.setupPositionFixedEmulation();
                assert.strictEqual( this.$el.hasClass( 'no-position-fixed' ), 
true,
                        'Skin is marked as working in emulated mode.' );
diff --git a/tests/qunit/test_api.js b/tests/qunit/test_api.js
index 6c2437b..6cfbf37 100644
--- a/tests/qunit/test_api.js
+++ b/tests/qunit/test_api.js
@@ -1,158 +1,203 @@
-( function ( M, $) {
+//jscs:disable jsDoc
+( function ( M, $ ) {
+       var Api = M.require( 'api' ).Api,
+               stub, tokens;
 
-var Api = M.require( 'api' ).Api, stub, tokens;
+       QUnit.module( 'MobileFrontend api', {
+               setup: function () {
+                       var self = this,
+                               server = this.sandbox.useFakeServer();
+                       server.xhr.onCreate = function ( xhr ) {
+                               // FIXME: smelly, sinon.extend and 
sinon.EventTarget are not public interface
+                               xhr.upload = window.sinon.extend( {}, 
window.sinon.EventTarget );
+                               self.lastXhr = xhr;
+                       };
+               }
+       } );
 
-QUnit.module( 'MobileFrontend api', {
-       setup: function() {
-               var self = this, server = this.sandbox.useFakeServer();
-               server.xhr.onCreate = function( xhr ) {
-                       // FIXME: smelly, sinon.extend and sinon.EventTarget 
are not public interface
-                       xhr.upload = window.sinon.extend( {}, 
window.sinon.EventTarget );
-                       self.lastXhr = xhr;
-               };
-       }
-} );
+       QUnit.test( 'default instance', 1, function ( assert ) {
+               assert.ok( M.require( 'api' ) instanceof Api, 'return default 
instance' );
+       } );
 
-QUnit.test( 'default instance', 1, function( assert ) {
-       assert.ok( M.require( 'api' ) instanceof Api, 'return default instance' 
);
-} );
+       QUnit.test( 'progress event', 1, function ( assert ) {
+               var spy = this.sandbox.spy(),
+                       api = new Api(),
+                       request;
 
-QUnit.test( 'progress event', 1, function( assert ) {
-       var spy = this.sandbox.spy(), api = new Api(), request;
-
-       api.on( 'progress', spy );
-       request = api.post();
-       this.lastXhr.upload.dispatchEvent( { type: 'progress', 
lengthComputable: true, loaded: 1, total: 2 } );
-       assert.ok( spy.calledWith( request, 0.5 ),  'emit progress event' );
-} );
-
-QUnit.module( 'MobileFrontend api.Api', {
-       setup: function() {
-               var self = this, requests = this.requests = [];
-               this.api = new Api();
-               this.sandbox.stub( mw.Api.prototype, 'ajax', function() {
-                       var request = $.extend( { abort: self.sandbox.spy() }, 
$.Deferred() );
-                       requests.push( request );
-                       return request;
+               api.on( 'progress', spy );
+               request = api.post();
+               this.lastXhr.upload.dispatchEvent( {
+                       type: 'progress',
+                       lengthComputable: true,
+                       loaded: 1,
+                       total: 2
                } );
-       }
-} );
-
-QUnit.test( '#ajax', 1, function( assert ) {
-       this.api.ajax( {
-               falseBool: false,
-               trueBool: true,
-               list: [ 'one', 2, 'three' ],
-               normal: 'test'
+               assert.ok( spy.calledWith( request, 0.5 ), 'emit progress 
event' );
        } );
-       assert.ok(
-               mw.Api.prototype.ajax.calledWithMatch( {
+
+       QUnit.module( 'MobileFrontend api.Api', {
+               setup: function () {
+                       var self = this,
+                               requests = this.requests = [];
+                       this.api = new Api();
+                       this.sandbox.stub( mw.Api.prototype, 'ajax', function 
() {
+                               var request = $.extend( {
+                                       abort: self.sandbox.spy()
+                               }, $.Deferred() );
+                               requests.push( request );
+                               return request;
+                       } );
+               }
+       } );
+
+       QUnit.test( '#ajax', 1, function ( assert ) {
+               this.api.ajax( {
+                       falseBool: false,
                        trueBool: true,
-                       list: 'one|2|three',
+                       list: [ 'one', 2, 'three' ],
                        normal: 'test'
-               } ),
-               'set defaults and transform boolean and array data'
-       );
-} );
-
-QUnit.test( '#abort', 2, function( assert ) {
-       this.api.get( { a: 1 } );
-       this.api.post( { b: 2 } );
-       this.api.abort();
-       $.each( this.requests, function( i, request ) {
-               assert.ok( request.abort.calledOnce, 'abort request number ' + 
i );
-       } );
-} );
-
-QUnit.module( 'MobileFrontend api.getToken', {
-       setup: function() {
-               var params, corsParams, corsData,
-                       editDeferred = $.Deferred().resolve( { tokens: { 
'edittoken': '123' } } ),
-                       uploadAnonDeferred = $.Deferred().resolve( { tokens: { 
'uploadtoken': '+\\' } } ),
-                       corsDeferred = $.Deferred().resolve( { tokens: { 
'watchtoken': 'zyx' } } ),
-                       warningDeferred = $.Deferred().resolve( { warning: 'you 
passed a bad watch token' } );
-
-               this.api = new Api();
-               stub = this.sandbox.stub( this.api , 'ajax' );
-               tokens = {
-                       editToken: mw.user.tokens.get( 'editToken' ),
-                       watchToken: mw.user.tokens.get( 'watchToken' )
-               };
-               params = {
-                       url: this.api.apiUrl,
-                       xhrFields: { withCredentials: true }
-               };
-               corsData = { action: 'tokens', type: 'watch',
-                       origin: this.api.getOrigin()
-               };
-               corsParams = {
-                       url: 'http://commons.wikimedia.org/w/api.php',
-                       xhrFields: { withCredentials: true }
-               };
-
-               stub.withArgs( { action: 'tokens', type: 'rainbows' }, params 
).returns( warningDeferred );
-               stub.withArgs( { action: 'tokens', type: 'edit' }, params 
).returns( editDeferred );
-               stub.withArgs( { action: 'tokens', type: 'upload' }, params 
).returns( uploadAnonDeferred );
-               stub.withArgs( corsData, corsParams ).returns( corsDeferred );
-               this.user = mw.user.getName() || '';
-               mw.user.tokens.set( 'editToken', '123' );
-               mw.user.tokens.set( 'watchToken', 'zyx' );
-               mw.config.set( 'wgUserName', 'EvilPanda' );
-       },
-       teardown: function() {
-               stub.restore();
-               mw.user.tokens.set( 'editToken', tokens.editToken );
-               mw.user.tokens.set( 'watchToken', tokens.watchToken );
-               mw.config.set( 'wgUserName', this.user );
-       }
-} );
-
-QUnit.test( '#getTokenWithEndpoint - successful edit token', 1, function( 
assert ) {
-       this.api.getTokenWithEndpoint( 'edit' ).done( function( token ) {
-               assert.strictEqual( token, '123', 'Got token' );
-       } );
-} );
-
-QUnit.test( '#getTokenWithEndpoint - load from cache', 2, function( assert ) {
-       this.api.getTokenWithEndpoint( 'edit' );
-       this.api.getTokenWithEndpoint( 'edit' ).done( function( token ) { // 
this comes via cache
-               assert.strictEqual( token, '123', 'Test for bad token name' );
+               } );
+               assert.ok(
+                       mw.Api.prototype.ajax.calledWithMatch( {
+                               trueBool: true,
+                               list: 'one|2|three',
+                               normal: 'test'
+                       } ),
+                       'set defaults and transform boolean and array data'
+               );
        } );
 
-       assert.strictEqual( stub.getCall( 1 ), null, 'Ajax stub was only called 
once' );
-} );
-
-QUnit.test( '#getTokenWithEndpoint - cors edit token', 1, function( assert ) {
-       this.api.getTokenWithEndpoint( 'watch', 
'http://commons.wikimedia.org/w/api.php' ).done( function( token ) {
-               assert.strictEqual( token, 'zyx', 'Correctly passed via cors' );
+       QUnit.test( '#abort', 2, function ( assert ) {
+               this.api.get( {
+                       a: 1
+               } );
+               this.api.post( {
+                       b: 2
+               } );
+               this.api.abort();
+               $.each( this.requests, function ( i, request ) {
+                       assert.ok( request.abort.calledOnce, 'abort request 
number ' + i );
+               } );
        } );
-} );
 
-QUnit.test( '#getTokenWithEndpoint - default to edit', 1, function( assert ) {
-       this.api.getTokenWithEndpoint().done( function( token ) {
-               assert.strictEqual( token, '123', 'We get an edit token by 
default (most common)' );
-       } );
-} );
+       QUnit.module( 'MobileFrontend api.getToken', {
+               setup: function () {
+                       var params, corsParams, corsData,
+                               editDeferred = $.Deferred().resolve( {
+                                       tokens: {
+                                               edittoken: '123'
+                                       }
+                               } ),
+                               uploadAnonDeferred = $.Deferred().resolve( {
+                                       tokens: {
+                                               uploadtoken: '+\\'
+                                       }
+                               } ),
+                               corsDeferred = $.Deferred().resolve( {
+                                       tokens: {
+                                               watchtoken: 'zyx'
+                                       }
+                               } ),
+                               warningDeferred = $.Deferred().resolve( {
+                                       warning: 'you passed a bad watch token'
+                               } );
 
-QUnit.test( '#getTokenWithEndpoint - get anon token (stable)', 1, function( 
assert ) {
-       mw.config.set( 'wgMFEditorOptions', {
-               'anonymousEditing': false
-       } );
-       this.api.getTokenWithEndpoint( 'upload' ).fail( function( msg ) {
-               assert.strictEqual( msg, 'Anonymous token.', 'No token given - 
user must be anon' );
-       } );
-} );
+                       this.api = new Api();
+                       stub = this.sandbox.stub( this.api, 'ajax' );
+                       tokens = {
+                               editToken: mw.user.tokens.get( 'editToken' ),
+                               watchToken: mw.user.tokens.get( 'watchToken' )
+                       };
+                       params = {
+                               url: this.api.apiUrl,
+                               xhrFields: {
+                                       withCredentials: true
+                               }
+                       };
+                       corsData = {
+                               action: 'tokens',
+                               type: 'watch',
+                               origin: this.api.getOrigin()
+                       };
+                       corsParams = {
+                               url: 'http://commons.wikimedia.org/w/api.php',
+                               xhrFields: {
+                                       withCredentials: true
+                               }
+                       };
 
-QUnit.test ( '#getTokenWithEndpoint - get anon token (alpha)', 1, function( 
assert ) {
-       this.api.getTokenWithEndpoint( 'edit' ).done( function( token ) {
-               assert.strictEqual( token, '123', 'Got a token for anonymous 
editing' );
+                       stub.withArgs( {
+                               action: 'tokens',
+                               type: 'rainbows'
+                       }, params ).returns( warningDeferred );
+                       stub.withArgs( {
+                               action: 'tokens',
+                               type: 'edit'
+                       }, params ).returns( editDeferred );
+                       stub.withArgs( {
+                               action: 'tokens',
+                               type: 'upload'
+                       }, params ).returns( uploadAnonDeferred );
+                       stub.withArgs( corsData, corsParams ).returns( 
corsDeferred );
+                       this.user = mw.user.getName() || '';
+                       mw.user.tokens.set( 'editToken', '123' );
+                       mw.user.tokens.set( 'watchToken', 'zyx' );
+                       mw.config.set( 'wgUserName', 'EvilPanda' );
+               },
+               teardown: function () {
+                       stub.restore();
+                       mw.user.tokens.set( 'editToken', tokens.editToken );
+                       mw.user.tokens.set( 'watchToken', tokens.watchToken );
+                       mw.config.set( 'wgUserName', this.user );
+               }
        } );
-});
 
-QUnit.test( '#getToken - bad type of token', 1, function( assert ) {
-       this.api.getTokenWithEndpoint( 'rainbows' ).fail( function( msg ) {
-               assert.strictEqual( msg, 'Bad token name.', 'Test for bad token 
name' );
+       QUnit.test( '#getTokenWithEndpoint - successful edit token', 1, 
function ( assert ) {
+               this.api.getTokenWithEndpoint( 'edit' ).done( function ( token 
) {
+                       assert.strictEqual( token, '123', 'Got token' );
+               } );
        } );
-} );
 
-}( mw.mobileFrontend, jQuery) );
+       QUnit.test( '#getTokenWithEndpoint - load from cache', 2, function ( 
assert ) {
+               this.api.getTokenWithEndpoint( 'edit' );
+               this.api.getTokenWithEndpoint( 'edit' ).done( function ( token 
) { // this comes via cache
+                       assert.strictEqual( token, '123', 'Test for bad token 
name' );
+               } );
+
+               assert.strictEqual( stub.getCall( 1 ), null, 'Ajax stub was 
only called once' );
+       } );
+
+       QUnit.test( '#getTokenWithEndpoint - cors edit token', 1, function ( 
assert ) {
+               this.api.getTokenWithEndpoint( 'watch', 
'http://commons.wikimedia.org/w/api.php' ).done( function ( token ) {
+                       assert.strictEqual( token, 'zyx', 'Correctly passed via 
cors' );
+               } );
+       } );
+
+       QUnit.test( '#getTokenWithEndpoint - default to edit', 1, function ( 
assert ) {
+               this.api.getTokenWithEndpoint().done( function ( token ) {
+                       assert.strictEqual( token, '123', 'We get an edit token 
by default (most common)' );
+               } );
+       } );
+
+       QUnit.test( '#getTokenWithEndpoint - get anon token (stable)', 1, 
function ( assert ) {
+               mw.config.set( 'wgMFEditorOptions', {
+                       anonymousEditing: false
+               } );
+               this.api.getTokenWithEndpoint( 'upload' ).fail( function ( msg 
) {
+                       assert.strictEqual( msg, 'Anonymous token.', 'No token 
given - user must be anon' );
+               } );
+       } );
+
+       QUnit.test( '#getTokenWithEndpoint - get anon token (alpha)', 1, 
function ( assert ) {
+               this.api.getTokenWithEndpoint( 'edit' ).done( function ( token 
) {
+                       assert.strictEqual( token, '123', 'Got a token for 
anonymous editing' );
+               } );
+       } );
+
+       QUnit.test( '#getToken - bad type of token', 1, function ( assert ) {
+               this.api.getTokenWithEndpoint( 'rainbows' ).fail( function ( 
msg ) {
+                       assert.strictEqual( msg, 'Bad token name.', 'Test for 
bad token name' );
+               } );
+       } );
+
+}( mw.mobileFrontend, jQuery ) );
diff --git a/tests/qunit/test_application.js b/tests/qunit/test_application.js
index 887bf54..bc9e821 100644
--- a/tests/qunit/test_application.js
+++ b/tests/qunit/test_application.js
@@ -1,3 +1,4 @@
+//jscs:disable jsDoc
 ( function ( $, M ) {
        QUnit.module( 'MobileFrontend modules' );
 
@@ -8,7 +9,7 @@
                                M.define( 'testModule1', 'again' );
                        },
                        /already exists/,
-                       "throws an error when module already exists"
+                       'throws an error when module already exists'
                );
        } );
 
@@ -18,7 +19,7 @@
                                M.require( 'dummy' );
                        },
                        /not found/,
-                       "throws an error when module doesn't exist"
+                       'throws an error when module doesn\'t exist'
                );
                M.define( 'testModule2', 'test module 2' );
                assert.strictEqual( M.require( 'testModule2' ), 'test module 2' 
);
diff --git a/tests/qunit/test_browser.js b/tests/qunit/test_browser.js
index cc46f2b..5089c94 100644
--- a/tests/qunit/test_browser.js
+++ b/tests/qunit/test_browser.js
@@ -1,3 +1,4 @@
+//jscs:disable jsDoc
 ( function ( $, M ) {
        var Browser = M.require( 'Browser' ),
                $html = $( 'html' );
@@ -65,11 +66,9 @@
        } );
 
        QUnit.test( 'Methods are cached', 15, function ( assert ) {
-               /** @ignore */
                function cache( obj, method ) {
                        return obj[ '__cache' + obj[ method ].cacheId ];
                }
-               /** @ignore */
                function keys( obj ) {
                        return $.map( obj, function ( key ) {
                                return key;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic21f10a3de12e2e5bd13e7ba90f045cc94a54b68
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>

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

Reply via email to