Skip to content

Commit 2f88111

Browse files
committed
Added isMouseEvent() unit test to verify focus event
Related to issue #158.
1 parent 5aff693 commit 2f88111

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/unit/utility.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ $(function() {
1414
QUnit.test('isMouseEvent', function(assert) {
1515
var mouseEnterEvent = new $.Event('mouseenter', { pageX: 2, pageY: 3 }),
1616
mouseEventWithoutData = new $.Event('mouseenter'),
17+
focusEvent = new $.Event('focus', { pageX: 0, pageY: 0 }),
1718
emptyEvent = new $.Event();
1819

1920
assert.strictEqual(isMouseEvent(mouseEnterEvent), true, 'The mouseenter event with coordinates is a mouse event');
2021
assert.strictEqual(isMouseEvent(mouseEventWithoutData), false, 'The mouseenter event without coordinates is not a mouse event');
22+
assert.strictEqual(isMouseEvent(focusEvent), false, 'The focus event is not a mouse event, even with mouse coordinates');
2123
assert.strictEqual(isMouseEvent(emptyEvent), false, 'Empty event is not a mouse event');
2224
assert.strictEqual(isMouseEvent(), false, 'Undefined argument is not a mouse event');
2325
});

0 commit comments

Comments
 (0)