forked from styled-system/styled-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
31 lines (25 loc) · 773 Bytes
/
test.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
import test from 'ava'
import React from 'react'
import styled from 'styled-components'
import { renderToString } from 'react-dom/server'
import { textAlign, propTypes } from '../src'
import cleanElement from './src'
test('it removes props with prop types', t => {
const Clean = cleanElement('div')
Clean.propTypes = {
...propTypes.textAlign
}
const Box = styled(Clean)`
${textAlign}
`
const result = renderToString(<Box id='beep' textAlign='center' children='hello' />)
t.snapshot(result)
})
test('does not remove props without propTypes', t => {
const Clean = cleanElement('div')
const Box = styled(Clean)`
${textAlign}
`
const result = renderToString(<Box id='beep' textAlign='center' children='hello' />)
t.snapshot(result)
})