Skip to content

Commit facd19b

Browse files
committed
add a css test
1 parent 3647ed1 commit facd19b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

lib/document.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function Head (props, context) {
3030
.map((h, i) => React.cloneElement(h, { key: '_next' + i }))
3131
return <head>
3232
{h}
33-
<style data-aphrodite dangerouslySetInnerHTML={{ __html: css.content }} />
33+
<style data-aphrodite="" dangerouslySetInnerHTML={{ __html: css.content }} />
3434
</head>
3535
}
3636

test/fixtures/basic/pages/css.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react'
2+
import { StyleSheet, css } from 'next/css'
3+
4+
export default () => <div className={css(styles.red)}>This is red</div>
5+
6+
const styles = StyleSheet.create({
7+
red: { color: 'red' }
8+
})

test/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ test.before(() => build(dir))
99

1010
test(async (t) => {
1111
const html = await render('/stateless')
12-
console.log(html)
1312
t.true(html.includes('<h1>My component!</h1>'))
1413
})
1514

15+
test(async (t) => {
16+
const html = await render('/css')
17+
t.true(html.includes('<style data-aphrodite="">.red_im3wl1{color:red !important;}</style>'))
18+
t.true(html.includes('<div class="red_im3wl1">This is red</div>'))
19+
})
20+
1621
function render (url, ctx) {
1722
return _render(url, ctx, { dir, staticMarkup: true })
1823
}

0 commit comments

Comments
 (0)