-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[test] Update react next patch #22105
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -462,28 +462,46 @@ describe('<Tooltip />', () => { | |
}); | ||
|
||
describe('prop: overrides', () => { | ||
[ | ||
'onTouchStart', | ||
'onTouchEnd', | ||
'onMouseEnter', | ||
'onMouseOver', | ||
'onMouseLeave', | ||
'onFocus', | ||
'onBlur', | ||
].forEach((name) => { | ||
it(`should be transparent for the ${name} event`, () => { | ||
const handler = spy(); | ||
const { getByRole } = render( | ||
<Tooltip title="Hello World"> | ||
<button id="testChild" type="submit" {...{ [name]: handler }}> | ||
Hello World | ||
</button> | ||
</Tooltip>, | ||
); | ||
const type = camelCase(name.slice(2)); | ||
fireEvent[type](getByRole('button')); | ||
expect(handler.callCount).to.equal(1); | ||
}); | ||
['onTouchStart', 'onTouchEnd', 'onMouseEnter', 'onMouseOver', 'onMouseLeave'].forEach( | ||
(name) => { | ||
it(`should be transparent for the ${name} event`, () => { | ||
const handler = spy(); | ||
const { getByRole } = render( | ||
<Tooltip title="Hello World"> | ||
<button id="testChild" type="submit" {...{ [name]: handler }}> | ||
Hello World | ||
</button> | ||
</Tooltip>, | ||
); | ||
const type = camelCase(name.slice(2)); | ||
fireEvent[type](getByRole('button')); | ||
expect(handler.callCount).to.equal(1, `${name} should've been called`); | ||
}); | ||
}, | ||
); | ||
|
||
it(`should be transparent for the focus and blur event`, () => { | ||
const handleBlur = spy(); | ||
const handleFocus = spy(); | ||
const { getByRole } = render( | ||
<Tooltip title="Hello World"> | ||
<button id="testChild" type="submit" onFocus={handleFocus} onBlur={handleBlur}> | ||
Hello World | ||
</button> | ||
</Tooltip>, | ||
); | ||
const button = getByRole('button'); | ||
|
||
button.focus(); | ||
|
||
expect(handleBlur.callCount).to.equal(0); | ||
expect(handleFocus.callCount).to.equal(1); | ||
|
||
button.blur(); | ||
|
||
// FIXME: undesired behavior, should be 1 | ||
expect(handleBlur.callCount).to.equal(0); | ||
Comment on lines
+502
to
+503
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These ones are odd. Investigating before merge There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See facebook/react#19560. |
||
expect(handleFocus.callCount).to.equal(1); | ||
}); | ||
|
||
it('should ignore event from the tooltip', () => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion in #20406 (comment). Seems to me expected behavior matches desired behavior with
react@next
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, React helps us here :): #20406 (comment)