From e7dd885ecf9a85e58158daba6457d127e4f7da99 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 20 Dec 2016 17:57:12 -0500 Subject: [PATCH] handle directives on components (fixes #216) --- .../server-side-rendering/visitors/Component.js | 2 ++ test/server-side-rendering/component-refs/Widget.html | 1 + test/server-side-rendering/component-refs/_actual.html | 1 + test/server-side-rendering/component-refs/_expected.html | 1 + test/server-side-rendering/component-refs/main.html | 9 +++++++++ 5 files changed, 14 insertions(+) create mode 100644 test/server-side-rendering/component-refs/Widget.html create mode 100644 test/server-side-rendering/component-refs/_actual.html create mode 100644 test/server-side-rendering/component-refs/_expected.html create mode 100644 test/server-side-rendering/component-refs/main.html diff --git a/src/generators/server-side-rendering/visitors/Component.js b/src/generators/server-side-rendering/visitors/Component.js index e97ecaa5dd..659aecdbf0 100644 --- a/src/generators/server-side-rendering/visitors/Component.js +++ b/src/generators/server-side-rendering/visitors/Component.js @@ -9,6 +9,8 @@ export default { } const props = node.attributes.map( attribute => { + if ( attribute.type !== 'Attribute' ) return; + let value; if ( attribute.value === true ) { diff --git a/test/server-side-rendering/component-refs/Widget.html b/test/server-side-rendering/component-refs/Widget.html new file mode 100644 index 0000000000..65b40ecf9b --- /dev/null +++ b/test/server-side-rendering/component-refs/Widget.html @@ -0,0 +1 @@ +

widget

diff --git a/test/server-side-rendering/component-refs/_actual.html b/test/server-side-rendering/component-refs/_actual.html new file mode 100644 index 0000000000..d355c1968c --- /dev/null +++ b/test/server-side-rendering/component-refs/_actual.html @@ -0,0 +1 @@ +

widget

\ No newline at end of file diff --git a/test/server-side-rendering/component-refs/_expected.html b/test/server-side-rendering/component-refs/_expected.html new file mode 100644 index 0000000000..6aa6573932 --- /dev/null +++ b/test/server-side-rendering/component-refs/_expected.html @@ -0,0 +1 @@ +

widget

diff --git a/test/server-side-rendering/component-refs/main.html b/test/server-side-rendering/component-refs/main.html new file mode 100644 index 0000000000..14919b51c9 --- /dev/null +++ b/test/server-side-rendering/component-refs/main.html @@ -0,0 +1,9 @@ +
+ +