-
Notifications
You must be signed in to change notification settings - Fork 150
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
feat(Dropdown): add E2E tests #1962
Conversation
🦋 Changeset detectedLatest commit: be7c691 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ PR title follows Conventional Commits specification. |
useDidUpdate(() => { | ||
onOpenChange?.(isOpen); | ||
if (!isOpen) { |
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.
With this logic, we were calling onOpenChange
as well as we were actually closing and opening dropdown.
Ideally we should only call onOpenChange
wherever state needs to change and then consumers add
<Dropdown isOpen={isDropdownOpen} onOpenChange={(isOpen) => { setIsDropdownOpen(isOpen) }} />
if someone doesn't call state change in onOpenChange, then it shouldn't close the dropdown.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
const setIsOpenControlled = (isControlledStateOpen: boolean): void => { | ||
onOpenChange?.(isControlledStateOpen); | ||
if (!isControlledStateOpen) { |
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.
Can we use the useControllableState hook to manage the controlled/uncontrolled behaviour of isOpen
?
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.
ouu didn't know about this hook. let me see.
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.
done
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.
- Check the tests on Safari/Firefox
done |
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.
lint failing. else lgtm
* feat: add initial dropdown test * feat: move major interaction tests to e2e * feat: add controleld dropdown e2e tests * Create lovely-chairs-sneeze.md * fix: console log * Update lovely-chairs-sneeze.md * Update lovely-chairs-sneeze.md * fix: BaseInput 2 clicks on dropdown * fix: test for safari * fix: handle double clicks with stopPropogation * fix: eslint error * fix: lint
onOpenChange