Henning Snater has uploaded a new change for review. https://gerrit.wikimedia.org/r/76721
Change subject: Cleaned up siteselector and entityselector QUnit test files ...................................................................... Cleaned up siteselector and entityselector QUnit test files Test files conform to jshint now. Change-Id: Ice89b00f976469c594c2df0470ef79790cf06539 --- M .jshintignore M lib/tests/qunit/jquery.wikibase/jquery.wikibase.entityselector.tests.js M lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js 3 files changed, 16 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/21/76721/1 diff --git a/.jshintignore b/.jshintignore index 4a3a9f6..09791fb 100644 --- a/.jshintignore +++ b/.jshintignore @@ -21,8 +21,6 @@ ./lib/tests/qunit/wikibase.ui.Toolbar.tests.js ./lib/tests/qunit/wikibase.ui.Tooltip.tests.js ./lib/tests/qunit/data/testrunner.js -./lib/tests/qunit/jquery.wikibase/jquery.wikibase.entityselector.tests.js -./lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js ./lib/tests/qunit/parsers/EntityIdParser.tests.js ./lib/tests/qunit/wikibase.datamodel/datamodel.Entity.tests.js ./lib/tests/qunit/wikibase.datamodel/datamodel.Item.tests.js diff --git a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.entityselector.tests.js b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.entityselector.tests.js index 2064ac0..3c8ea4c 100644 --- a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.entityselector.tests.js +++ b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.entityselector.tests.js @@ -1,6 +1,4 @@ /** - * QUnit tests for entity selector jQuery widget - * * @since 0.1 * @file * @ingroup WikibaseLib @@ -9,13 +7,13 @@ * @author H. Snater < mediaw...@snater.com > */ -( function( $, QUnit, undefined ) { +( function( $, QUnit ) { 'use strict'; /** * Factory for creating a jquery.wikibase.entityselector widget suitable for testing. * - * @param {Object} customOptions + * @param {Object} [customOptions] */ var newTestEntitySelector = function( customOptions ) { var options = { @@ -25,7 +23,8 @@ $.extend( options, customOptions ); } // element needs to be in the DOM for setting text selection range - return $( '<input/>' ).addClass( 'test_entityselector').appendTo( 'body' ).entityselector( options ); + return $( '<input/>' ) + .addClass( 'test_entityselector').appendTo( 'body' ).entityselector( options ); }; QUnit.module( 'jquery.wikibase.entityselector', QUnit.newMwEnvironment( { @@ -79,7 +78,8 @@ assert.equal( input.val(), 'abc', - 'Replaced input element\'s value with first result (remaining part of the string is highlighted).' + 'Replaced input element\'s value with first result (remaining part of the string is ' + + 'highlighted).' ); assert.equal( @@ -97,7 +97,8 @@ assert.equal( $( entityselector.menu.element.children()[2] ).find( 'span' ).length, 2, - 'Created suggestion list section\'s DOM structure - skipping description and aliases when empty.' + 'Created suggestion list section\'s DOM structure - skipping description and aliases ' + + 'when empty.' ); entityselector.close(); diff --git a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js index 3193ea2..ed8d9bc 100644 --- a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js +++ b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js @@ -1,20 +1,17 @@ /** - * QUnit tests jquery.wikibase.siteselector widget - * @see https://www.mediawiki.org/wiki/Extension:Wikibase - * * @since 0.1 * @file * @ingroup WikibaseLib * * @licence GNU GPL v2+ - * @author H. Snater < mediawiki at snater.com > + * @author H. Snater < mediaw...@snater.com > */ ( function( mw, wb, $, QUnit ) { 'use strict'; /** - * Factory for creating a new sitesuggester enhanced input element. + * Factory for creating a new site selector enhanced input element. * * @param {Object} [options] * @return {jQuery} input element @@ -30,7 +27,7 @@ options = $.merge( { resultSet: siteList }, options ); var input = $( '<input/>' ).siteselector( options ); - input.data( 'siteselector' ).test_search = function( string ) { + input.data( 'siteselector' ).__testSearch = function( string ) { this.element.val( string ); // trigger opening menu without setTimeout delay invoked in jquery.ui.autocomplete @@ -80,7 +77,7 @@ var testString = function( string, expectedSiteId ) { assert.equal( - siteselector.test_search( string ), + siteselector.__testSearch( string ), expectedSiteId, 'Selected "' + expectedSiteId + '" by specifying "' + string + '".' ); @@ -101,13 +98,13 @@ } assert.equal( - siteselector.test_search( 'en-doesnotexist' ), + siteselector.__testSearch( 'en-doesnotexist' ), null, 'No site selected after filling input box with a not existing value.' ); assert.equal( - siteselector.test_search( '' ), + siteselector.__testSearch( '' ), null, 'No site selected after clearing input box.' ); @@ -126,7 +123,7 @@ siteselector.setResultSet( [] ); assert.equal( - siteselector.test_search( 'en' ), + siteselector.__testSearch( 'en' ), null, 'No site found after having cleared the result set.' ); @@ -134,7 +131,7 @@ siteselector.setResultSet( siteList ); assert.equal( - siteselector.test_search( 'en' ), + siteselector.__testSearch( 'en' ), 'enwiki', 'Found site id after re-filling the result set.' ); -- To view, visit https://gerrit.wikimedia.org/r/76721 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice89b00f976469c594c2df0470ef79790cf06539 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Henning Snater <henning.sna...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits