Skip to content
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(components): add data id to pipette dropdown options #5822

Merged
merged 5 commits into from
Jun 9, 2020

Conversation

shlokamin
Copy link
Member

overview

This PR adds a data id to pipette dropdown options.

Partially addresses #5724.

changelog

  • Add data id to pipette dropdown options

review requests

Make sure it this seems reasonable

risk assessment

Very low, just adding a data-id for testing

@shlokamin shlokamin force-pushed the test_pipette-dropdown-option-data-attr branch from a9d86e4 to 10f2118 Compare June 5, 2020 01:32
@@ -118,10 +118,32 @@ const PipetteNameItem = (props: PipetteNameSpecs) => {
}

return (
<>
<div
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When changing this from a React.Fragment to a div, I had to make sure this div's children show up side by side. Not sure of a better way to do this than by adding flex styling here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't think this breaks styling in the app, but it is used in app/src/components/ChangePipette/PipetteSelection.js

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanted to get real fancy, you could use a primitive Flex here, which is a div with display: flex, and you wouldn't need to mess with any CSS

@shlokamin shlokamin requested review from IanLondon, dozercodes, Kadee80, mcous and a team June 5, 2020 01:37
Comment on lines +137 to +142
const dataIdFormat = (
componentName: string,
volumeClass: string,
channels: number,
displayCategory: string
): string => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't love having to do this but not sure of another way since we should be keeping our data-id format consistent with ComponentName_componentSelector.

Could move this out to a util but the formatting logic here is specific to the props this component has

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Down to leave this alone until we spend some more time with this and notice our patterns

@shlokamin shlokamin marked this pull request as ready for review June 5, 2020 01:42
@shlokamin shlokamin requested a review from a team June 5, 2020 01:42
@shlokamin shlokamin force-pushed the test_pipette-dropdown-option-data-attr branch from 646e7bc to d760fd3 Compare June 5, 2020 14:21
Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🉐

Aside: I did some digging into the proper aria attributes for a non-<select> selector to see if there was a11y properties we could be hooking on, and I'm not sure our (react-)select components are super accessible at the moment! Might be a good tech-debt followup, because it's a larger thing than this specific PR

@@ -118,10 +118,32 @@ const PipetteNameItem = (props: PipetteNameSpecs) => {
}

return (
<>
<div
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanted to get real fancy, you could use a primitive Flex here, which is a div with display: flex, and you wouldn't need to mess with any CSS

Comment on lines +137 to +142
const dataIdFormat = (
componentName: string,
volumeClass: string,
channels: number,
displayCategory: string
): string => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Down to leave this alone until we spend some more time with this and notice our patterns

Copy link
Contributor

@dozercodes dozercodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@Kadee80 Kadee80 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐌

@@ -44,7 +44,7 @@ describe('Protocols with Modules', () => {
.next()
.contains('None')
.click()
cy.get('div[id*="select-3-option-2-5"]').click()
cy.get('div[data-id="PipetteNameItem_p300MultiChannelGen1"]').click()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to omit the div here since it doesn't have any semantic meaning

Copy link
Contributor

@IanLondon IanLondon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🖌️

@mcous mcous changed the title feat(test): add data id to pipette dropdown options refactor(components): add data id to pipette dropdown options Jun 9, 2020
@shlokamin shlokamin merged commit e3b92be into edge Jun 9, 2020
@shlokamin shlokamin deleted the test_pipette-dropdown-option-data-attr branch June 9, 2020 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants