forked from rebassjs/rebass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrow.spec.js
59 lines (45 loc) · 1.41 KB
/
Arrow.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React from 'react'
import TestUtils from 'react-addons-test-utils'
import expect from 'expect'
import { Arrow, Base } from '../src'
const renderer = TestUtils.createRenderer()
describe('Arrow', () => {
let tree
beforeEach(() => {
renderer.render(<Arrow />)
tree = renderer.getRenderOutput()
})
it('should render', () => {
expect(tree.type).toEqual(Base)
})
it('should have a className', () => {
expect(tree.props.className).toEqual('Arrow')
})
it('should have a border top by default', () => {
expect(tree.props.baseStyle.borderTop).toEqual('.4375em solid')
})
it('should not have a border bottom by default', () => {
expect(tree.props.baseStyle.borderBottom).toNotExist()
})
context('when direction prop is up', () => {
beforeEach(() => {
renderer.render(<Arrow direction='up' />)
tree = renderer.getRenderOutput()
})
it('should have a border bottom', () => {
expect(tree.props.baseStyle.borderBottom).toEqual('.4375em solid')
})
it('should not have a border top', () => {
expect(tree.props.baseStyle.borderTop).toNotExist()
})
})
context('when custom styles are set', () => {
beforeEach(() => {
renderer.render(<Arrow style={{ color: 'tomato' }} />)
tree = renderer.getRenderOutput()
})
it('should have a custom color', () => {
expect(tree.props.style.color).toEqual('tomato')
})
})
})