Dominic.sauer has uploaded a new change for review. https://gerrit.wikimedia.org/r/217267
Change subject: Add hooks and files for qunit testing ...................................................................... Add hooks and files for qunit testing Change-Id: I6d46870cc6bf53dcccc19ca6527cf7c5644f8558 --- M WikibaseQuality.php M modules/ext.WikibaseQuality.UiScript.js A tests/qunit/ext.WikibaseQuality.UiScript.test.js 3 files changed, 22 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataQuality refs/changes/67/217267/1 diff --git a/WikibaseQuality.php b/WikibaseQuality.php index 2343657..7ee0ff0 100755 --- a/WikibaseQuality.php +++ b/WikibaseQuality.php @@ -27,6 +27,21 @@ // Register hooks for tasks to be done before page display $GLOBALS['wgHooks']['BeforePageDisplay'][] = 'WikibaseQualityHooks::onBeforePageDisplay'; + // Register hooks for QUnit Tests + $GLOBALS['wgHooks']['ResourceLoaderTestModules'][] = function( + array &$testModules, + \ResourceLoader &$resourceLoader + ) { + + $testModules['qunit']['ext.WikibaseQuality.UiScript.tests'] = array( + 'scripts' => array( 'tests/qunit/ext.WikibaseQuality.UiScript.test.js' ), + 'dependencies' => array( 'ext.WikibaseQuality.UiScript' ), + 'localBasePath' => __DIR__, + 'remoteExtPath' => 'WikibaseQuality' + ); + return true; + }; + // Initialize special pages $GLOBALS['wgSpecialPages']['Violations'] = 'WikibaseQuality\Specials\SpecialViolationsPage'; diff --git a/modules/ext.WikibaseQuality.UiScript.js b/modules/ext.WikibaseQuality.UiScript.js index 26b1afb..cc688e8 100755 --- a/modules/ext.WikibaseQuality.UiScript.js +++ b/modules/ext.WikibaseQuality.UiScript.js @@ -7,7 +7,7 @@ -( function( $, util, mw ) { +( function( $, mw ) { 'use strict'; if ( !mw.config.exists( 'wbEntityId' ) ) { @@ -43,7 +43,7 @@ } ); } ); -}( jQuery, util, mediaWiki ) ); +}( jQuery, mediaWiki ) ); function appendViolationInformation( api, claim_guid, response, index, anchor ) { diff --git a/tests/qunit/ext.WikibaseQuality.UiScript.test.js b/tests/qunit/ext.WikibaseQuality.UiScript.test.js new file mode 100755 index 0000000..eec3b0e --- /dev/null +++ b/tests/qunit/ext.WikibaseQuality.UiScript.test.js @@ -0,0 +1,5 @@ +QUnit.module( 'ext.WikibaseQuality.UiScript' ); + +QUnit.test( "hello test", function( assert ) { + assert.ok( 1 == "1", "Passed!" ); +}); \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/217267 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6d46870cc6bf53dcccc19ca6527cf7c5644f8558 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikidataQuality Gerrit-Branch: master Gerrit-Owner: Dominic.sauer <dominic.sa...@yahoo.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits