-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include all shadow variables in theme object (#1309)
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/components": patch | ||
--- | ||
|
||
Include all shadow variables in theme object |
This file contains 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {isShadowValue} from '../utils/theme' | ||
|
||
describe('isShadowValue', () => { | ||
it('accepts transparent', () => { | ||
expect(isShadowValue('0 0 0 transparent')).toBe(true) | ||
}) | ||
|
||
it('accepts hex colors', () => { | ||
expect(isShadowValue('0 0 0 #ff0000')).toBe(true) | ||
expect(isShadowValue('0 0 0 #ff0')).toBe(true) | ||
}) | ||
|
||
it('accepts rgba colors', () => { | ||
expect(isShadowValue('0 0 0 rgb(255, 0, 0)')).toBe(true) | ||
expect(isShadowValue('0 0 0 rgba(255,0,0,0.2)')).toBe(true) | ||
}) | ||
|
||
it('accepts px values', () => { | ||
expect(isShadowValue('12px 24px 0 #000')).toBe(true) | ||
}) | ||
|
||
it('accepts em values', () => { | ||
expect(isShadowValue('0.5em 1em 0 #000')).toBe(true) | ||
}) | ||
|
||
it('accepts inset values', () => { | ||
expect(isShadowValue('inset 12px 24px 0 #000')).toBe(true) | ||
}) | ||
|
||
it('rejects individual colors', () => { | ||
expect(isShadowValue('red')).toBe(false) | ||
expect(isShadowValue('#f00')).toBe(false) | ||
expect(isShadowValue('rgb(255, 0, 0)')).toBe(false) | ||
}) | ||
|
||
it('rejects individual numeric values', () => { | ||
expect(isShadowValue('0')).toBe(false) | ||
expect(isShadowValue('12px')).toBe(false) | ||
expect(isShadowValue('0.5em')).toBe(false) | ||
}) | ||
}) |
This file contains 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
dc17a49
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.
Successfully deployed to the following URLs: