| 1 | const { UiElement } = require( 'mmv' ); |
| 2 | |
| 3 | ( function () { |
| 4 | QUnit.module( 'mmv.ui', QUnit.newMwEnvironment( { |
| 5 | beforeEach: function () { |
| 6 | this.clock = this.sandbox.useFakeTimers(); |
| 7 | } |
| 8 | } ) ); |
| 9 | |
| 10 | QUnit.test( 'handleEvent()', ( assert ) => { |
| 11 | const element = new UiElement( $( '<div>' ) ); |
| 12 | |
| 13 | element.handleEvent( 'mmv-foo', () => { |
| 14 | assert.true( true, 'Event is handled' ); |
| 15 | } ); |
| 16 | |
| 17 | $( document ).trigger( new $.Event( 'mmv-foo' ) ); |
| 18 | |
| 19 | element.clearEvents(); |
| 20 | |
| 21 | $( document ).trigger( new $.Event( 'mmv-foo' ) ); |
| 22 | } ); |
| 23 | |
| 24 | }() ); |