Skip to content

Commit

Permalink
✅ Improve border test
Browse files Browse the repository at this point in the history
  • Loading branch information
exah committed Feb 21, 2019
1 parent 7e5f6f1 commit 3e4356f
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions test/border.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,31 @@ import { border } from '../src'
import { toStyles, testValue } from './_helpers'

const theme = {
border: {
default: '1px solid',
thick: '5px solid'
},
palette: {
default: {
border: '#eee'
},
inverted: {
border: '#333'
}
}
}

test('border', () => {
test('color', testValue({
fn: border,
prop: 'borderColor',
cssProp: 'borderColor',
values: [ 'inherit', 'currentColor', 'custom', 'hotpink' ]
}))

test('default', () => {
const result = border({
theme,
border: '1px solid',
border: true,
borderColor: true
})

Expand All @@ -22,22 +36,28 @@ test('border', () => {
})
})

test('borderColor', testValue({
fn: border,
prop: 'borderColor',
cssProp: 'borderColor',
values: [ 'inherit', 'currentColor', 'custom', 'hotpink' ]
}))
test('theme', () => {
const result = border({
theme,
borderLeft: 'thick',
borderColor: 'inverted'
})

expect(toStyles(result)).toEqual({
borderLeft: '5px solid',
borderColor: '#333'
})
})

test('bdl custom', () => {
test('custom', () => {
const result = border({
theme,
borderLeft: '5px dotted',
borderColor: true
borderColor: 'red'
})

expect(toStyles(result)).toEqual({
borderLeft: '5px dotted',
borderColor: '#eee'
borderColor: 'red'
})
})

0 comments on commit 3e4356f

Please sign in to comment.