From 9773e8eb2a873a174356f6d49144c11434bdab17 Mon Sep 17 00:00:00 2001 From: Giuseppe Gurgone Date: Mon, 19 Dec 2016 08:58:03 +0100 Subject: [PATCH] Add test for partial jsx (expressions) --- test/fixtures/partials.js | 20 ++++++++++++++++++++ test/fixtures/partials.out.js | 18 ++++++++++++++++++ test/index.js | 7 +++++++ 3 files changed, 45 insertions(+) create mode 100644 test/fixtures/partials.js create mode 100644 test/fixtures/partials.out.js 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 093b577a..8b6f552f 100644 --- a/test/index.js +++ b/test/index.js @@ -59,3 +59,10 @@ test('generates source maps', async t => { const out = await read('./fixtures/source-maps.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()) +}) +