File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
packages/system/src/styles Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11import { borders } from './borders'
22
3+ describe ( '#border' , ( ) => {
4+ it ( 'expands border' , ( ) => {
5+ expect ( borders ( { border : 1 } ) ) . toEqual ( { border : '1px solid' } )
6+ expect ( borders ( { border : '1' } ) ) . toEqual ( { border : '1px solid' } )
7+ expect ( borders ( { border : '3px' } ) ) . toEqual ( { border : '3px' } )
8+ } )
9+ } )
10+
311describe ( '#divideY' , ( ) => {
412 it ( 'works as expected' , ( ) => {
513 expect ( borders ( { divideY : 1 } ) ) . toEqual ( {
Original file line number Diff line number Diff line change 11import * as CSS from 'csstype'
2- import { num } from '@xstyled/util'
32import { style , themeGetter , compose } from '../style'
43import { px } from '../unit'
54import { getColor , ThemeColor , Color } from './colors'
@@ -14,7 +13,10 @@ export type ThemeBorder<T extends ITheme = Theme> = ThemeNamespaceValue<
1413export const getBorder = themeGetter < ThemeBorder > ( {
1514 name : 'border' ,
1615 key : 'borders' ,
17- transform : ( n : number | string ) => ( num ( n ) && n > 0 ? `${ px ( n ) } solid` : n ) ,
16+ transform : ( value : number | string ) => {
17+ const num = Number ( value )
18+ return num > 0 ? `${ px ( num ) } solid` : value
19+ } ,
1820} )
1921
2022export type ThemeBorderWidth < T extends ITheme = Theme > = ThemeNamespaceValue <
You can’t perform that action at this time.
0 commit comments