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

Remove focus from event capturing tests #4217

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions test/browser/events.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,29 +155,23 @@ describe('event handling', () => {
// Skip test if browser doesn't support passive events
if (supportsPassiveEvents()) {
it('should use capturing for event props ending with *Capture', () => {
let click = sinon.spy(),
focus = sinon.spy();
let click = sinon.spy();

render(
<div onClickCapture={click} onFocusCapture={focus}>
<button />
<div onClickCapture={click}>
<button type="button">Click me</button>
</div>,
scratch
);

let root = scratch.firstChild;
root.firstElementChild.click();
root.firstElementChild.focus();
let btn = scratch.firstChild.firstElementChild;
btn.click();

expect(click, 'click').to.have.been.calledOnce;

// Focus delegation requires a 50b hack I'm not sure we want to incur
expect(focus, 'focus').to.have.been.calledOnce;

// IE doesn't set it
if (!/Edge/.test(navigator.userAgent)) {
expect(click).to.have.been.calledWithMatch({ eventPhase: 0 }); // capturing
expect(focus).to.have.been.calledWithMatch({ eventPhase: 0 }); // capturing
}
});

Expand Down