diff --git a/test/fixtures/partials.js b/test/fixtures/partials.js new file mode 100644 index 00000000..d029689e --- /dev/null +++ b/test/fixtures/partials.js @@ -0,0 +1,20 @@ +export default class { + renderTest() { + return

test

+ } + + render () { + const test =
{this.renderTest}
+ + return ( +
+ {test} + +
+ ) + } +} diff --git a/test/fixtures/partials.out.js b/test/fixtures/partials.out.js new file mode 100644 index 00000000..c46a73f7 --- /dev/null +++ b/test/fixtures/partials.out.js @@ -0,0 +1,18 @@ +import _JSXStyle from "styled-jsx/style"; + +export default class { + renderTest() { + return

test

+ } + + render () { + const test =
{this.renderTest}
+ + return ( +
+ {test} + <_JSXStyle css={"p[data-jsx=\"1891769468\"] {color: red;}"} data-jsx={"1891769468"} /> +
+ ) + } +} diff --git a/test/index.js b/test/index.js index 0529d936..99537e88 100644 --- a/test/index.js +++ b/test/index.js @@ -65,3 +65,9 @@ test('mixed global and scoped', async t => { const out = await read('./fixtures/mixed-global-scoped.out.js') t.is(code, out.trim()) }) + +test('works with partial jsx (expressions)', async t => { + const {code} = await transform('./fixtures/partials.js') + const out = await read('./fixtures/partials.out.js') + t.is(code, out.trim()) +})