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

Add test and example to documentation of click / doubleClick with alt/cmd #551

Closed
rwjblue opened this issue Jan 31, 2019 · 1 comment
Closed

Comments

@rwjblue
Copy link
Member

rwjblue commented Jan 31, 2019

This should be possible as of #398, but we should confirm with a test and then add an exmaple to the API docs.

Tests are here:

test('clicking passes options through to mouse events', async function(assert) {
element = buildInstrumentedElement('div', ['clientX', 'clientY', 'button']);
await click(element, { clientX: 13, clientY: 17, button: 2 });
assert.verifySteps(['mousedown 13 17 2', 'mouseup 13 17 2', 'click 13 17 2']);
});

Docs are here:

/**
Clicks on the specified target.
Sends a number of events intending to simulate a "real" user clicking on an
element.
For non-focusable elements the following events are triggered (in order):
- `mousedown`
- `mouseup`
- `click`
For focusable (e.g. form control) elements the following events are triggered
(in order):
- `mousedown`
- `focus`
- `focusin`
- `mouseup`
- `click`
The exact listing of events that are triggered may change over time as needed
to continue to emulate how actual browsers handle clicking a given element.
Use the `options` hash to change the parameters of the MouseEvents.
@public
@param {string|Element} target the element or selector to click on
@param {Object} options the options to be merged into the mouse events
@return {Promise<void>} resolves when settled
*/

@nummi
Copy link

nummi commented Jan 31, 2019

Use the options hash to change the parameters of the MouseEvents.

Maybe more text could be added here to explain that all event properties can be set here (I think that's the case). For example, I needed to test alt clicking a button and it wasn't clear to me that you could simply do this: click(el, { altKey: true }).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants