styled-components
Version:
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
28 lines (23 loc) • 647 B
JavaScript
import React from 'react'
import { shallow } from 'enzyme'
import { resetStyled, expectCSSMatches } from './utils'
let styled
describe('props', () => {
beforeEach(() => {
styled = resetStyled()
})
it('should execute interpolations and fall back', () => {
const Comp = styled.div`
color: ${props => props.fg || 'black'};
`
shallow(<Comp />)
expectCSSMatches('.a { color: black; }')
})
it('should execute interpolations and inject props', () => {
const Comp = styled.div`
color: ${props => props.fg || 'black'};
`
shallow(<Comp fg="red"/>)
expectCSSMatches('.a { color: red; }')
})
})