Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/54507
Change subject: Fix jshintrc for jenkins
......................................................................
Fix jshintrc for jenkins
Cleanup whitespace
Make sure jshint runs on tests with the config file
Remove unused variables
Change-Id: I47d1a98fa3dc4b6ed2f33bcff28fd726ea882e06
---
M .jshintrc
M Makefile
M javascripts/actions/mf-edit.js
M javascripts/modules/mf-search.js
M javascripts/modules/mf-toggle.js
M tests/js/test_application.js
M tests/js/test_mf-watchstar.js
M tests/js/test_settings.js
M tests/js/test_toggle.js
9 files changed, 21 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/07/54507/1
diff --git a/.jshintrc b/.jshintrc
index 8d2ecfb..faadc4f 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -3,6 +3,7 @@
"console": true,
"jQuery": true,
"Hogan": true,
+ "QUnit": true,
"mw": true,
"mwMobileFrontendConfig": true,
diff --git a/Makefile b/Makefile
index 726b81a..347bc8e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
.PHONY: less
jshinttests:
- jshint tests/js/*
+ jshint tests/js/* --config .jshintrc
jshint: jshinttests
jshint javascripts/* --config .jshintrc
diff --git a/javascripts/actions/mf-edit.js b/javascripts/actions/mf-edit.js
index 0ae65e3..daffe62 100644
--- a/javascripts/actions/mf-edit.js
+++ b/javascripts/actions/mf-edit.js
@@ -7,7 +7,7 @@
var $section = $( '<div class="section">' ).insertBefore(
$editArea ),
$heading = $( '<h2 class="section_heading">' ).attr(
'id', 'section_edit' + sectionId ),
$content = $( '<div class="content_block">' );
-
+
if ( sectionId > 0 ) {
$section.append( $heading );
$content.attr( { 'id': 'content_edit' + sectionId } );
diff --git a/javascripts/modules/mf-search.js b/javascripts/modules/mf-search.js
index fa5625a..0e87eb7 100644
--- a/javascripts/modules/mf-search.js
+++ b/javascripts/modules/mf-search.js
@@ -18,7 +18,7 @@
apiUrl = M.getApiUrl();
- function removeResults( ev, silently ) {
+ function removeResults( silently ) {
if ( !silently ) {
M.history.replaceHash( '#' );
}
@@ -37,9 +37,9 @@
if ( !rrd ) {
rrd = document.createElement( 'button' );
rrd.setAttribute( 'id', 'remove-results' );
- u( rrd ).addClass( 'escapeOverlay' );
- u( rrd ).bind( 'click', removeResults );
- u( rrd ).text( message(
'mobile-frontend-overlay-escape' ) );
+ $( rrd ).addClass( 'escapeOverlay' ).on( 'click',
function() {
+ removeResults();
+ } ).text( message( 'mobile-frontend-overlay-escape' ) );
header.insertBefore( rrd, header.firstChild );
}
}
@@ -94,7 +94,7 @@
function clickSearchResult( ev ) {
M.history.navigateToPage( this.getAttribute( 'title' ) );
ev.preventDefault();
- removeResults( ev );
+ removeResults();
}
function writeResults( sections ) {
@@ -244,7 +244,7 @@
if ( curPage.hash === '#mw-mf-search' ) {
onfocus();
} else {
- removeResults( ev, true );
+ removeResults( true );
}
} );
}
diff --git a/javascripts/modules/mf-toggle.js b/javascripts/modules/mf-toggle.js
index b021e55..e542b02 100644
--- a/javascripts/modules/mf-toggle.js
+++ b/javascripts/modules/mf-toggle.js
@@ -86,7 +86,7 @@
$( '#anchor_' + heading.id.split( '_' )[ 1 ] ).remove();
u( heading ).bind( 'mousedown', openSectionHandler );
}
-
+
function checkHash() {
var hash = window.location.hash;
if ( hash.indexOf( '#' ) === 0 ) {
diff --git a/tests/js/test_application.js b/tests/js/test_application.js
index 867bdd5..6288be8 100644
--- a/tests/js/test_application.js
+++ b/tests/js/test_application.js
@@ -1,4 +1,4 @@
-( function ( $, MFE ) {
+( function ( $, MFE, Q ) {
module("MobileFrontend application.js: history", {
setup: function() {
@@ -21,7 +21,7 @@
test( 'define()', function() {
MFE.define( 'testModule1', 'test module 1' );
- throws(
+ Q["throws"](
function() {
MFE.define( 'testModule1', 'again' );
},
@@ -31,7 +31,7 @@
} );
test( 'require()', function() {
- throws(
+ Q["throws"](
function() {
MFE.require( 'dummy' );
},
@@ -52,4 +52,4 @@
strictEqual( MFE.getSessionId(), sessionId, 'session ID is not
regenerated if present' );
} );
-}( jQuery, mw.mobileFrontend ) );
+}( jQuery, mw.mobileFrontend, QUnit ) );
diff --git a/tests/js/test_mf-watchstar.js b/tests/js/test_mf-watchstar.js
index a02c22e..636268d 100644
--- a/tests/js/test_mf-watchstar.js
+++ b/tests/js/test_mf-watchstar.js
@@ -1,4 +1,4 @@
-( function ( $, M, W ) {
+( function ( $, W ) {
var _ajax;
module( 'MobileFrontend mf-watchlist.js', {
@@ -63,4 +63,4 @@
strictEqual( $container.find( '.watch-this-article.watched' ).length,
1, 'One article is watched' );
} );
-}( jQuery, mw.mobileFrontend, mw.mobileFrontend.require( 'watchstar' ) ) );
+}( jQuery, mw.mobileFrontend.require( 'watchstar' ) ) );
diff --git a/tests/js/test_settings.js b/tests/js/test_settings.js
index 9675348..d24260e 100644
--- a/tests/js/test_settings.js
+++ b/tests/js/test_settings.js
@@ -1,4 +1,4 @@
-( function ( $, MFEB ) {
+( function ( MFEB ) {
module("MobileFrontend settings.js: cookies");
test("read and write cookies", function() {
@@ -25,4 +25,4 @@
strictEqual(cookieVal, null, "Cookie deleted");
});
-}( jQuery, mw.mobileFrontend.settings ) );
+}( mw.mobileFrontend.settings ) );
diff --git a/tests/js/test_toggle.js b/tests/js/test_toggle.js
index cab9570..a17eccf 100644
--- a/tests/js/test_toggle.js
+++ b/tests/js/test_toggle.js
@@ -1,4 +1,4 @@
-( function ( $, MFE, toggle ) {
+( function ( $, toggle ) {
var $container;
function makeSections() {
@@ -28,7 +28,7 @@
toggle.wm_toggle_section( '1' );
strictEqual($("#content_1").hasClass("openSection"), false, "check
content is closed on a toggle");
strictEqual($("#section_1").hasClass("openSection"), false, "check
section is closed");
-
+
// perform second toggle
toggle.wm_toggle_section( '1' );
strictEqual($("#content_1").hasClass("openSection"), true, "check
content reopened");
@@ -78,4 +78,4 @@
strictEqual( $( '#anchor_1' ).length, 0, 'check anchor is no longer
present' );
});
-}( jQuery, mw.mobileFrontend, mw.mobileFrontend.require( 'toggle' ) ) );
+}( jQuery, mw.mobileFrontend.require( 'toggle' ) ) );
--
To view, visit https://gerrit.wikimedia.org/r/54507
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I47d1a98fa3dc4b6ed2f33bcff28fd726ea882e06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits