-
Notifications
You must be signed in to change notification settings - Fork 538
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
Update tests #227
Update tests #227
Conversation
@@ -57,14 +57,6 @@ describe('Box', () => { | |||
expect(render(<Box position="relative" />)).toMatchSnapshot() |
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 know we haven't touched this, but I would expect this snapshot to look like <div position="relative">
since we moved the position props in #202. This test should go away.
src/__tests__/UtilitySystemProps.js
Outdated
import {renderStyles} from '../utils/testing' | ||
|
||
// TODO: These components need required props, | ||
// Not sure how to set default props for required ones |
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.
We could do two things here:
- Mock
console.error()
temporarily to silence the required prop errors. - Set up an object that lists props for each component, e.g.
const testProps = {
OcticonButton: {icon: X, label: ''},
DonutChart: {data: {pending: 1}},
MergeStatus: {state: 'ready'}
}
@@ -104,6 +104,9 @@ export function withSystemProps(Component, props = COMMON) { | |||
Wrapped.displayName = Component.displayName | |||
Object.assign(Wrapped.propTypes, Component.propTypes) | |||
|
|||
// Set what system props we use on this component | |||
Wrapped.systemProps = props |
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!
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.
sweet
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.
Looks good so far, just left a couple of comments!
'margin-left': `${theme.space[i]}px`, | ||
'margin-right': `${theme.space[i]}px`, | ||
'margin-top': `${theme.space[i]}px`, | ||
padding: `${theme.space[i]}px`, |
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.
padding
is missing quotes here
src/__tests__/UtilitySystemProps.js
Outdated
/> | ||
) | ||
).toMatchKeys({ | ||
margin: `${theme.space[i]}px`, |
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.
margin
is missing quotes here too
src/__tests__/UtilitySystemProps.js
Outdated
for (const i in theme.colors[color]) { | ||
expect(renderStyles(<Component bg={`${color}.${i}`} color={`${color}.${i}`} />)).toMatchKeys({ | ||
'background-color': theme.colors[color][i], | ||
color: theme.colors[color][i] |
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.
color
is missing quotes here
@@ -104,6 +104,9 @@ export function withSystemProps(Component, props = COMMON) { | |||
Wrapped.displayName = Component.displayName | |||
Object.assign(Wrapped.propTypes, Component.propTypes) | |||
|
|||
// Set what system props we use on this component | |||
Wrapped.systemProps = props |
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.
sweet
@emplums I think our linting rules only want quotes on keys that require them, so |
@shawnbot why doesn't padding require quotes? I feel like I'm missing something 😂 |
This pull request is automatically deployed with Now. To access deployments, click Details below or on the icon next to each push. |
Updates pending tests
Closes: #219
If development process was changed:
Description of changes:
Merge Checklist: