-
Notifications
You must be signed in to change notification settings - Fork 840
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
[EuiSelectableTemplateSitewide] fix: The keydown popup display shall be Enter key. #5886
Conversation
- Because all keys except the Enter key were covered.
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
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 QA'd this locally and it's looking great, thank you @ki504178!
This is potentially out of scope, so I'm ok with skipping it for now - but just curious, would you be interested in writing E2E Cypress tests for this file to ensure we don't see regressions in the future?
No worries if you'd rather not, we can skip it if so (since this file doesn't have existing E2E tests written for it) - but if you're at all interested in learning Cypress, let me know and I can provide more details on what I'm looking for in terms of a regression test for this behavior.
src/components/selectable/selectable_templates/selectable_template_sitewide.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_templates/selectable_template_sitewide.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_templates/selectable_template_sitewide.tsx
Outdated
Show resolved
Hide resolved
Thanks for the review! @constancecchen |
- To apply the appropriate modification description. Co-authored-by: Constance <constancecchen@users.noreply.github.com>
- No need for quick returns based on whether or not the pop-up bar is displayed - Use predefined constants for Enter key comparisons instead of literals
jenkins test 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.
Changes look fantastic, thank you @ki504178! I'd be good with this merging in as-is, although also very excited to see what you come up with for Cypress tests.
You will want to create a new file called selectable_template_sitewide.spec.tsx
. You can take a look at the following docs for how to run Cypress tests (you will likely want to use yarn test-cypress-dev
) and an example to get a quick peek at setup:
- https://github.com/elastic/eui/blob/main/wiki/cypress-testing.md
- https://github.com/elastic/eui/blob/main/src/components/combo_box/combo_box.spec.tsx
You should be able to mount a minimal EuiSelectableTemplateSitewide
component using something like this:
const options = [
{
label: 'Hello',
meta: [{ text: 'Test', highlightSearchString: true }],
},
{
label: 'World',
meta: [{ text: 'Test', highlightSearchString: true }],
},
];
cy.mount(
<EuiSelectableTemplateSitewide
options={options}
searchProps={{ 'data-test-subj': 'searchInput' }}
popoverProps={{ 'data-test-subj': 'searchPopover' }}
/>
);
With the above component, I'd like to see the following 2-3 separate E2E tests:
- One that asserts that clicking into the
searchInput
and then pressingEnter
makes thesearchPopover
appear - One that asserts that pressing the
Escape
key makes the popover disappear - (Optional additional test) One that asserts that typing the character
H
into thesearchInput
makes the 'Hello' option appear, but not theWorld
option
Hope that helps! You'll likely want to make use of Cypress APIs such as cy.realPress
for the keypresses, cy.get('...').should('not.exist')
for checking that DOM nodes are not present, and cy.contains
for checking whether 'hello' vs 'world' exists.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5886/ |
@constancecchen |
Sorry @constancecchen |
Gotcha, no worries at all! Hopefully some other time in the future! Going to go ahead and merge, thanks so much for your time with this fix!! |
Summary
Address the following issues.
#5726
Checklist