From 1bb1294c51da1cc8b46654d0815b7f49c37ccf29 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 3 Feb 2019 22:04:35 -0500 Subject: [PATCH 1/2] failing test for #2022 --- .../reactive-values-exported/_config.js | 18 ++++++++++++++++++ .../samples/reactive-values-exported/main.html | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 test/runtime/samples/reactive-values-exported/_config.js create mode 100644 test/runtime/samples/reactive-values-exported/main.html diff --git a/test/runtime/samples/reactive-values-exported/_config.js b/test/runtime/samples/reactive-values-exported/_config.js new file mode 100644 index 0000000000..56220d3993 --- /dev/null +++ b/test/runtime/samples/reactive-values-exported/_config.js @@ -0,0 +1,18 @@ +export default { + props: { + x: 1 + }, + + html: ` +

1 1 1

+ `, + + test({ assert, component, target }) { + assert.equal(component.y, 1); + assert.equal(component.z, 1); + + component.x = 2; + assert.equal(component.y, 2); + assert.equal(component.z, 2); + } +}; diff --git a/test/runtime/samples/reactive-values-exported/main.html b/test/runtime/samples/reactive-values-exported/main.html new file mode 100644 index 0000000000..2a9e5dc8f5 --- /dev/null +++ b/test/runtime/samples/reactive-values-exported/main.html @@ -0,0 +1,11 @@ + + +

{x} {y} {z}

\ No newline at end of file From 3ee7938d34b08e5a42095adeb0ea75af2239ecb0 Mon Sep 17 00:00:00 2001 From: John Chesley Date: Mon, 18 Mar 2019 21:33:42 -0400 Subject: [PATCH 2/2] break declaration grouping on non-declaration nodes (fixes #2022) --- src/compile/Component.ts | 2 +- .../reactive-values-exported/{main.html => main.svelte} | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) rename test/runtime/samples/reactive-values-exported/{main.html => main.svelte} (55%) diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 77c516049e..30a06ca50b 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -865,7 +865,7 @@ export default class Component { } } else { if (node.type !== 'ExportNamedDeclaration') { - if (!parent) current_group = null; + if (!parent || parent.type === 'Program') current_group = null; } } }, diff --git a/test/runtime/samples/reactive-values-exported/main.html b/test/runtime/samples/reactive-values-exported/main.svelte similarity index 55% rename from test/runtime/samples/reactive-values-exported/main.html rename to test/runtime/samples/reactive-values-exported/main.svelte index 2a9e5dc8f5..169fb7fcd8 100644 --- a/test/runtime/samples/reactive-values-exported/main.html +++ b/test/runtime/samples/reactive-values-exported/main.svelte @@ -1,11 +1,10 @@ -

{x} {y} {z}

\ No newline at end of file +

{x} {y} {z}