emberjs / emberjs/ember-test-helpers
Feature Request: support contextmenu
- Dominant language
- JavaScript
- Stars
- 188
- Forks
- 254
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice if we could have a helper for `contextMenu` like we have for `click`. I am manually triggering it in my tests, as I could not find a way to trigger it with ember-test-helpers.
I am doing this:
```js
const element = document.querySelector(
'[data-test-palette-row="First Palette"]'
).parentElement;
var contextMenuEvent = new MouseEvent('contextmenu', {
bubbles: true,
cancelable: false,
view: window,
button: 2,
buttons: 0,
clientX: element.getBoundingClientRect().x,
clientY: element.getBoundingClientRect().y
});
element.dispatchEvent(contextMenuEvent);
```
Contributor guide
Research direction
Start by locating the existing `click` helper and its tests, then compare their event-dispatch behavior with the issue's manual `MouseEvent('contextmenu')` example. Done means a `contextMenu` helper can trigger the same event without manual DOM selection and is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100