Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure view is set by default on generated mouse events #429

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon-test-support/@ember/test-helpers/dom/fire-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function buildBasicEvent(type, options = {}) {
// eslint-disable-next-line require-jsdoc
function buildMouseEvent(type, options = {}) {
let event;
let eventOpts = assign({}, DEFAULT_EVENT_OPTIONS, options);
let eventOpts = assign({ view: window }, DEFAULT_EVENT_OPTIONS, options);
if (MOUSE_EVENT_CONSTRUCTOR) {
event = new MouseEvent(type, eventOpts);
} else {
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/dom/click-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ module('DOM Helper: click', function(hooks) {

assert.verifySteps(['mousedown 13 17 2', 'mouseup 13 17 2', 'click 13 17 2']);
});

test('clicking a div has window set as view by default', async function(assert) {
element = buildInstrumentedElement('div', ['view']);

await setupContext(context);
await click(element);

assert.verifySteps([
'mousedown [object Window]',
'mouseup [object Window]',
'click [object Window]',
]);
});
});

module('focusable element types', function() {
Expand Down