-
Notifications
You must be signed in to change notification settings - Fork 179
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(components): add pipette render component #8414
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #8414 +/- ##
==========================================
- Coverage 74.31% 74.24% -0.07%
==========================================
Files 1672 1681 +9
Lines 45149 45289 +140
Branches 4595 4643 +48
==========================================
+ Hits 33553 33627 +74
- Misses 10803 10860 +57
- Partials 793 802 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
|
components/__utils__/tsconfig.json
Outdated
{ | ||
"extends": "../../tsconfig-base.json", | ||
"references": [], | ||
"compilerOptions": { | ||
"composite": true, | ||
"emitDeclarationOnly": false, | ||
"rootDir": ".", | ||
"outDir": "lib" | ||
} | ||
} |
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.
had to add this because before none of the utils were actually being used within components
, they were just being used by other modules in the monorepo
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.
actually, i don't think this is the right way to do this bcuz we'd have to split up code in __utils__
into src
and lib
(as the current code stands lib
is already being generated by the typescript compiler). yuck, maybe we should just expose these utils properly out of components/src
. @b-cooper @smb2268 what say y'all?
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 it makes sense to expose the utils
from components/src
, but I agree with what @b-cooper said in slack that it could be helpful to come up with a new naming convention for the utils so that they're more easily distinguishable from the other exports. I'll try to come up with some ideas for what that could be
const cy = channels === 1 ? SINGLE_CHANNEL_PIPETTE_HEIGHT / 2 : 14 | ||
const x = labwareDef.wells.A1.x - cx | ||
const y = channels === 1 ? labwareDef.wells.A1.y - cy : -2 |
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.
some of these magic numbers are here because we're not actually rendering the nozzles from pipette geometry, we're hard coding values. it's probably worth at least throwing these magic numbers into constants so others can follow what's going on here
getByText( | ||
`rectangle with width ${SINGLE_CHANNEL_PIPETTE_WIDTH} and height ${SINGLE_CHANNEL_PIPETTE_HEIGHT}` | ||
) | ||
mockEmanatingNozzle.mockRestore() |
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.
oddly enough, doing a resetAllWhenMocks()
or jest.restoreAllMocks()
in an afterEach
does not clear out calls to mockEmanatingNozzle. i'm not sure why, and dont want to go down that rabbithole right now
.overflow { | ||
overflow: visible; | ||
} |
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 unfortunately necessary because RobotCoordsForeignDiv
still uses css modules, and i need to tell it to allow the circle animations to overflow
@@ -4,6 +4,7 @@ module.exports = { | |||
setupFilesAfterEnv: [ | |||
'<rootDir>/scripts/setup-enzyme.js', | |||
'<rootDir>/scripts/setup-global-mocks.js', | |||
'<rootDir>/scripts/setup-global-imports.js', |
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 got deleted somehow, adding it back. once this merges i can remove all import '@testing-library/jest-dom'
statements in the monorepo
components/__utils__/matchers.ts
Outdated
@@ -11,3 +11,5 @@ export const partialComponentPropsMatcher = (argsToMatch: unknown) => | |||
when.allArgs((args, equals) => | |||
equals(args[0], expect.objectContaining(argsToMatch)) | |||
) | |||
|
|||
export const anyProps = partialComponentPropsMatcher({}) |
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 dude can be used to tell your tests that your mock component can take in any props
code cov is mad bcuz technically the storybook component isn't tested, but its not source code |
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 really cool! Thanks for the sprinkle of comments explaining why you did some things. The only thing is the 8 emanating nozzles are slightly off center when you are looking at the tiprack labware. I think you mentioned that you fixed this in a commit? So not sure why it is still off center. But other than that, looks good to me. 🚀
oops! forgot to push, just did |
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.
components/__utils__/tsconfig.json
Outdated
{ | ||
"extends": "../../tsconfig-base.json", | ||
"references": [], | ||
"compilerOptions": { | ||
"composite": true, | ||
"emitDeclarationOnly": false, | ||
"rootDir": ".", | ||
"outDir": "lib" | ||
} | ||
} |
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 it makes sense to expose the utils
from components/src
, but I agree with what @b-cooper said in slack that it could be helpful to come up with a new naming convention for the utils so that they're more easily distinguishable from the other exports. I'll try to come up with some ideas for what that could be
e95f6af
to
f04a5e9
Compare
81c3374
to
99c2256
Compare
Overview
This PR adds a
PipetteRender
component into the components library. Closes #8379Changelog
Review requests
Head over here and give it a try! Use both single and multi channel pipettes, and look with different labware
Code review
Note: i had to play around with the hard coded dimensions outlined in the ticket to make them fit properly.
Risk assessment
Low