-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Additional TooltipTrigger Tests #193
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
Conversation
|
Build successful! View the storybook |
|
Build successful! View the storybook |
packages/@react-aria/interactions/test/DOMPropsResponder.test.js
Outdated
Show resolved
Hide resolved
|
Build successful! View the storybook |
| describe('DOMPropsResponder', function () { | ||
| afterEach(cleanup); | ||
|
|
||
| it('should handle hover events on nested hoverable children', function () { |
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.
I don't understand this name, I don't see any nested Hoverable components. Should I be seeing any more than the one?
| import {DOMPropsResponder, Hoverable} from '../'; | ||
| import React from 'react'; | ||
|
|
||
| describe('DOMPropsResponder', function () { |
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.
I don't understand how this is a DOMPropsResponder test suite, nothing in here references it other than it being the wrapping component. Is there anything we should be checking on that component itself during our tests?
Otherwise it just looks like the test suite directly below about Hoverable
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.
+1 to the above ^
| </Provider> | ||
| ); | ||
|
|
||
| expect(() => { |
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.
why was this removed?
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.
is this because of this comment?
Still not sure why the closing actions aren't being registered in tooltiptrigger tests file 🤔 so I deleted them instead of doing the id checking hack. Technically this is handled with the tooltip manager tests file anyway 🤷♂
Lets try to figure out why, I have some time today, maybe we can look at it together after lunch?
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.
I just tried adding it back and it caused a failure. Not sure why, it was there for quite some time and I don't see what has changed.
| describe('click related tests', function () { | ||
|
|
||
| it('triggered by click event', async function () { | ||
| it('a click event can open the tooltip', async function () { |
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.
what's the difference between this test and the one above it?
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.
In the first one I am checking Id's (line 59 and and 60). In the one you referenced here I am not
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.
Right, so why do we need this test, what is the value that this test adds over the previous one?
| expect(tooltipManager.hoverHideTimeout).toBeNull(); | ||
|
|
||
| // run past first tooltips show timer | ||
| jest.advanceTimersByTime(150); |
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.
i think there should be a check for something right after this line?
originally I'd checked
expect(tooltipManager.visibleTooltips).toBeNull();
is there a reason for not checking this?
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.
added 👍
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.
I don't see the line added?
| @@ -0,0 +1,137 @@ | |||
| import {TooltipManager} from '../'; | |||
|
|
|||
| describe('TooltipManager', () => { | |||
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.
I'm assuming that the remainder of the tests will be added in https://jira.corp.adobe.com/browse/RSP-1471
Can you please make notes of places that you diverged from the tests outlined there vs here and why?
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.
That's a toast container, not a tooltip ticket?
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.
yup, whoops, copy pasta mistake https://jira.corp.adobe.com/browse/RSP-1367
| import {DOMPropsResponder, Hoverable} from '../'; | ||
| import React from 'react'; | ||
|
|
||
| describe('DOMPropsResponder', function () { |
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.
+1 to the above ^
| <DOMPropsResponder> | ||
| <div> | ||
| <Hoverable onHover={onHover}> | ||
| <button>Button</button> | ||
| </Hoverable> | ||
| </div> | ||
| </DOMPropsResponder> |
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.
Ah I think I understand what you are trying to test here now, these are like the PressResponder tests yeah? You should probably move the onHover and ref props to DOMPropsResponder so it actually tests that the DOMPropsResponder context is being set up properly and being consumed by Hoverable.
<DOMPropsResponder onHover={onHover}>
....
|
Build successful! 🎉 |
1154465 to
fbed664
Compare
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
LFDanLu
left a comment
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.
LGTM
Codecov Report
@@ Coverage Diff @@
## master #193 +/- ##
=========================================
+ Coverage 69.55% 70.65% +1.1%
=========================================
Files 206 206
Lines 3961 3963 +2
Branches 839 842 +3
=========================================
+ Hits 2755 2800 +45
+ Misses 625 589 -36
+ Partials 581 574 -7
|
|
Build successful! 🎉 |
Closes https://jira.corp.adobe.com/browse/RSP-1512