forked from rebassjs/rebass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDivider.spec.js
49 lines (39 loc) · 1.12 KB
/
Divider.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
import React from 'react'
import TestUtils from 'react-addons-test-utils'
import expect from 'expect'
import { Divider, Base } from '../src'
const renderer = TestUtils.createRenderer()
describe('Divider', () => {
let tree
beforeEach(() => {
renderer.render(<Divider />)
tree = renderer.getRenderOutput()
})
it('should render', () => {
expect(tree.type).toEqual(Base)
})
it('should set tagName', () => {
expect(tree.props.tagName).toEqual('hr')
})
it('should have a className', () => {
expect(tree.props.className).toEqual('Divider')
})
context('when setting width', () => {
beforeEach(() => {
renderer.render(<Divider width={256} />)
tree = renderer.getRenderOutput()
})
it('should have a fixed width', () => {
expect(tree.props.baseStyle.width).toEqual(256)
})
})
context('when custom styles are set', () => {
beforeEach(() => {
renderer.render(<Divider style={{ color: 'tomato' }} />)
tree = renderer.getRenderOutput()
})
it('should have a custom color', () => {
expect(tree.props.style.color).toEqual('tomato')
})
})
})