Daniel Werner has uploaded a new change for review.

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


Change subject: Got rid of ugly "private" callback parameter in 
jQuery.ui.inputextender's draw
......................................................................

Got rid of ugly "private" callback parameter in jQuery.ui.inputextender's draw

This also introduces a "toggle" event and function for the inputextender. The 
event will always be
triggered when toggle is called or when the showExtension or hideExtension 
functions result into
the status of the extension being toggled.

Change-Id: Iea34bb67078e569302d413ca6c9c662dbfc4739e
---
M ValueView/resources/jquery.ui/jquery.ui.inputextender.js
D ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.test.js
D 
ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.test.testDefinition.js
D 
ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.testsOnObject.js
D 
ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.testsOnWidget.js
5 files changed, 77 insertions(+), 516 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/49/79149/1

diff --git a/ValueView/resources/jquery.ui/jquery.ui.inputextender.js 
b/ValueView/resources/jquery.ui/jquery.ui.inputextender.js
index 1df5bc2..5ac6c50 100644
--- a/ValueView/resources/jquery.ui/jquery.ui.inputextender.js
+++ b/ValueView/resources/jquery.ui/jquery.ui.inputextender.js
@@ -20,13 +20,22 @@
  *         hidden when the associated input element is empty.
  *         Default value: true
  *
- * @event animationstep: While the input extender's extension is being 
animated, this event is
- *        triggered on each animation step. The event forwards the parameters 
received from the
- *        animation's "step" callback. However, when the animation is 
finished, the event is
- *        triggered without the second and third parameter.
+ * @option {string} [contentAnimationEvents] One or more events (separated 
with spaces) which imply
+ *         that the input extenders extension's content is about to be 
animated. Those events should
+ *         give a jQuery.AnimationEvent object as their event object. If this 
is the case and the
+ *         event bubbles up to the input extender's extension node, then this 
will trigger the
+ *         "contentanimation" event on the widget node.
+ *
+ * @event toggle: Triggered when the visibility of the extended content is 
toggled.
  *        (1) {jQuery.Event}
- *        (2) {number|undefined} [now]
- *        (3) {jQuery.Tween|undefined} [tween]
+ *
+ * @event animation: Triggered at the beginning of an animation of the input's 
extension.
+ *        (1) {jQuery.AnimationEvent} animationEvent
+ *
+ * @event contentanimation: Triggered at the beginning of an animation of the 
extender's
+ *        extension content. Depends on the "contentAnimationEvents" option.
+ *        (1) {jQuery.AnimationEvent} animationEvent The animation event gets 
passed on from the
+ *            event within the input extender's extension causing the 
"contentanimation" event.
  *
  * @dependency jQuery.Widget
  * @dependency jQuery.eachchange
@@ -77,6 +86,7 @@
                 */
                options: {
                        content: [],
+                       contentAnimationEvents: '',
                        initCallback: null,
                        hideWhenInputEmpty: true,
                        position: {
@@ -218,26 +228,51 @@
                /**
                 * Shows the extension.
                 *
-                * @param {Function} [callback] Invoked as soon as the contents 
are visible.
+                * @param {Function} [callback] Invoked as soon as the 
extension's show animation is done.
                 */
                showExtension: function( callback ) {
-                       if( !this._isExtended ) {
-                               this._isExtended = true;
-                               this.draw( callback );
+                       if( !this.extensionIsActive() ) {
+                               this.toggleExtension( callback );
                        }
                },
 
                /**
                 * Hides the extension.
                 *
-                * @param {Function} [callback] Invoked as soon as the contents 
are hidden.
+                * @param {Function} [callback] Invoked as soon as the 
extension's hide animation is done.
                 */
                hideExtension: function( callback ) {
-                       if( this._isExtended ) {
-                               this._isExtended = false;
-                               this.draw( callback );
+                       if( this.extensionIsActive() ) {
+                               this.toggleExtension( callback );
                        }
                },
+
+               /**
+                * Toggles the extension's state. Will hide the extension if it 
is currently shown or
+                * show it if it is currently hidden.
+                *
+                * @param {Function} [callback] Invoked as soon as the 
extension's toggle animation is done.
+                */
+               toggleExtension: $.NativeEventHandler( 'toggle', function( e, 
callback ) {
+                       this._isExtended = !this._isExtended;
+
+                       if( callback ) {
+                               var animationJob = this._isExtended ? 
'extensionexpansion' : 'extensionremoval';
+                               var $element = this.element;
+                               var callbackRegistration = function( 
animationEvent ) {
+                                       if( animationEvent.animationPurpose === 
animationJob ) {
+                                               $element.off( 
this.widgetEventPrefix + 'animation', callbackRegistration );
+                                               
animationEvent.animationCallbacks.add( 'done', function() {
+                                                       callback();
+                                               } );
+                                       }
+                               };
+                               $element.on(
+                                       this.widgetEventPrefix + 'animation.' + 
this.widgetName,
+                                       callbackRegistration );
+                       }
+                       this.draw();
+               } ),
 
                /**
                 * Returns the input extension's node or null in case the 
extension is currently not in its
@@ -273,21 +308,15 @@
 
                /**
                 * Draws the widget.
-                *
-                * @param {Function} [callback] For private usage only.
-                * TODO: Get rid of "callback", introduce some sort of 
"animationstart" event instead,
-                *  offering an object allowing to register callback that will 
be given into the animation's
-                *  options. show/hideExtension can then do a .one() event 
registration for that one and
-                *  register their callback there.
                 */
-               draw: function( /* private: */ callback ) {
+               draw: function() {
                        this.element[ this._isExtended ? 'addClass' : 
'removeClass' ](
                                this.widgetBaseClass + '-extended' );
 
-                       this._drawExtension( callback );
+                       this._drawExtension();
                },
 
-               _drawExtension: function( callback ) {
+               _drawExtension: function() {
                        var extensionIsVisible = this.extensionIsVisible(),
                                $extension = this.$extension;
 
@@ -300,7 +329,6 @@
                                this.$extension = $extension = 
this._buildExtension();
                                $extension.appendTo( $( 'body' ) );
 
-                               // TODO
                                if( $.isFunction( this.options.initCallback ) ) 
{
                                        $extension.show();
                                        this.options.initCallback.call( this, 
$extension );
@@ -320,14 +348,14 @@
                        if( extensionIsVisible !== this._isExtended ) {
                                // Represent actual expansion status:
                                if( this._isExtended ) {
-                                       this._drawExtensionExpansion( callback 
);
+                                       this._drawExtensionExpansion();
                                } else {
-                                       this._drawExtensionRemoval( callback );
+                                       this._drawExtensionRemoval();
                                }
                        }
                },
 
-               _drawExtensionExpansion: function( callback ) {
+               _drawExtensionExpansion: function() {
                        var self = this;
 
                        // When blurring the browser viewport and an 
re-focusing, Chrome is firing the "focus"
@@ -337,37 +365,35 @@
                                this.$extension.css( 'opacity', '1' );
                        }
 
-                       this.$extension.stop( true ).fadeIn( {
-                               duration: 150,
-                               step: function( now, tween ) {
-                                       self._trigger( 'animationstep', null, [ 
now, tween ] );
+                       this.$extension.stop( true ).animateWithEvent(
+                               'extensionexpansion',
+                               'fadeIn',
+                               {
+                                       duration: 150
                                },
-                               complete: function() {
-                                       if( $.isFunction( callback ) ) {
-                                               callback();
-                                       }
-                                       self._trigger( 'animationstep' );
+                               function( animationEvent ) {
+                                       self._trigger( 'animation', 
animationEvent );
                                }
-                       } );
+                       );
                        inputExtendersWithVisibleExtension.add( this );
                },
 
-               _drawExtensionRemoval: function( callback ) {
+               _drawExtensionRemoval: function() {
                        var self = this;
 
-                       this.$extension.stop( true ).fadeOut( {
-                               duration: 150,
-                               step: function( now, tween ) {
-                                       self._trigger( 'animationstep', null, [ 
now, tween ] );
-                               },
-                               complete: function() {
-                                       
inputExtendersWithVisibleExtension.remove( this );
-                                       if( $.isFunction( callback ) ) {
-                                               callback();
+                       this.$extension.stop( true ).animateWithEvent(
+                               'extensionremoval',
+                               'fadeOut',
+                               {
+                                       duration: 150,
+                                       complete: function() {
+                                               
inputExtendersWithVisibleExtension.remove( self );
                                        }
-                                       self._trigger( 'animationstep' );
+                               },
+                               function( animationEvent ) {
+                                       self._trigger( 'animation', 
animationEvent );
                                }
-                       } );
+                       );
                },
 
                /**
@@ -410,10 +436,8 @@
                                        self.showExtension();
                                }
                        } )
-                       // TODO: move this out of here, toggler is not even 
used/known to this widget:
-                       .on( 'toggleranimationstep.' + this.widgetName, 
function( event, now, tween ) {
-                               self._reposition();
-                               self._trigger( 'animationstep', null, [ now, 
tween ] );
+                       .on( this.options.contentAnimationEvents, function( 
animationEvent ) {
+                               self._trigger( 'contentanimation', 
animationEvent );
                        } )
                        .on( 'keydown.' + this.widgetName, function( event ) {
                                // Take care of tabbing out of the extension 
again:
diff --git 
a/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.test.js 
b/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.test.js
deleted file mode 100644
index f9b35b7..0000000
--- a/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.test.js
+++ /dev/null
@@ -1,304 +0,0 @@
-/**
- * @file
- * @licence GNU GPL v2+
- * @author Daniel Werner < [email protected] >
- */
-jQuery.NativeEventHandler.test = ( function ( $, QUnit ) {
-       'use strict';
-
-/**
- * Will execute NativeEventHandler tests based on a given test definition.
- * @see jQuery.NativeEventHandler.test.testDefinition
- *
- * @since 0.1
- *
- * @param {Object} testDefinition
- */
-return function( testDefinition ) {
-       QUnit.module( 'jQuery.NativeEventHandler using ' + 
testDefinition.eventSystem );
-
-       // TEST HELPERS:
-
-       var NEH_STAGE = {
-               INITIAL: 1,
-               CUSTOM: 2,
-               NATIVE: 4
-       };
-       var testResult = 0;
-       function initialHandler() {
-               testResult |= NEH_STAGE.INITIAL;
-       }
-       function customHandler() {
-               testResult |= NEH_STAGE.CUSTOM;
-       }
-       function nativeHandler() {
-               testResult |= NEH_STAGE.NATIVE;
-       }
-       function testNEH( exceptedFlag, comment ) {
-               QUnit.assert.equal(
-                       testResult,
-                       exceptedFlag,
-                       comment
-               );
-               testResult = 0;
-       }
-       var newTestBody = testDefinition.newTestBody;
-       var supportsCustomResults = testDefinition.supportsCustomResults;
-
-       // ACTUAL TESTS:
-
-       QUnit.test( 'Simple native event', function( assert ) {
-               var TEST_EVENT = 'run';
-               var testBody = newTestBody(); // 'Class' which we define our 
test function in
-               var ret;
-
-               testBody[ TEST_EVENT ] = $.NativeEventHandler( TEST_EVENT, 
nativeHandler );
-
-               assert.ok(
-                       $.isFunction( testBody[ TEST_EVENT ] ),
-                       'Returns a function'
-               );
-
-               assert.ok(
-                       $.isFunction( testBody[ TEST_EVENT ].nativeHandler ),
-                       'Reference to inner native handler function stored'
-               );
-
-               // register some custom event
-               testBody.one( TEST_EVENT, customHandler );
-               testBody[ TEST_EVENT ](); // CALL!
-               testNEH(
-                       NEH_STAGE.NATIVE + NEH_STAGE.CUSTOM,
-                       'custom and native events were called after registering 
event with jQuery.one()'
-               );
-
-               testBody[ TEST_EVENT ](); // CALL!
-               testNEH(
-                       NEH_STAGE.NATIVE,
-                       'only native handler was called because no events are 
registered'
-               );
-
-               testBody.one( TEST_EVENT, function( event ) {
-                       customHandler();
-                       event.preventDefault(); // should prevent from calling 
native handler
-                       return 'foo';
-               } );
-               ret = testBody[ TEST_EVENT ](); // CALL!
-               testNEH(
-                       NEH_STAGE.CUSTOM,
-                       'only custom handlers are called after one of them 
requests jQuery.Event.preventDefault()'
-               );
-               assert.notEqual(
-                       ret,
-                       'foo', // shouldn't work because allowCustomResult not 
set to true!
-                       'calling event function has not returned value returned 
by native handler'
-               );
-
-               testBody.one( TEST_EVENT, function( event ) {
-                       event.stopImmediatePropagation();
-               } );
-               testBody.one( TEST_EVENT, customHandler );
-               testBody[ TEST_EVENT ](); // CALL!
-               testNEH(
-                       NEH_STAGE.NATIVE,
-                       'no further custom handlers were called after 
jQuery.Event.stopImmediatePropagation()'
-               );
-       } );
-
-
-       QUnit.test( 'Simple native event with initial handler, also allowing 
custom results', function( assert ) {
-               var TEST_EVENT = 'run';
-               var testBody = newTestBody();
-               var ret;
-
-               testBody[ TEST_EVENT ] = $.NativeEventHandler( TEST_EVENT, {
-                       allowCustomResult: true,
-                       initially: function( event, cancel ) {
-                               initialHandler();
-                               if( cancel ) { // for cancel test
-                                       event.cancel();
-                               }
-                               return NEH_STAGE.INITIAL;
-                       },
-                       natively: function( event ) {
-                               nativeHandler();
-                               return NEH_STAGE.NATIVE;
-                       }
-               } );
-
-               assert.ok(
-                       $.isFunction( testBody[ TEST_EVENT ].initialHandler ),
-                       'Reference to inner initial handler function stored'
-               );
-
-               ret = testBody[ TEST_EVENT ](); // CALL!
-               assert.equal(
-                       ret,
-                       NEH_STAGE.NATIVE,
-                       'calling event function returns value returned by 
native handler'
-               );
-               testNEH(
-                       NEH_STAGE.INITIAL + NEH_STAGE.NATIVE,
-                       'initial and native handlers were called (no event 
registered)'
-               );
-
-               // register some custom event
-               testBody.one( TEST_EVENT, customHandler );
-               testBody[ TEST_EVENT ](); // CALL!
-               testNEH(
-                       NEH_STAGE.INITIAL + NEH_STAGE.NATIVE + NEH_STAGE.CUSTOM,
-                       'initial, custom and native handlers were called'
-               );
-
-               ret = testBody[ TEST_EVENT ]( true ); // CALL!, argument 
triggers $.Event.cancel() test
-               assert.equal(
-                       ret,
-                       NEH_STAGE.INITIAL,
-                       'calling event function returns value returned by 
initial handler because of condition in initial handler'
-               );
-               testNEH(
-                       NEH_STAGE.INITIAL,
-                       'only initial handler was called, which then decided to 
cancel the whole event'
-               );
-
-               testBody.one( TEST_EVENT, function( event ) {
-                       customHandler();
-                       event.preventDefault();
-                       return NEH_STAGE.CUSTOM; // should be returned by event 
function because native handler suppressed above^^
-               } );
-               ret = testBody[ TEST_EVENT ](); // CALL!
-
-               if( supportsCustomResults ) {
-                       assert.equal(
-                               ret,
-                               NEH_STAGE.CUSTOM,
-                               'calling event function returns value returned 
by last custom handler because ' +
-                                       'default was prevented and custom 
results are supported by the event handler'
-                       );
-               } else {
-                       assert.equal(
-                               ret,
-                               NEH_STAGE.INITIAL,
-                               'calling event function returns value returned 
by initial handler even though ' +
-                                       'custom handler did prevent default and 
returned a custom value while default ' +
-                                       'has been prevented. The final output 
will be the native handler\'s return value'
-                       );
-               }
-               testNEH(
-                       NEH_STAGE.INITIAL + NEH_STAGE.CUSTOM,
-                       'only custom handlers are called after one of them 
requests jQuery.Event.preventDefault()'
-               );
-
-               testBody.one( TEST_EVENT, function( event ) {
-                       customHandler();
-                       return NEH_STAGE.CUSTOM; // should be returned by event 
function because native handler suppressed next!
-               } );
-               testBody.one( TEST_EVENT, function( event ) {
-                       return false;
-               } );
-               ret = testBody[ TEST_EVENT ](); // CALL!
-
-               assert.equal(
-                       ret,
-                       supportsCustomResults
-                               ? false // false returned by custom handler, 
also implies preventDefault!
-                               : NEH_STAGE.INITIAL, // false causes 
preventDefault() but outer function will have native handler's return value
-                       supportsCustomResults
-                               ? 'calling event function returns value 
returned by first custom handler even' +
-                                       'though it is false'
-                               : 'calling event function returns native 
handlers result instead of false even ' +
-                                       'though false was returned by custom 
handler. This is because custom results ' +
-                                       'are not supported by the event handler 
in use.'
-               );
-               testNEH(
-                       NEH_STAGE.INITIAL + NEH_STAGE.CUSTOM,
-                       'only custom handlers are called after second custom 
handler returned false'
-               );
-       } );
-
-
-       QUnit.test(
-               'Additional jQuery.Event members used for communicating between 
initial handler and outer function',
-               12, // make sure all tests are executed since we execute some 
tests from within event handlers!
-       function( assert ) {
-
-               var TEST_EVENT = 'run';
-               var testBody = newTestBody();
-               var newBasicHandlerTest = function( handlerType, 
numberOfAdditionalArgs ) {
-                               return function( event ) {
-                                       assert.equal(
-                                               this,
-                                               testBody[ handlerType + 
'HandlerContext' ],
-                                               handlerType + ' handler was 
called in the right context'
-                                       );
-                                       assert.ok(
-                                               event instanceof $.Event,
-                                               handlerType + ' handler 
callback gets jQuery.Event as first parameter'
-                                       );
-                                       assert.ok(
-                                               arguments.length === 
numberOfAdditionalArgs + 1, // + 1 for event arg
-                                               'all ' + numberOfAdditionalArgs 
+ ' arguments plus one for event object get passed on'
-                                       );
-                                       switch( handlerType ) { // will only 
set a flag that the handler was called
-                                               case 'initial': 
initialHandler(); break;
-                                               case 'native': nativeHandler(); 
break;
-                                               case 'custom': customHandler(); 
break;
-                                       }
-                               };
-                       };
-
-               testBody[ TEST_EVENT ] = $.NativeEventHandler( TEST_EVENT, {
-                       initially: function( event ) {
-                               newBasicHandlerTest( 'initial', 2 ).apply( 
this, arguments );
-
-                               assert.ok(
-                                       event.customHandlerArgs === false,
-                                       'jQuery.Event.customHandlerArgs is set 
to false'
-                               );
-
-                               assert.ok(
-                                       event.nativeHandlerArgs === false,
-                                       'jQuery.Event.customHandlerArgs is set 
to false'
-                               );
-
-                               event.customHandlerArgs = [ 1, 2, 3 ];
-                               event.nativeHandlerArgs = [ 1, 2, 3, 4, 5 ];
-                       },
-                       natively: newBasicHandlerTest( 'native', 5 )
-               } );
-
-               // register some custom event, execute newBasicHandlerTest 
tests there as well
-               testBody.one( TEST_EVENT, newBasicHandlerTest( 'custom', 3 ) );
-               testBody[ TEST_EVENT ]( 1, 2 ); // CALL!, give two parameters 
for test
-               testNEH(
-                       NEH_STAGE.INITIAL + NEH_STAGE.NATIVE + NEH_STAGE.CUSTOM,
-                       'initial, custom and native handlers were called'
-               );
-       } );
-
-
-       QUnit.test( 'Excepted errors', function( assert ) {
-               assert.throws(
-                       function() {
-                               $.NativeEventHandler( 'foo' );
-                       },
-                       'Can\'t create handler without function'
-               );
-
-               assert.throws(
-                       function() {
-                               $.NativeEventHandler( 'foo', {} );
-                       },
-                       'Can\'t create handler without function although 2nd 
parameter is set'
-               );
-
-               assert.throws(
-                       function() {
-                               $.NativeEventHandler( 'foo', { natively: 
$.noop, 'foo': 'test' } );
-                       },
-                       'Can\'t create handler with unknown key in 2nd 
parameter'
-               );
-       } );
-};
-
-}( jQuery, QUnit ) );
diff --git 
a/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.test.testDefinition.js
 
b/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.test.testDefinition.js
deleted file mode 100644
index 5af1d3d..0000000
--- 
a/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.test.testDefinition.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @file
- * @licence GNU GPL v2+
- * @author Daniel Werner < [email protected] >
- */
-jQuery.NativeEventHandler.test.testDefinition = ( function ( $, QUnit ) {
-       'use strict';
-
-       /**
-        * Test definition for running wb.tests.nativeEventHandlerTest with.
-        *
-        * @since 0.1
-        *
-        * @constructor
-        * @abstract
-        */
-       return {
-               /**
-                * Descriptive name of the event handler system which is used 
together with the
-                * NativeEventHandler in this test definition.
-                * @type {String}
-                */
-               eventSystem: '',
-
-               /**
-                * Whether custom results are supported by the event handler 
system in use. E.g. $.Widget's
-                * _trigger() does not allow for custom results while 
$.trigger() does.
-                * @type Boolean
-                */
-               supportsCustomResults: false,
-
-               /**
-                * Returns an Object which test functions factored by the 
NativeEventHandler can be attached
-                * to. The returned object also has a 'one' function which is 
equivalent to jQuery.one() and
-                * allows for listening to events which should be triggered by 
any NativeEventHandler
-                * defined on the test body Object returned by this.
-                *
-                * @return {Object} Will have the following fields:
-                *         - 'one' function to register custom event handler, 
will be removed after called once.
-                *         - 'initialHandlerContext' The object which should be 
the context for initial handler.
-                *         - 'customHandlerContext' The object which should be 
the context for custom handlers.
-                *         - 'nativeHandlerContext' The object which should be 
the context for native handler.
-                */
-               newWidgetTestBody: function() {
-                       throw new Error( '"newWidgetTestBody" has to be 
overwritten in specific test '
-                               + 'implementation' );
-               }
-       };
-
-}( jQuery, QUnit ) );
diff --git 
a/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.testsOnObject.js
 
b/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.testsOnObject.js
deleted file mode 100644
index 1f7c877..0000000
--- 
a/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.testsOnObject.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @file
- * @licence GNU GPL v2+
- * @author Daniel Werner < [email protected] >
- */
-( function ( $, QUnit, runTest, testDefinitionBase ) {
-       'use strict';
-
-       /**
-        * Test definition for running NativeEventHandler tests within a plain 
Object's environment.
-        * For triggering events on the object, $( obj ).trigger() will be used.
-        *
-        * @type Object
-        */
-       var testDefinition = $.extend( {}, testDefinitionBase, {
-               /**
-                * @see 
jQuery.NativeEventHandler.test.testDefinition.eventSystem
-                */
-               eventSystem: 'jQuery.fn.trigger',
-
-               /**
-                * @see 
jQuery.NativeEventHandler.test.testDefinition.supportsCustomResults
-                */
-               supportsCustomResults: true,
-
-               /**
-                * @see 
jQuery.NativeEventHandler.test.testDefinition.newWidgetTestBody
-                */
-               newTestBody: function() {
-                       var testBody = {
-                               one: function( eventType, fn ) {
-                                       $( this ).one( eventType, fn );
-                               }
-                       };
-                       testBody.initialHandlerContext
-                               = testBody.customHandlerContext
-                               = testBody.nativeHandlerContext
-                               = testBody;
-
-                       return testBody;
-               }
-       } );
-
-       runTest( testDefinition );
-}(
-       jQuery,
-       QUnit,
-       jQuery.NativeEventHandler.test,
-       jQuery.NativeEventHandler.test.testDefinition
-) );
diff --git 
a/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.testsOnWidget.js
 
b/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.testsOnWidget.js
deleted file mode 100644
index e7af534..0000000
--- 
a/ValueView/tests/qunit/jquery.NativeEventHandler/NativeEventHandler.testsOnWidget.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * @licence GNU GPL v2+
- * @author Daniel Werner < [email protected] >
- */
-( function ( $, QUnit, runTest, testDefinitionBase ) {
-       'use strict';
-
-       /**
-        * Test definition for running NativeEventHandler tests within jQuery 
Widget environment,
-        * meaning, the jQuery.Widget's _trigger() function will be used to 
trigger events.
-        *
-        * @type Object
-        */
-       var testDefinition = $.extend( {}, testDefinitionBase, {
-               /**
-                * @see wb.tests.NativeEventHandlerTestDefinition.eventSystem
-                */
-               eventSystem: 'jQuery.Widget.prototype._trigger',
-
-               /**
-                * @see 
wb.tests.NativeEventHandlerTestDefinition.supportsCustomResults
-                */
-               supportsCustomResults: false,
-
-               /**
-                * @see 
wb.tests.NativeEventHandlerTestDefinition.newWidgetTestBody
-                */
-               newTestBody: function() {
-                       var TestWidget = function() {
-                               $.Widget.apply( this, arguments );
-                       };
-                       TestWidget.prototype = $.extend( new $.Widget(), {
-                               constructor: TestWidget,
-                               widgetName: 'neh_test_widget',
-                               widgetEventPrefix: 'neh_test_widget_'
-                       } );
-
-                       var testBody = new TestWidget( {}, $( '<div/>' ) );
-
-                       testBody.one = function( eventType, fn ) {
-                               // In widgets, event will have a prefix!
-                               testBody.element.one( 
testBody.widgetEventPrefix + eventType, fn );
-                       };
-                       testBody.initialHandlerContext = testBody;
-                       testBody.customHandlerContext = testBody.element[0];
-                       testBody.nativeHandlerContext = testBody;
-
-                       return testBody;
-               }
-       } );
-
-       runTest( testDefinition );
-}(
-       jQuery,
-       QUnit,
-       jQuery.NativeEventHandler.test,
-       jQuery.NativeEventHandler.test.testDefinition
-) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea34bb67078e569302d413ca6c9c662dbfc4739e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Daniel Werner <[email protected]>

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

Reply via email to