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

Update tests #227

Merged
merged 29 commits into from
Aug 25, 2018
Merged

Update tests #227

merged 29 commits into from
Aug 25, 2018

Conversation

emplums
Copy link

@emplums emplums commented Aug 22, 2018

Updates pending tests

Closes: #219

If development process was changed:

Description of changes:

  • Updated README?

Merge Checklist:

@@ -57,14 +57,6 @@ describe('Box', () => {
expect(render(<Box position="relative" />)).toMatchSnapshot()
Copy link
Contributor

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.

import {renderStyles} from '../utils/testing'

// TODO: These components need required props,
// Not sure how to set default props for required ones
Copy link
Contributor

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:

  1. Mock console.error() temporarily to silence the required prop errors.
  2. 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
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Author

Choose a reason for hiding this comment

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

sweet

Copy link
Author

@emplums emplums left a 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`,
Copy link
Author

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

/>
)
).toMatchKeys({
margin: `${theme.space[i]}px`,
Copy link
Author

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

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]
Copy link
Author

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
Copy link
Author

Choose a reason for hiding this comment

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

sweet

@shawnbot
Copy link
Contributor

@emplums I think our linting rules only want quotes on keys that require them, so padding doesn't get quoted by background-color does.

@emplums
Copy link
Author

emplums commented Aug 24, 2018

@shawnbot why doesn't padding require quotes? I feel like I'm missing something 😂

@emplums emplums changed the base branch from master to release-2.0.1-beta August 24, 2018 21:32
@vercel
Copy link

vercel bot commented Aug 24, 2018

This pull request is automatically deployed with Now.

To access deployments, click Details below or on the icon next to each push.

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.

3 participants