-
Notifications
You must be signed in to change notification settings - Fork 616
BorderBox updates #329
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
Merged
Merged
BorderBox updates #329
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
43d59f5
remove border props from Layout, add to BorderBox
f21d4e8
update Box tests
2f09185
Fix CircleOcticon
d89c08f
update Dropdown
9141a68
set bg on CircleOcticon
e31d077
remove unnecessary imports
d7c5c7b
update snaps
33be761
lint
92c6ed6
pass boxShadow as string
2b5eded
add some tests
83cd4f7
lint
f5995fb
Merge branch 'q4-haunted-kittens' into border-box
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
import React from 'react' | ||
import {colors} from '../theme' | ||
import theme, {colors} from '../theme' | ||
import BorderBox from '../BorderBox' | ||
import Box from '../Box' | ||
import {render} from '../utils/testing' | ||
|
||
describe('BorderBox', () => { | ||
it('is a system component', () => { | ||
expect(BorderBox.systemComponent).toEqual(true) | ||
}) | ||
|
||
it('renders a Box with default props', () => { | ||
expect(render(<BorderBox />)).toEqual(render(<Box {...BorderBox.defaultProps} />)) | ||
}) | ||
|
||
it('renders borders', () => { | ||
expect(render(<BorderBox borderColor="green.5" />)).toHaveStyleRule('border-color', colors.green[5]) | ||
expect(render(<BorderBox borderBottom={0} />)).toHaveStyleRule('border-bottom', '0') | ||
}) | ||
|
||
it('renders border radius', () => { | ||
expect(render(<BorderBox borderRadius={2} />)).toHaveStyleRule('border-radius', `${theme.radii[2]}px`) | ||
}) | ||
|
||
// the test returns the box shadow value without spaces, so had to manually provide the expected string here | ||
it('renders box shadow', () => { | ||
expect(render(<BorderBox boxShadow="small" />)).toHaveStyleRule('box-shadow', '0 1px 1px rgba(27,31,35,0.1)') | ||
}) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
One thing to note here is that
system-components
infersstyled-system
props from the default props object ({is: 'div', ...}
), which is why we don't have to explicitly listborders
,borderColor
, andborderRadius
here. We might want to do that anyway, since (IIRC) that behavior wasn't carried over to @rebass/components, which we plan to (eventually) upgrade to in #240.