-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.test.js
More file actions
19 lines (15 loc) · 741 Bytes
/
index.test.js
File metadata and controls
19 lines (15 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import React from 'react'
import { shallow } from 'enzyme'
import { createRenderer } from 'fela';
import { createComponent } from 'react-fela'
import { addPropertyStyles } from './index'
const renderer = createRenderer();
const StyledDiv = createComponent(() => ({ color: '#c0ff33' }), 'div')
describe('addPropertyStyles', () => {
test('adds class names generated for style rule as property to wrapped component', () => {
const propertyName = 'role'
const StyledProp = addPropertyStyles(propertyName, () => ({ color: '#f00', fontSize: '18px' }), StyledDiv)
const wrapper = shallow(<StyledProp />, { context: { renderer }})
expect(wrapper.dive().prop(propertyName)).toEqual(wrapper.props().styles[propertyName])
})
})