mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
add a css test
This commit is contained in:
parent
3647ed14ac
commit
facd19b5a7
|
@ -30,7 +30,7 @@ export function Head (props, context) {
|
|||
.map((h, i) => React.cloneElement(h, { key: '_next' + i }))
|
||||
return <head>
|
||||
{h}
|
||||
<style data-aphrodite dangerouslySetInnerHTML={{ __html: css.content }} />
|
||||
<style data-aphrodite="" dangerouslySetInnerHTML={{ __html: css.content }} />
|
||||
</head>
|
||||
}
|
||||
|
||||
|
|
8
test/fixtures/basic/pages/css.js
vendored
Normal file
8
test/fixtures/basic/pages/css.js
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
import React from 'react'
|
||||
import { StyleSheet, css } from 'next/css'
|
||||
|
||||
export default () => <div className={css(styles.red)}>This is red</div>
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
red: { color: 'red' }
|
||||
})
|
|
@ -9,10 +9,15 @@ test.before(() => build(dir))
|
|||
|
||||
test(async (t) => {
|
||||
const html = await render('/stateless')
|
||||
console.log(html)
|
||||
t.true(html.includes('<h1>My component!</h1>'))
|
||||
})
|
||||
|
||||
test(async (t) => {
|
||||
const html = await render('/css')
|
||||
t.true(html.includes('<style data-aphrodite="">.red_im3wl1{color:red !important;}</style>'))
|
||||
t.true(html.includes('<div class="red_im3wl1">This is red</div>'))
|
||||
})
|
||||
|
||||
function render (url, ctx) {
|
||||
return _render(url, ctx, { dir, staticMarkup: true })
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue