-
Notifications
You must be signed in to change notification settings - Fork 127
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
Refactor the Popover component #2864
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ece7699
to
3863326
Compare
Size Change: +106 B (+0.02%) Total Size: 678 kB
ℹ️ View Unchanged
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #2864 +/- ##
==========================================
+ Coverage 87.93% 87.96% +0.03%
==========================================
Files 225 226 +1
Lines 12992 13008 +16
Branches 1791 1792 +1
==========================================
+ Hits 11424 11442 +18
+ Misses 1514 1512 -2
Partials 54 54
|
3863326
to
20e64a4
Compare
20e64a4
to
1353d29
Compare
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.
Nice! 👏🏻
6ce5dd9
to
e1fc6a3
Compare
e1fc6a3
to
cc4dd46
Compare
cc4dd46
to
38378fd
Compare
@@ -131,7 +131,7 @@ describe('Popover', () => { | |||
|
|||
await userEvent.click(popoverTrigger); | |||
|
|||
expect(baseProps.onToggle).toHaveBeenCalledTimes(1); | |||
expect(baseProps.onToggle).toHaveBeenCalled(); |
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.
This is part of why I was frustrated with onToggle
😄
The Popover closes, but in reality onToggle
is called twice: first when the trigger element is clicked (and its value toggled), and then when the onCloseEnd
is fired (with false
, having no effect).
Having toHaveBeenCalled
instead of toHaveBeenCalledTimes(1)
is not enough for the test to confirm the popover was closed. I also cannot use toHaveBeenCalledWith(false)
because it can get called with a function. I added a TODO to try and improve this later.
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.
And we have to call onToggle
after onCloseEnd
because the Dialog might have been closed "natively" (e.g. using the escape key), right?
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.
exactly
a959b56
to
14213b0
Compare
@@ -131,7 +131,7 @@ describe('Popover', () => { | |||
|
|||
await userEvent.click(popoverTrigger); | |||
|
|||
expect(baseProps.onToggle).toHaveBeenCalledTimes(1); | |||
expect(baseProps.onToggle).toHaveBeenCalled(); |
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.
And we have to call onToggle
after onCloseEnd
because the Dialog might have been closed "natively" (e.g. using the escape key), right?
14213b0
to
c3ded5e
Compare
c3ded5e
to
2e9371d
Compare
2e9371d
to
d8ad5c5
Compare
d8ad5c5
to
1e0e086
Compare
Addresses #DSYS-886
Purpose
Describe what you are trying to accomplish
Approach and changes
Describe how you solved the problem
Definition of done