2023-05-20 08:30:52 +00:00
|
|
|
const { UiElement } = require( 'mmv' );
|
|
|
|
|
2018-11-12 16:33:24 +00:00
|
|
|
( function () {
|
2014-04-07 19:19:07 +00:00
|
|
|
QUnit.module( 'mmv.ui', QUnit.newMwEnvironment( {
|
2022-05-13 20:41:15 +00:00
|
|
|
beforeEach: function () {
|
2014-04-07 19:19:07 +00:00
|
|
|
this.clock = this.sandbox.useFakeTimers();
|
|
|
|
}
|
|
|
|
} ) );
|
2014-02-17 15:09:23 +00:00
|
|
|
|
2017-07-25 23:38:21 +00:00
|
|
|
QUnit.test( 'handleEvent()', function ( assert ) {
|
2023-10-24 09:53:23 +00:00
|
|
|
const element = new UiElement( $( '<div>' ) );
|
2014-02-17 15:09:23 +00:00
|
|
|
|
2014-03-26 23:59:04 +00:00
|
|
|
element.handleEvent( 'mmv-foo', function () {
|
2022-05-20 00:18:43 +00:00
|
|
|
assert.true( true, 'Event is handled' );
|
2014-03-26 23:59:04 +00:00
|
|
|
} );
|
2014-02-17 15:09:23 +00:00
|
|
|
|
2014-03-26 23:59:04 +00:00
|
|
|
$( document ).trigger( new $.Event( 'mmv-foo' ) );
|
|
|
|
|
|
|
|
element.clearEvents();
|
|
|
|
|
|
|
|
$( document ).trigger( new $.Event( 'mmv-foo' ) );
|
2014-02-17 15:09:23 +00:00
|
|
|
} );
|
2014-04-02 00:07:51 +00:00
|
|
|
|
2018-11-12 16:33:24 +00:00
|
|
|
}() );
|