was created with unknown prop '${key}'`);
});
- let { $$slots = {}, $$scope } = $$props;
- validate_slots("Component", $$slots, []);
-
function div_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
- $$invalidate(0, node = $$value);
+ node = $$value;
+ $$invalidate(0, node);
});
}
diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js
index 0849a38b51..867d4a7dad 100644
--- a/test/js/samples/media-bindings/expected.js
+++ b/test/js/samples/media-bindings/expected.js
@@ -19,6 +19,7 @@ function create_fragment(ctx) {
let audio_updating = false;
let audio_animationframe;
let audio_is_paused = true;
+ let mounted;
let dispose;
function audio_timeupdate_handler() {
@@ -42,7 +43,7 @@ function create_fragment(ctx) {
if (/*seeking*/ ctx[9] === void 0) add_render_callback(() => /*audio_seeking_seeked_handler*/ ctx[18].call(audio));
if (/*ended*/ ctx[10] === void 0) add_render_callback(() => /*audio_ended_handler*/ ctx[19].call(audio));
},
- m(target, anchor, remount) {
+ m(target, anchor) {
insert(target, audio, anchor);
if (!isNaN(/*volume*/ ctx[6])) {
@@ -55,21 +56,23 @@ function create_fragment(ctx) {
audio.playbackRate = /*playbackRate*/ ctx[8];
}
- if (remount) run_all(dispose);
-
- dispose = [
- listen(audio, "progress", /*audio_progress_handler*/ ctx[11]),
- listen(audio, "loadedmetadata", /*audio_loadedmetadata_handler*/ ctx[12]),
- listen(audio, "timeupdate", audio_timeupdate_handler),
- listen(audio, "durationchange", /*audio_durationchange_handler*/ ctx[14]),
- listen(audio, "play", /*audio_play_pause_handler*/ ctx[15]),
- listen(audio, "pause", /*audio_play_pause_handler*/ ctx[15]),
- listen(audio, "volumechange", /*audio_volumechange_handler*/ ctx[16]),
- listen(audio, "ratechange", /*audio_ratechange_handler*/ ctx[17]),
- listen(audio, "seeking", /*audio_seeking_seeked_handler*/ ctx[18]),
- listen(audio, "seeked", /*audio_seeking_seeked_handler*/ ctx[18]),
- listen(audio, "ended", /*audio_ended_handler*/ ctx[19])
- ];
+ if (!mounted) {
+ dispose = [
+ listen(audio, "progress", /*audio_progress_handler*/ ctx[11]),
+ listen(audio, "loadedmetadata", /*audio_loadedmetadata_handler*/ ctx[12]),
+ listen(audio, "timeupdate", audio_timeupdate_handler),
+ listen(audio, "durationchange", /*audio_durationchange_handler*/ ctx[14]),
+ listen(audio, "play", /*audio_play_pause_handler*/ ctx[15]),
+ listen(audio, "pause", /*audio_play_pause_handler*/ ctx[15]),
+ listen(audio, "volumechange", /*audio_volumechange_handler*/ ctx[16]),
+ listen(audio, "ratechange", /*audio_ratechange_handler*/ ctx[17]),
+ listen(audio, "seeking", /*audio_seeking_seeked_handler*/ ctx[18]),
+ listen(audio, "seeked", /*audio_seeking_seeked_handler*/ ctx[18]),
+ listen(audio, "ended", /*audio_ended_handler*/ ctx[19])
+ ];
+
+ mounted = true;
+ }
},
p(ctx, [dirty]) {
if (!audio_updating && dirty & /*currentTime*/ 8 && !isNaN(/*currentTime*/ ctx[3])) {
@@ -98,6 +101,7 @@ function create_fragment(ctx) {
o: noop,
d(detaching) {
if (detaching) detach(audio);
+ mounted = false;
run_all(dispose);
}
};
@@ -169,7 +173,7 @@ function instance($$self, $$props, $$invalidate) {
$$invalidate(10, ended);
}
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("buffered" in $$props) $$invalidate(0, buffered = $$props.buffered);
if ("seekable" in $$props) $$invalidate(1, seekable = $$props.seekable);
if ("played" in $$props) $$invalidate(2, played = $$props.played);
diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js
index 2784fd17ac..5a6b8e8bb7 100644
--- a/test/js/samples/non-imported-component/expected.js
+++ b/test/js/samples/non-imported-component/expected.js
@@ -17,10 +17,12 @@ import {
import Imported from "Imported.svelte";
function create_fragment(ctx) {
+ let imported;
let t;
+ let nonimported;
let current;
- const imported = new Imported({});
- const nonimported = new NonImported({});
+ imported = new Imported({});
+ nonimported = new NonImported({});
return {
c() {
diff --git a/test/js/samples/optional-chaining/expected.js b/test/js/samples/optional-chaining/expected.js
new file mode 100644
index 0000000000..8aa94796c1
--- /dev/null
+++ b/test/js/samples/optional-chaining/expected.js
@@ -0,0 +1,189 @@
+/* generated by Svelte vX.Y.Z */
+import {
+ SvelteComponent,
+ attr,
+ create_component,
+ destroy_component,
+ detach,
+ element,
+ init,
+ insert,
+ mount_component,
+ safe_not_equal,
+ set_data,
+ space,
+ text,
+ transition_in,
+ transition_out
+} from "svelte/internal";
+
+function create_fragment(ctx) {
+ let t0_value = /*a*/ ctx[0].normal + "";
+ let t0;
+ let t1_value = /*b*/ ctx[1]?.optional + "";
+ let t1;
+ let t2;
+ let t3_value = /*c*/ ctx[2]["computed"] + "";
+ let t3;
+ let t4_value = /*d*/ ctx[3]?.["computed_optional"] + "";
+ let t4;
+ let t5;
+ let t6_value = /*e*/ ctx[4]() + "";
+ let t6;
+ let t7_value = /*f*/ ctx[5]?.() + "";
+ let t7;
+ let t8;
+ let div;
+ let div_a_value;
+ let div_b_value;
+ let div_c_value;
+ let div_d_value;
+ let div_e_value;
+ let div_f_value;
+ let t9;
+ let component;
+ let current;
+
+ component = new /*Component*/ ctx[6]({
+ props: {
+ a: /*a*/ ctx[0].normal,
+ b: /*b*/ ctx[1]?.optional,
+ c: /*c*/ ctx[2]["computed"],
+ d: /*d*/ ctx[3]?.["computed_optional"],
+ e: /*e*/ ctx[4](),
+ f: /*f*/ ctx[5]?.()
+ }
+ });
+
+ return {
+ c() {
+ t0 = text(t0_value);
+ t1 = text(t1_value);
+ t2 = space();
+ t3 = text(t3_value);
+ t4 = text(t4_value);
+ t5 = space();
+ t6 = text(t6_value);
+ t7 = text(t7_value);
+ t8 = space();
+ div = element("div");
+ t9 = space();
+ create_component(component.$$.fragment);
+ attr(div, "a", div_a_value = /*a*/ ctx[0].normal);
+ attr(div, "b", div_b_value = /*b*/ ctx[1]?.optional);
+ attr(div, "c", div_c_value = /*c*/ ctx[2]["computed"]);
+ attr(div, "d", div_d_value = /*d*/ ctx[3]?.["computed_optional"]);
+ attr(div, "e", div_e_value = /*e*/ ctx[4]());
+ attr(div, "f", div_f_value = /*f*/ ctx[5]?.());
+ },
+ m(target, anchor) {
+ insert(target, t0, anchor);
+ insert(target, t1, anchor);
+ insert(target, t2, anchor);
+ insert(target, t3, anchor);
+ insert(target, t4, anchor);
+ insert(target, t5, anchor);
+ insert(target, t6, anchor);
+ insert(target, t7, anchor);
+ insert(target, t8, anchor);
+ insert(target, div, anchor);
+ insert(target, t9, anchor);
+ mount_component(component, target, anchor);
+ current = true;
+ },
+ p(ctx, [dirty]) {
+ if ((!current || dirty & /*a*/ 1) && t0_value !== (t0_value = /*a*/ ctx[0].normal + "")) set_data(t0, t0_value);
+ if ((!current || dirty & /*b*/ 2) && t1_value !== (t1_value = /*b*/ ctx[1]?.optional + "")) set_data(t1, t1_value);
+ if ((!current || dirty & /*c*/ 4) && t3_value !== (t3_value = /*c*/ ctx[2]["computed"] + "")) set_data(t3, t3_value);
+ if ((!current || dirty & /*d*/ 8) && t4_value !== (t4_value = /*d*/ ctx[3]?.["computed_optional"] + "")) set_data(t4, t4_value);
+ if ((!current || dirty & /*e*/ 16) && t6_value !== (t6_value = /*e*/ ctx[4]() + "")) set_data(t6, t6_value);
+ if ((!current || dirty & /*f*/ 32) && t7_value !== (t7_value = /*f*/ ctx[5]?.() + "")) set_data(t7, t7_value);
+
+ if (!current || dirty & /*a*/ 1 && div_a_value !== (div_a_value = /*a*/ ctx[0].normal)) {
+ attr(div, "a", div_a_value);
+ }
+
+ if (!current || dirty & /*b*/ 2 && div_b_value !== (div_b_value = /*b*/ ctx[1]?.optional)) {
+ attr(div, "b", div_b_value);
+ }
+
+ if (!current || dirty & /*c*/ 4 && div_c_value !== (div_c_value = /*c*/ ctx[2]["computed"])) {
+ attr(div, "c", div_c_value);
+ }
+
+ if (!current || dirty & /*d*/ 8 && div_d_value !== (div_d_value = /*d*/ ctx[3]?.["computed_optional"])) {
+ attr(div, "d", div_d_value);
+ }
+
+ if (!current || dirty & /*e*/ 16 && div_e_value !== (div_e_value = /*e*/ ctx[4]())) {
+ attr(div, "e", div_e_value);
+ }
+
+ if (!current || dirty & /*f*/ 32 && div_f_value !== (div_f_value = /*f*/ ctx[5]?.())) {
+ attr(div, "f", div_f_value);
+ }
+
+ const component_changes = {};
+ if (dirty & /*a*/ 1) component_changes.a = /*a*/ ctx[0].normal;
+ if (dirty & /*b*/ 2) component_changes.b = /*b*/ ctx[1]?.optional;
+ if (dirty & /*c*/ 4) component_changes.c = /*c*/ ctx[2]["computed"];
+ if (dirty & /*d*/ 8) component_changes.d = /*d*/ ctx[3]?.["computed_optional"];
+ if (dirty & /*e*/ 16) component_changes.e = /*e*/ ctx[4]();
+ if (dirty & /*f*/ 32) component_changes.f = /*f*/ ctx[5]?.();
+ component.$set(component_changes);
+ },
+ i(local) {
+ if (current) return;
+ transition_in(component.$$.fragment, local);
+ current = true;
+ },
+ o(local) {
+ transition_out(component.$$.fragment, local);
+ current = false;
+ },
+ d(detaching) {
+ if (detaching) detach(t0);
+ if (detaching) detach(t1);
+ if (detaching) detach(t2);
+ if (detaching) detach(t3);
+ if (detaching) detach(t4);
+ if (detaching) detach(t5);
+ if (detaching) detach(t6);
+ if (detaching) detach(t7);
+ if (detaching) detach(t8);
+ if (detaching) detach(div);
+ if (detaching) detach(t9);
+ destroy_component(component, detaching);
+ }
+ };
+}
+
+function instance($$self, $$props, $$invalidate) {
+ let { a } = $$props;
+ let { b } = $$props;
+ let { c } = $$props;
+ let { d } = $$props;
+ let { e } = $$props;
+ let { f } = $$props;
+ let Component;
+
+ $$self.$$set = $$props => {
+ if ("a" in $$props) $$invalidate(0, a = $$props.a);
+ if ("b" in $$props) $$invalidate(1, b = $$props.b);
+ if ("c" in $$props) $$invalidate(2, c = $$props.c);
+ if ("d" in $$props) $$invalidate(3, d = $$props.d);
+ if ("e" in $$props) $$invalidate(4, e = $$props.e);
+ if ("f" in $$props) $$invalidate(5, f = $$props.f);
+ };
+
+ return [a, b, c, d, e, f, Component];
+}
+
+class Component_1 extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance, create_fragment, safe_not_equal, { a: 0, b: 1, c: 2, d: 3, e: 4, f: 5 });
+ }
+}
+
+export default Component_1;
\ No newline at end of file
diff --git a/test/js/samples/optional-chaining/input.svelte b/test/js/samples/optional-chaining/input.svelte
new file mode 100644
index 0000000000..78edf2ca85
--- /dev/null
+++ b/test/js/samples/optional-chaining/input.svelte
@@ -0,0 +1,31 @@
+
+
+{a.normal}{b?.optional}
+{c['computed']}{d?.['computed_optional']}
+{e()}{f?.()}
+
+
+
+
diff --git a/test/js/samples/reactive-values-non-topologically-ordered/expected.js b/test/js/samples/reactive-values-non-topologically-ordered/expected.js
index 3d266f10ac..15290496d5 100644
--- a/test/js/samples/reactive-values-non-topologically-ordered/expected.js
+++ b/test/js/samples/reactive-values-non-topologically-ordered/expected.js
@@ -6,7 +6,7 @@ function instance($$self, $$props, $$invalidate) {
let a;
let b;
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("x" in $$props) $$invalidate(0, x = $$props.x);
};
diff --git a/test/js/samples/reactive-values-non-writable-dependencies/expected.js b/test/js/samples/reactive-values-non-writable-dependencies/expected.js
index 38bd356d85..5196a770d9 100644
--- a/test/js/samples/reactive-values-non-writable-dependencies/expected.js
+++ b/test/js/samples/reactive-values-non-writable-dependencies/expected.js
@@ -5,7 +5,7 @@ function instance($$self, $$props, $$invalidate) {
let { a = 1 } = $$props;
let { b = 2 } = $$props;
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("a" in $$props) $$invalidate(0, a = $$props.a);
if ("b" in $$props) $$invalidate(1, b = $$props.b);
};
diff --git a/test/js/samples/select-dynamic-value/expected.js b/test/js/samples/select-dynamic-value/expected.js
index a93a47bd3a..8777cd2600 100644
--- a/test/js/samples/select-dynamic-value/expected.js
+++ b/test/js/samples/select-dynamic-value/expected.js
@@ -7,14 +7,14 @@ import {
init,
insert,
noop,
- safe_not_equal
+ safe_not_equal,
+ select_option
} from "svelte/internal";
function create_fragment(ctx) {
let select;
let option0;
let option1;
- let select_value_value;
return {
c() {
@@ -32,27 +32,11 @@ function create_fragment(ctx) {
insert(target, select, anchor);
append(select, option0);
append(select, option1);
- select_value_value = /*current*/ ctx[0];
-
- for (var i = 0; i < select.options.length; i += 1) {
- var option = select.options[i];
-
- if (option.__value === select_value_value) {
- option.selected = true;
- break;
- }
- }
+ select_option(select, /*current*/ ctx[0]);
},
p(ctx, [dirty]) {
- if (dirty & /*current*/ 1 && select_value_value !== (select_value_value = /*current*/ ctx[0])) {
- for (var i = 0; i < select.options.length; i += 1) {
- var option = select.options[i];
-
- if (option.__value === select_value_value) {
- option.selected = true;
- break;
- }
- }
+ if (dirty & /*current*/ 1) {
+ select_option(select, /*current*/ ctx[0]);
}
},
i: noop,
@@ -66,7 +50,7 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { current } = $$props;
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("current" in $$props) $$invalidate(0, current = $$props.current);
};
diff --git a/test/js/samples/src-attribute-check/expected.js b/test/js/samples/src-attribute-check/expected.js
index e03b3a6ba7..93638edfb4 100644
--- a/test/js/samples/src-attribute-check/expected.js
+++ b/test/js/samples/src-attribute-check/expected.js
@@ -67,7 +67,7 @@ function instance($$self, $$props, $$invalidate) {
let { url } = $$props;
let { slug } = $$props;
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("url" in $$props) $$invalidate(0, url = $$props.url);
if ("slug" in $$props) $$invalidate(1, slug = $$props.slug);
};
diff --git a/test/js/samples/ssr-no-oncreate-etc/expected.js b/test/js/samples/ssr-no-oncreate-etc/expected.js
index 803f06a882..b91deb3e97 100644
--- a/test/js/samples/ssr-no-oncreate-etc/expected.js
+++ b/test/js/samples/ssr-no-oncreate-etc/expected.js
@@ -15,7 +15,7 @@ function swipe(node, callback) {
} // TODO implement
-const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
+const Component = create_ssr_component(($$result, $$props, $$bindings, slots) => {
onMount(() => {
console.log("onMount");
});
diff --git a/test/js/samples/ssr-preserve-comments/expected.js b/test/js/samples/ssr-preserve-comments/expected.js
index 1dc12710c0..de9fa7582e 100644
--- a/test/js/samples/ssr-preserve-comments/expected.js
+++ b/test/js/samples/ssr-preserve-comments/expected.js
@@ -1,7 +1,7 @@
/* generated by Svelte vX.Y.Z */
import { create_ssr_component } from "svelte/internal";
-const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
+const Component = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `content
more content
`;
diff --git a/test/js/samples/title/expected.js b/test/js/samples/title/expected.js
index d4e7e1a584..b10f569759 100644
--- a/test/js/samples/title/expected.js
+++ b/test/js/samples/title/expected.js
@@ -22,7 +22,7 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { custom } = $$props;
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("custom" in $$props) $$invalidate(0, custom = $$props.custom);
};
diff --git a/test/js/samples/transition-local/expected.js b/test/js/samples/transition-local/expected.js
index 25a03f026f..ea3d9db3d7 100644
--- a/test/js/samples/transition-local/expected.js
+++ b/test/js/samples/transition-local/expected.js
@@ -124,7 +124,7 @@ function instance($$self, $$props, $$invalidate) {
let { x } = $$props;
let { y } = $$props;
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("x" in $$props) $$invalidate(0, x = $$props.x);
if ("y" in $$props) $$invalidate(1, y = $$props.y);
};
diff --git a/test/js/samples/transition-repeated-outro/expected.js b/test/js/samples/transition-repeated-outro/expected.js
index 1f76a93666..12483ab91a 100644
--- a/test/js/samples/transition-repeated-outro/expected.js
+++ b/test/js/samples/transition-repeated-outro/expected.js
@@ -102,7 +102,7 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { num = 1 } = $$props;
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("num" in $$props) $$invalidate(0, num = $$props.num);
};
diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js
index 5be8808edb..d07411518e 100644
--- a/test/js/samples/use-elements-as-anchors/expected.js
+++ b/test/js/samples/use-elements-as-anchors/expected.js
@@ -243,7 +243,7 @@ function instance($$self, $$props, $$invalidate) {
let { d } = $$props;
let { e } = $$props;
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("a" in $$props) $$invalidate(0, a = $$props.a);
if ("b" in $$props) $$invalidate(1, b = $$props.b);
if ("c" in $$props) $$invalidate(2, c = $$props.c);
diff --git a/test/js/samples/video-bindings/expected.js b/test/js/samples/video-bindings/expected.js
index 9c5467e1a0..8afa670bbb 100644
--- a/test/js/samples/video-bindings/expected.js
+++ b/test/js/samples/video-bindings/expected.js
@@ -19,6 +19,7 @@ function create_fragment(ctx) {
let video_updating = false;
let video_animationframe;
let video_resize_listener;
+ let mounted;
let dispose;
function video_timeupdate_handler() {
@@ -38,15 +39,18 @@ function create_fragment(ctx) {
if (/*videoHeight*/ ctx[1] === void 0 || /*videoWidth*/ ctx[2] === void 0) add_render_callback(() => /*video_resize_handler*/ ctx[5].call(video));
add_render_callback(() => /*video_elementresize_handler*/ ctx[6].call(video));
},
- m(target, anchor, remount) {
+ m(target, anchor) {
insert(target, video, anchor);
video_resize_listener = add_resize_listener(video, /*video_elementresize_handler*/ ctx[6].bind(video));
- if (remount) run_all(dispose);
- dispose = [
- listen(video, "timeupdate", video_timeupdate_handler),
- listen(video, "resize", /*video_resize_handler*/ ctx[5])
- ];
+ if (!mounted) {
+ dispose = [
+ listen(video, "timeupdate", video_timeupdate_handler),
+ listen(video, "resize", /*video_resize_handler*/ ctx[5])
+ ];
+
+ mounted = true;
+ }
},
p(ctx, [dirty]) {
if (!video_updating && dirty & /*currentTime*/ 1 && !isNaN(/*currentTime*/ ctx[0])) {
@@ -60,6 +64,7 @@ function create_fragment(ctx) {
d(detaching) {
if (detaching) detach(video);
video_resize_listener();
+ mounted = false;
run_all(dispose);
}
};
@@ -88,7 +93,7 @@ function instance($$self, $$props, $$invalidate) {
$$invalidate(3, offsetWidth);
}
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("currentTime" in $$props) $$invalidate(0, currentTime = $$props.currentTime);
if ("videoHeight" in $$props) $$invalidate(1, videoHeight = $$props.videoHeight);
if ("videoWidth" in $$props) $$invalidate(2, videoWidth = $$props.videoWidth);
diff --git a/test/js/samples/window-binding-online/expected.js b/test/js/samples/window-binding-online/expected.js
index fa955e4fd5..887195bce1 100644
--- a/test/js/samples/window-binding-online/expected.js
+++ b/test/js/samples/window-binding-online/expected.js
@@ -10,23 +10,27 @@ import {
} from "svelte/internal";
function create_fragment(ctx) {
+ let mounted;
let dispose;
add_render_callback(/*onlinestatuschanged*/ ctx[1]);
return {
c: noop,
- m(target, anchor, remount) {
- if (remount) run_all(dispose);
-
- dispose = [
- listen(window, "online", /*onlinestatuschanged*/ ctx[1]),
- listen(window, "offline", /*onlinestatuschanged*/ ctx[1])
- ];
+ m(target, anchor) {
+ if (!mounted) {
+ dispose = [
+ listen(window, "online", /*onlinestatuschanged*/ ctx[1]),
+ listen(window, "offline", /*onlinestatuschanged*/ ctx[1])
+ ];
+
+ mounted = true;
+ }
},
p: noop,
i: noop,
o: noop,
d(detaching) {
+ mounted = false;
run_all(dispose);
}
};
diff --git a/test/js/samples/window-binding-scroll/expected.js b/test/js/samples/window-binding-scroll/expected.js
index 30723cc142..09a4d3737d 100644
--- a/test/js/samples/window-binding-scroll/expected.js
+++ b/test/js/samples/window-binding-scroll/expected.js
@@ -25,6 +25,7 @@ function create_fragment(ctx) {
let p;
let t0;
let t1;
+ let mounted;
let dispose;
add_render_callback(/*onwindowscroll*/ ctx[1]);
@@ -34,18 +35,21 @@ function create_fragment(ctx) {
t0 = text("scrolled to ");
t1 = text(/*y*/ ctx[0]);
},
- m(target, anchor, remount) {
+ m(target, anchor) {
insert(target, p, anchor);
append(p, t0);
append(p, t1);
- if (remount) dispose();
- dispose = listen(window, "scroll", () => {
- scrolling = true;
- clearTimeout(scrolling_timeout);
- scrolling_timeout = setTimeout(clear_scrolling, 100);
- /*onwindowscroll*/ ctx[1]();
- });
+ if (!mounted) {
+ dispose = listen(window, "scroll", () => {
+ scrolling = true;
+ clearTimeout(scrolling_timeout);
+ scrolling_timeout = setTimeout(clear_scrolling, 100);
+ /*onwindowscroll*/ ctx[1]();
+ });
+
+ mounted = true;
+ }
},
p(ctx, [dirty]) {
if (dirty & /*y*/ 1 && !scrolling) {
@@ -61,6 +65,7 @@ function create_fragment(ctx) {
o: noop,
d(detaching) {
if (detaching) detach(p);
+ mounted = false;
dispose();
}
};
@@ -73,7 +78,7 @@ function instance($$self, $$props, $$invalidate) {
$$invalidate(0, y = window.pageYOffset)
}
- $$self.$set = $$props => {
+ $$self.$$set = $$props => {
if ("y" in $$props) $$invalidate(0, y = $$props.y);
};
diff --git a/test/parser/index.js b/test/parser/index.js
index 27c5ec1563..2c8d516a7d 100644
--- a/test/parser/index.js
+++ b/test/parser/index.js
@@ -20,7 +20,7 @@ describe('parse', () => {
(skip ? it.skip : solo ? it.only : it)(dir, () => {
const options = tryToLoadJson(`${__dirname}/samples/${dir}/options.json`) || {};
- const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8').replace(/\s+$/, '');
+ const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8').replace(/\s+$/, '').replace(/\r/g, "");
const expectedOutput = tryToLoadJson(`${__dirname}/samples/${dir}/output.json`);
const expectedError = tryToLoadJson(`${__dirname}/samples/${dir}/error.json`);
@@ -38,13 +38,9 @@ describe('parse', () => {
} catch (err) {
if (err.name !== 'ParseError') throw err;
if (!expectedError) throw err;
-
+ const { code, message, pos, start } = err
try {
- assert.equal(err.code, expectedError.code);
- assert.equal(err.message, expectedError.message);
- assert.deepEqual(err.start, expectedError.start);
- assert.equal(err.pos, expectedError.pos);
- assert.equal(err.toString().split('\n')[0], `${expectedError.message} (${expectedError.start.line}:${expectedError.start.column})`);
+ assert.deepEqual({ code, message, pos, start }, expectedError);
} catch (err2) {
const e = err2.code === 'MODULE_NOT_FOUND' ? err : err2;
throw e;
diff --git a/test/parser/samples/action-with-call/output.json b/test/parser/samples/action-with-call/output.json
index ccb4011c67..66c569dc5a 100644
--- a/test/parser/samples/action-with-call/output.json
+++ b/test/parser/samples/action-with-call/output.json
@@ -64,7 +64,8 @@
"value": "tooltip msg",
"raw": "'tooltip msg'"
}
- ]
+ ],
+ "optional": false
}
}
],
diff --git a/test/parser/samples/animation/output.json b/test/parser/samples/animation/output.json
index 1958ba2817..11195009c8 100644
--- a/test/parser/samples/animation/output.json
+++ b/test/parser/samples/animation/output.json
@@ -52,10 +52,10 @@
}
],
"context": {
- "start": 17,
- "end": 22,
"type": "Identifier",
- "name": "thing"
+ "name": "thing",
+ "start": 17,
+ "end": 22
},
"key": {
"type": "Identifier",
diff --git a/test/parser/samples/await-catch/output.json b/test/parser/samples/await-catch/output.json
index c543583018..91862b5366 100644
--- a/test/parser/samples/await-catch/output.json
+++ b/test/parser/samples/await-catch/output.json
@@ -26,10 +26,10 @@
},
"value": null,
"error": {
- "start": 47,
- "end": 55,
"type": "Identifier",
- "name": "theError"
+ "name": "theError",
+ "start": 47,
+ "end": 55
},
"pending": {
"start": 19,
@@ -152,7 +152,8 @@
},
"name": "message"
},
- "computed": false
+ "computed": false,
+ "optional": false
}
}
]
diff --git a/test/parser/samples/await-then-catch/output.json b/test/parser/samples/await-then-catch/output.json
index 8e4b7a4c32..e377d3fa3e 100644
--- a/test/parser/samples/await-then-catch/output.json
+++ b/test/parser/samples/await-then-catch/output.json
@@ -25,16 +25,16 @@
"name": "thePromise"
},
"value": {
- "start": 46,
- "end": 54,
"type": "Identifier",
- "name": "theValue"
+ "name": "theValue",
+ "start": 46,
+ "end": 54
},
"error": {
- "start": 96,
- "end": 104,
"type": "Identifier",
- "name": "theError"
+ "name": "theError",
+ "start": 96,
+ "end": 104
},
"pending": {
"start": 19,
@@ -209,7 +209,8 @@
},
"name": "message"
},
- "computed": false
+ "computed": false,
+ "optional": false
}
}
]
diff --git a/test/parser/samples/dynamic-import/output.json b/test/parser/samples/dynamic-import/output.json
index 1e41252afa..ed3d58782d 100644
--- a/test/parser/samples/dynamic-import/output.json
+++ b/test/parser/samples/dynamic-import/output.json
@@ -275,7 +275,8 @@
},
"name": "then"
},
- "computed": false
+ "computed": false,
+ "optional": false
},
"arguments": [
{
@@ -403,7 +404,8 @@
},
"name": "log"
},
- "computed": false
+ "computed": false,
+ "optional": false
},
"arguments": [
{
@@ -452,21 +454,25 @@
},
"name": "default"
},
- "computed": false
+ "computed": false,
+ "optional": false
}
- ]
+ ],
+ "optional": false
}
}
]
}
}
- ]
+ ],
+ "optional": false
}
}
]
}
}
- ]
+ ],
+ "optional": false
}
}
],
diff --git a/test/parser/samples/each-block-else/output.json b/test/parser/samples/each-block-else/output.json
index 2720ce5292..622789d177 100644
--- a/test/parser/samples/each-block-else/output.json
+++ b/test/parser/samples/each-block-else/output.json
@@ -57,10 +57,10 @@
}
],
"context": {
- "start": 18,
- "end": 24,
"type": "Identifier",
- "name": "animal"
+ "name": "animal",
+ "start": 18,
+ "end": 24
},
"else": {
"start": 50,
diff --git a/test/parser/samples/each-block-indexed/output.json b/test/parser/samples/each-block-indexed/output.json
index 50f2000a36..01b97ffcb4 100644
--- a/test/parser/samples/each-block-indexed/output.json
+++ b/test/parser/samples/each-block-indexed/output.json
@@ -85,10 +85,10 @@
}
],
"context": {
- "start": 18,
- "end": 24,
"type": "Identifier",
- "name": "animal"
+ "name": "animal",
+ "start": 18,
+ "end": 24
},
"index": "i"
}
diff --git a/test/parser/samples/each-block-keyed/output.json b/test/parser/samples/each-block-keyed/output.json
index 7dc8681453..6eaf19a82d 100644
--- a/test/parser/samples/each-block-keyed/output.json
+++ b/test/parser/samples/each-block-keyed/output.json
@@ -57,10 +57,10 @@
}
],
"context": {
- "start": 16,
- "end": 20,
"type": "Identifier",
- "name": "todo"
+ "name": "todo",
+ "start": 16,
+ "end": 20
},
"key": {
"type": "MemberExpression",
@@ -108,7 +108,8 @@
},
"name": "id"
},
- "computed": false
+ "computed": false,
+ "optional": false
}
}
]
diff --git a/test/parser/samples/each-block/output.json b/test/parser/samples/each-block/output.json
index 6594fb50a6..82d4455d19 100644
--- a/test/parser/samples/each-block/output.json
+++ b/test/parser/samples/each-block/output.json
@@ -57,10 +57,10 @@
}
],
"context": {
- "start": 18,
- "end": 24,
"type": "Identifier",
- "name": "animal"
+ "name": "animal",
+ "start": 18,
+ "end": 24
}
}
]
diff --git a/test/parser/samples/error-css-global-without-selector/error.json b/test/parser/samples/error-css-global-without-selector/error.json
new file mode 100644
index 0000000000..f4237c65d3
--- /dev/null
+++ b/test/parser/samples/error-css-global-without-selector/error.json
@@ -0,0 +1,10 @@
+{
+ "code": "css-syntax-error",
+ "message": ":global() must contain a selector",
+ "start": {
+ "line": 2,
+ "column": 1,
+ "character": 9
+ },
+ "pos": 9
+}
diff --git a/test/parser/samples/error-css-global-without-selector/input.svelte b/test/parser/samples/error-css-global-without-selector/input.svelte
new file mode 100644
index 0000000000..a626136cfc
--- /dev/null
+++ b/test/parser/samples/error-css-global-without-selector/input.svelte
@@ -0,0 +1,3 @@
+
diff --git a/test/parser/samples/error-unmatched-closing-tag-autoclose-2/error.json b/test/parser/samples/error-unmatched-closing-tag-autoclose-2/error.json
new file mode 100644
index 0000000000..d24296bd96
--- /dev/null
+++ b/test/parser/samples/error-unmatched-closing-tag-autoclose-2/error.json
@@ -0,0 +1,10 @@
+{
+ "code": "invalid-closing-tag",
+ "message": " attempted to close an element that was not open",
+ "pos": 38,
+ "start": {
+ "character": 38,
+ "column": 0,
+ "line": 5
+ }
+}
diff --git a/test/parser/samples/error-unmatched-closing-tag-autoclose-2/input.svelte b/test/parser/samples/error-unmatched-closing-tag-autoclose-2/input.svelte
new file mode 100644
index 0000000000..5182577921
--- /dev/null
+++ b/test/parser/samples/error-unmatched-closing-tag-autoclose-2/input.svelte
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/test/parser/samples/error-unmatched-closing-tag-autoclose/error.json b/test/parser/samples/error-unmatched-closing-tag-autoclose/error.json
new file mode 100644
index 0000000000..e6532d747e
--- /dev/null
+++ b/test/parser/samples/error-unmatched-closing-tag-autoclose/error.json
@@ -0,0 +1,10 @@
+{
+ "code": "invalid-closing-tag",
+ "message": " attempted to close that was already automatically closed by
",
+ "pos": 24,
+ "start": {
+ "character": 24,
+ "column": 0,
+ "line": 3
+ }
+}
diff --git a/test/parser/samples/error-unmatched-closing-tag-autoclose/input.svelte b/test/parser/samples/error-unmatched-closing-tag-autoclose/input.svelte
new file mode 100644
index 0000000000..0bfd609736
--- /dev/null
+++ b/test/parser/samples/error-unmatched-closing-tag-autoclose/input.svelte
@@ -0,0 +1,3 @@
+
+
pre tag
+
\ No newline at end of file
diff --git a/test/parser/samples/no-error-if-before-closing/output.json b/test/parser/samples/no-error-if-before-closing/output.json
index 708128a42e..f22586b267 100644
--- a/test/parser/samples/no-error-if-before-closing/output.json
+++ b/test/parser/samples/no-error-if-before-closing/output.json
@@ -116,10 +116,10 @@
"raw": "true"
},
"value": {
- "start": 97,
- "end": 98,
"type": "Identifier",
- "name": "f"
+ "name": "f",
+ "start": 97,
+ "end": 98
},
"error": null,
"pending": {
@@ -204,10 +204,10 @@
"raw": "true"
},
"value": {
- "start": 137,
- "end": 138,
"type": "Identifier",
- "name": "f"
+ "name": "f",
+ "start": 137,
+ "end": 138
},
"error": null,
"pending": {
diff --git a/test/parser/samples/unusual-identifier/output.json b/test/parser/samples/unusual-identifier/output.json
index 76cc82cfd6..3d209d35fe 100644
--- a/test/parser/samples/unusual-identifier/output.json
+++ b/test/parser/samples/unusual-identifier/output.json
@@ -57,10 +57,10 @@
}
],
"context": {
- "start": 17,
- "end": 19,
"type": "Identifier",
- "name": "𐊧"
+ "name": "𐊧",
+ "start": 17,
+ "end": 19
}
}
]
diff --git a/test/preprocess/samples/comments/_config.js b/test/preprocess/samples/comments/_config.js
index 4416d121d0..fdec377567 100644
--- a/test/preprocess/samples/comments/_config.js
+++ b/test/preprocess/samples/comments/_config.js
@@ -2,7 +2,7 @@ export default {
preprocess: [
{
script: ({ content }) => ({ code: content.replace(/one/g, 'two') }),
- style: ({ content }) => ({ code: content.replace(/one/g, 'three') }),
- },
- ],
+ style: ({ content }) => ({ code: content.replace(/one/g, 'three') })
+ }
+ ]
};
diff --git a/test/preprocess/samples/script-self-closing/_config.js b/test/preprocess/samples/script-self-closing/_config.js
new file mode 100644
index 0000000000..4baab9730e
--- /dev/null
+++ b/test/preprocess/samples/script-self-closing/_config.js
@@ -0,0 +1,12 @@
+import * as assert from "assert";
+
+export default {
+ preprocess: {
+ script: ({ content, attributes }) => {
+ assert.equal(content, "");
+ return {
+ code: `console.log("${attributes["the-answer"]}");`
+ };
+ }
+ }
+};
diff --git a/test/preprocess/samples/script-self-closing/input.svelte b/test/preprocess/samples/script-self-closing/input.svelte
new file mode 100644
index 0000000000..c5816cb3ba
--- /dev/null
+++ b/test/preprocess/samples/script-self-closing/input.svelte
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test/preprocess/samples/script-self-closing/output.svelte b/test/preprocess/samples/script-self-closing/output.svelte
new file mode 100644
index 0000000000..2912876880
--- /dev/null
+++ b/test/preprocess/samples/script-self-closing/output.svelte
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test/preprocess/samples/style-self-closing/_config.js b/test/preprocess/samples/style-self-closing/_config.js
new file mode 100644
index 0000000000..0a05cd3d64
--- /dev/null
+++ b/test/preprocess/samples/style-self-closing/_config.js
@@ -0,0 +1,12 @@
+import * as assert from "assert";
+
+export default {
+ preprocess: {
+ style: ({ content, attributes: { color } }) => {
+ assert.equal(content, "");
+ return {
+ code: `div { color: ${color}; }`
+ };
+ }
+ }
+};
diff --git a/test/preprocess/samples/style-self-closing/input.svelte b/test/preprocess/samples/style-self-closing/input.svelte
new file mode 100644
index 0000000000..07176c87e5
--- /dev/null
+++ b/test/preprocess/samples/style-self-closing/input.svelte
@@ -0,0 +1,3 @@
+$brand
+
+
\ No newline at end of file
diff --git a/test/preprocess/samples/style-self-closing/output.svelte b/test/preprocess/samples/style-self-closing/output.svelte
new file mode 100644
index 0000000000..c376cd00cb
--- /dev/null
+++ b/test/preprocess/samples/style-self-closing/output.svelte
@@ -0,0 +1,3 @@
+$brand
+
+
\ No newline at end of file
diff --git a/test/runtime/index.js b/test/runtime/index.js
index f070eb8185..65157196c9 100644
--- a/test/runtime/index.js
+++ b/test/runtime/index.js
@@ -39,7 +39,7 @@ describe("runtime", () => {
filename
}, compileOptions);
- const { js: { code } } = compile(fs.readFileSync(filename, "utf-8"), options);
+ const { js: { code } } = compile(fs.readFileSync(filename, "utf-8").replace(/\r/g, ""), options);
return module._compile(code, filename);
};
@@ -103,7 +103,7 @@ describe("runtime", () => {
try {
const { js } = compile(
- fs.readFileSync(`${cwd}/${file}`, 'utf-8'),
+ fs.readFileSync(`${cwd}/${file}`, 'utf-8').replace(/\r/g, ""),
{
...compileOptions,
filename: file
diff --git a/test/runtime/samples/$$rest-without-props/_config.js b/test/runtime/samples/$$rest-without-props/_config.js
index 017f9df561..1fb8e85a6a 100644
--- a/test/runtime/samples/$$rest-without-props/_config.js
+++ b/test/runtime/samples/$$rest-without-props/_config.js
@@ -11,7 +11,7 @@ export default {
`,
- async test({ assert, target, window, }) {
+ async test({ assert, target, window }) {
const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button');
const clickEvent = new window.MouseEvent('click');
diff --git a/test/runtime/samples/$$rest/_config.js b/test/runtime/samples/$$rest/_config.js
index 255927f354..f00c26d712 100644
--- a/test/runtime/samples/$$rest/_config.js
+++ b/test/runtime/samples/$$rest/_config.js
@@ -13,7 +13,7 @@ export default {
`,
- async test({ assert, target, window, }) {
+ async test({ assert, target, window }) {
const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button');
const clickEvent = new window.MouseEvent('click');
diff --git a/test/runtime/samples/$$slot/A.svelte b/test/runtime/samples/$$slot/A.svelte
new file mode 100644
index 0000000000..ffa166166c
--- /dev/null
+++ b/test/runtime/samples/$$slot/A.svelte
@@ -0,0 +1,31 @@
+
+
+
+
+
+$$slots: {toString($$slots)}
+
+{#if $$slots.b}
+
+
+
+{:else}
+ Slot b is not available
+{/if}
\ No newline at end of file
diff --git a/test/runtime/samples/$$slot/_config.js b/test/runtime/samples/$$slot/_config.js
new file mode 100644
index 0000000000..13b2137cdb
--- /dev/null
+++ b/test/runtime/samples/$$slot/_config.js
@@ -0,0 +1,18 @@
+export default {
+ html: `
+ bye world
+ hello world
+ $$slots: {"a":true,"default":true}
+ Slot b is not available
+
+ bye world
+ hello world
+ $$slots: {"a":true,"b":true,"default":true}
+ hello world
+ `,
+
+ async test({ assert, target, component }) {
+ assert.equal(component.getA(), '');
+ assert.equal(component.getB(), 'foo');
+ }
+};
diff --git a/test/runtime/samples/$$slot/main.svelte b/test/runtime/samples/$$slot/main.svelte
new file mode 100644
index 0000000000..8b7efae573
--- /dev/null
+++ b/test/runtime/samples/$$slot/main.svelte
@@ -0,0 +1,23 @@
+
+
+
+ hello world
+ bye
+ world
+
+
+
+ hello world
+ hello world
+ bye world
+
diff --git a/test/runtime/samples/action-custom-event-handler-this/_config.js b/test/runtime/samples/action-custom-event-handler-this/_config.js
index 88a30232ab..754f813c7f 100644
--- a/test/runtime/samples/action-custom-event-handler-this/_config.js
+++ b/test/runtime/samples/action-custom-event-handler-this/_config.js
@@ -18,5 +18,5 @@ export default {
input.dispatchEvent(event);
assert.ok(blurred);
- },
+ }
};
diff --git a/test/runtime/samples/action-ternary-template/_config.js b/test/runtime/samples/action-ternary-template/_config.js
index adf23a9f68..ecb18dceec 100644
--- a/test/runtime/samples/action-ternary-template/_config.js
+++ b/test/runtime/samples/action-ternary-template/_config.js
@@ -1,7 +1,7 @@
export default {
props: {
target: 'World!',
- display: true,
+ display: true
},
html: `
@@ -16,5 +16,5 @@ export default {
assert.htmlEqual(target.innerHTML, `
Hello World!
`);
- },
+ }
};
diff --git a/test/runtime/samples/action-this/_config.js b/test/runtime/samples/action-this/_config.js
index de7f834cdc..c59ff3b634 100644
--- a/test/runtime/samples/action-this/_config.js
+++ b/test/runtime/samples/action-this/_config.js
@@ -7,5 +7,5 @@ export default {
await button.dispatchEvent(click);
await Promise.resolve();
assert.htmlEqual(target.innerHTML, `2 `);
- },
+ }
};
diff --git a/test/runtime/samples/apply-directives-in-order-2/_config.js b/test/runtime/samples/apply-directives-in-order-2/_config.js
index a74ce41cb6..caff97a5b9 100644
--- a/test/runtime/samples/apply-directives-in-order-2/_config.js
+++ b/test/runtime/samples/apply-directives-in-order-2/_config.js
@@ -1,7 +1,7 @@
const value = [];
export default {
props: {
- value,
+ value
},
async test({ assert, component, target, window }) {
@@ -32,7 +32,7 @@ export default {
'15',
'16',
'17',
- '18',
+ '18'
]);
- },
+ }
};
diff --git a/test/runtime/samples/apply-directives-in-order/_config.js b/test/runtime/samples/apply-directives-in-order/_config.js
index e5e8980ed1..7c8f87ef85 100644
--- a/test/runtime/samples/apply-directives-in-order/_config.js
+++ b/test/runtime/samples/apply-directives-in-order/_config.js
@@ -33,5 +33,5 @@ export default {
HE
`);
- },
+ }
};
diff --git a/test/runtime/samples/attribute-boolean-false/_config.js b/test/runtime/samples/attribute-boolean-false/_config.js
index 14fdeb9fdc..e47c5e7df1 100644
--- a/test/runtime/samples/attribute-boolean-false/_config.js
+++ b/test/runtime/samples/attribute-boolean-false/_config.js
@@ -3,5 +3,5 @@ export default {
test({ assert, component, target }) {
const textarea = target.querySelector('textarea');
assert.ok(textarea.readOnly === false);
- },
+ }
};
diff --git a/test/runtime/samples/attribute-boolean-true/_config.js b/test/runtime/samples/attribute-boolean-true/_config.js
index 0e402ed1e3..1f77e33027 100644
--- a/test/runtime/samples/attribute-boolean-true/_config.js
+++ b/test/runtime/samples/attribute-boolean-true/_config.js
@@ -3,5 +3,5 @@ export default {
test({ assert, component, target }) {
const textarea = target.querySelector('textarea');
assert.ok(textarea.readOnly);
- },
+ }
};
diff --git a/test/runtime/samples/attribute-dataset-without-value/_config.js b/test/runtime/samples/attribute-dataset-without-value/_config.js
index 934f44eb06..21e60b92aa 100644
--- a/test/runtime/samples/attribute-dataset-without-value/_config.js
+++ b/test/runtime/samples/attribute-dataset-without-value/_config.js
@@ -1,3 +1,3 @@
export default {
- html: '
',
+ html: '
'
};
diff --git a/test/runtime/samples/attribute-dynamic-no-dependencies/_config.js b/test/runtime/samples/attribute-dynamic-no-dependencies/_config.js
index acf3c64bdd..f1088830af 100644
--- a/test/runtime/samples/attribute-dynamic-no-dependencies/_config.js
+++ b/test/runtime/samples/attribute-dynamic-no-dependencies/_config.js
@@ -1,5 +1,5 @@
export default {
html: `
- `,
+ `
};
diff --git a/test/runtime/samples/attribute-false/_config.js b/test/runtime/samples/attribute-false/_config.js
index 9fd08a2a48..632d4ac1c2 100644
--- a/test/runtime/samples/attribute-false/_config.js
+++ b/test/runtime/samples/attribute-false/_config.js
@@ -1,3 +1,3 @@
export default {
- html: `
`,
+ html: `
`
};
diff --git a/test/runtime/samples/attribute-null-classnames-no-style/_config.js b/test/runtime/samples/attribute-null-classnames-no-style/_config.js
index 917cf565c0..e90d81a60f 100644
--- a/test/runtime/samples/attribute-null-classnames-no-style/_config.js
+++ b/test/runtime/samples/attribute-null-classnames-no-style/_config.js
@@ -1,7 +1,7 @@
export default {
props: {
testName1: "test1",
- testName2: "test2",
+ testName2: "test2"
},
html: `
`,
diff --git a/test/runtime/samples/attribute-null-classnames-with-style/_config.js b/test/runtime/samples/attribute-null-classnames-with-style/_config.js
index 5762f628fb..20e6d4c7be 100644
--- a/test/runtime/samples/attribute-null-classnames-with-style/_config.js
+++ b/test/runtime/samples/attribute-null-classnames-with-style/_config.js
@@ -1,7 +1,7 @@
export default {
props: {
testName1: "test1",
- testName2: "test2",
+ testName2: "test2"
},
html: `
`,
diff --git a/test/runtime/samples/attribute-null-func-classnames-no-style/_config.js b/test/runtime/samples/attribute-null-func-classnames-no-style/_config.js
index 917cf565c0..e90d81a60f 100644
--- a/test/runtime/samples/attribute-null-func-classnames-no-style/_config.js
+++ b/test/runtime/samples/attribute-null-func-classnames-no-style/_config.js
@@ -1,7 +1,7 @@
export default {
props: {
testName1: "test1",
- testName2: "test2",
+ testName2: "test2"
},
html: `
`,
diff --git a/test/runtime/samples/attribute-null-func-classnames-with-style/_config.js b/test/runtime/samples/attribute-null-func-classnames-with-style/_config.js
index 5762f628fb..20e6d4c7be 100644
--- a/test/runtime/samples/attribute-null-func-classnames-with-style/_config.js
+++ b/test/runtime/samples/attribute-null-func-classnames-with-style/_config.js
@@ -1,7 +1,7 @@
export default {
props: {
testName1: "test1",
- testName2: "test2",
+ testName2: "test2"
},
html: `
`,
diff --git a/test/runtime/samples/attribute-null/_config.js b/test/runtime/samples/attribute-null/_config.js
index ae2f0a8af6..36955050a0 100644
--- a/test/runtime/samples/attribute-null/_config.js
+++ b/test/runtime/samples/attribute-null/_config.js
@@ -1,3 +1,3 @@
export default {
- html: `
`,
+ html: `
`
};
diff --git a/test/runtime/samples/attribute-prefer-expression/_config.js b/test/runtime/samples/attribute-prefer-expression/_config.js
index 29fcbc7f13..2388ff35df 100644
--- a/test/runtime/samples/attribute-prefer-expression/_config.js
+++ b/test/runtime/samples/attribute-prefer-expression/_config.js
@@ -2,7 +2,7 @@ export default {
skip_if_ssr: true,
props: {
- foo: false,
+ foo: false
},
test({ assert, component, target }) {
@@ -15,5 +15,5 @@ export default {
assert.ok(!inputs[0].checked);
assert.ok(inputs[1].checked);
- },
+ }
};
diff --git a/test/runtime/samples/attribute-undefined/_config.js b/test/runtime/samples/attribute-undefined/_config.js
index ae2f0a8af6..36955050a0 100644
--- a/test/runtime/samples/attribute-undefined/_config.js
+++ b/test/runtime/samples/attribute-undefined/_config.js
@@ -1,3 +1,3 @@
export default {
- html: `
`,
+ html: `
`
};
diff --git a/test/runtime/samples/await-with-update-2/Component.svelte b/test/runtime/samples/await-with-update-2/Component.svelte
new file mode 100644
index 0000000000..1301db3f99
--- /dev/null
+++ b/test/runtime/samples/await-with-update-2/Component.svelte
@@ -0,0 +1,7 @@
+
+
+count: {count}
+value: {value}
\ No newline at end of file
diff --git a/test/runtime/samples/await-with-update-2/_config.js b/test/runtime/samples/await-with-update-2/_config.js
new file mode 100644
index 0000000000..613f2b3255
--- /dev/null
+++ b/test/runtime/samples/await-with-update-2/_config.js
@@ -0,0 +1,64 @@
+export default {
+ props: {
+ thePromise: new Promise((_) => {}),
+ count: 0
+ },
+
+ html: `
+
+ `,
+
+ async test({ assert, component, target }) {
+ await (component.thePromise = Promise.resolve({ value: "success", Component: component.Component }));
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+ Resolved:
+
count: 0
+
value: success
+
+ `
+ );
+
+ component.count = 5;
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+ Resolved:
+
count: 5
+
value: success
+
+ `
+ );
+
+ try {
+ await (component.thePromise = Promise.reject({ value: "failure", Component: component.Component }));
+ } catch (error) {
+ // ignore
+ }
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+ Rejected:
+
count: 5
+
value: failure
+
+ `
+ );
+
+ component.count = 10;
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+ Rejected:
+
count: 10
+
value: failure
+
+ `
+ );
+ }
+};
diff --git a/test/runtime/samples/await-with-update-2/main.svelte b/test/runtime/samples/await-with-update-2/main.svelte
new file mode 100644
index 0000000000..b29c875f92
--- /dev/null
+++ b/test/runtime/samples/await-with-update-2/main.svelte
@@ -0,0 +1,16 @@
+
+
+
+ {#await thePromise}
+
loading...
+ {:then { value: theValue, Component }}
+ Resolved:
+ {:catch { value: theError, Component } }
+ Rejected:
+ {/await}
+
\ No newline at end of file
diff --git a/test/runtime/samples/await-with-update/Component.svelte b/test/runtime/samples/await-with-update/Component.svelte
new file mode 100644
index 0000000000..5f13c80e65
--- /dev/null
+++ b/test/runtime/samples/await-with-update/Component.svelte
@@ -0,0 +1,5 @@
+
+
+count: {count}
\ No newline at end of file
diff --git a/test/runtime/samples/await-with-update/_config.js b/test/runtime/samples/await-with-update/_config.js
new file mode 100644
index 0000000000..08bf12b89e
--- /dev/null
+++ b/test/runtime/samples/await-with-update/_config.js
@@ -0,0 +1,60 @@
+export default {
+ props: {
+ thePromise: new Promise((_) => {}),
+ count: 0
+ },
+
+ html: `
+
+ `,
+
+ async test({ assert, component, target }) {
+ await (component.thePromise = Promise.resolve(component.Component));
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+
+ `
+ );
+
+ component.count = 5;
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+
+ `
+ );
+
+ try {
+ await (component.thePromise = Promise.reject(component.Component));
+ } catch (error) {
+ // ignore
+ }
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+
+ `
+ );
+
+ component.count = 10;
+
+ assert.htmlEqual(
+ target.innerHTML,
+ `
+
+ `
+ );
+ }
+};
diff --git a/test/runtime/samples/await-with-update/main.svelte b/test/runtime/samples/await-with-update/main.svelte
new file mode 100644
index 0000000000..51c5b76a21
--- /dev/null
+++ b/test/runtime/samples/await-with-update/main.svelte
@@ -0,0 +1,16 @@
+
+
+
+ {#await thePromise}
+
loading...
+ {:then theValue}
+ Resolved:
+ {:catch theError}
+ Rejected:
+ {/await}
+
\ No newline at end of file
diff --git a/test/runtime/samples/await-without-catch/_config.js b/test/runtime/samples/await-without-catch/_config.js
new file mode 100644
index 0000000000..2030ed7949
--- /dev/null
+++ b/test/runtime/samples/await-without-catch/_config.js
@@ -0,0 +1,44 @@
+let fulfil;
+
+let promise = new Promise(f => {
+ fulfil = f;
+});
+
+export default {
+ props: {
+ promise
+ },
+
+ html: `
+ loading...
+ `,
+
+ test({ assert, component, target }) {
+ fulfil(42);
+
+ return promise
+ .then(() => {
+ assert.htmlEqual(target.innerHTML, `
+ loaded
+ `);
+
+ let reject;
+
+ promise = new Promise((f, r) => {
+ reject = r;
+ });
+
+ component.promise = promise;
+
+ assert.htmlEqual(target.innerHTML, `
+ loading...
+ `);
+
+ reject(new Error('this error should be thrown'));
+ return promise;
+ })
+ .catch((err) => {
+ assert.equal(err.message, 'this error should be thrown');
+ });
+ }
+};
\ No newline at end of file
diff --git a/test/runtime/samples/await-without-catch/main.svelte b/test/runtime/samples/await-without-catch/main.svelte
new file mode 100644
index 0000000000..f528a8bf69
--- /dev/null
+++ b/test/runtime/samples/await-without-catch/main.svelte
@@ -0,0 +1,9 @@
+
+
+{#await promise}
+ loading...
+{:then value}
+ loaded
+{/await}
\ No newline at end of file
diff --git a/test/runtime/samples/binding-contenteditable-html-initial/_config.js b/test/runtime/samples/binding-contenteditable-html-initial/_config.js
index 9eac2c9b17..4c30a3231a 100644
--- a/test/runtime/samples/binding-contenteditable-html-initial/_config.js
+++ b/test/runtime/samples/binding-contenteditable-html-initial/_config.js
@@ -36,5 +36,5 @@ export default {
goodbye
hello goodbye
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-contenteditable-html/_config.js b/test/runtime/samples/binding-contenteditable-html/_config.js
index ceb6a75c70..639572faea 100644
--- a/test/runtime/samples/binding-contenteditable-html/_config.js
+++ b/test/runtime/samples/binding-contenteditable-html/_config.js
@@ -1,6 +1,6 @@
export default {
props: {
- name: 'world ',
+ name: 'world '
},
html: `
@@ -34,5 +34,5 @@ export default {
goodbye
hello goodbye
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-contenteditable-text-initial/_config.js b/test/runtime/samples/binding-contenteditable-text-initial/_config.js
index 4899f30f12..d5f331bb7a 100644
--- a/test/runtime/samples/binding-contenteditable-text-initial/_config.js
+++ b/test/runtime/samples/binding-contenteditable-text-initial/_config.js
@@ -30,5 +30,5 @@ export default {
goodbye
hello goodbye
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-contenteditable-text/_config.js b/test/runtime/samples/binding-contenteditable-text/_config.js
index 9f8645724d..89f3968258 100644
--- a/test/runtime/samples/binding-contenteditable-text/_config.js
+++ b/test/runtime/samples/binding-contenteditable-text/_config.js
@@ -1,6 +1,6 @@
export default {
props: {
- name: 'world',
+ name: 'world'
},
html: `
@@ -28,5 +28,5 @@ export default {
goodbye
hello goodbye
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js b/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js
index 2e3a1c296f..9d099feb0a 100644
--- a/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js
+++ b/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js
@@ -2,7 +2,7 @@ export default {
skip_if_ssr: true,
props: {
- indeterminate: true,
+ indeterminate: true
},
html: `
@@ -38,5 +38,5 @@ export default {
checked? true
indeterminate? true
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js b/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js
index b502ed40af..9e6f915dd0 100644
--- a/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js
+++ b/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js
@@ -3,13 +3,13 @@ export default {
cats: [
{
name: "cat 0",
- checked: false,
+ checked: false
},
{
name: "cat 1",
- checked: false,
- },
- ],
+ checked: false
+ }
+ ]
},
html: `
@@ -22,7 +22,7 @@ export default {
const newCats = cats.slice();
newCats.push({
name: "cat " + cats.length,
- checked: false,
+ checked: false
});
component.cats = newCats;
diff --git a/test/runtime/samples/binding-input-group-duplicate-value/_config.js b/test/runtime/samples/binding-input-group-duplicate-value/_config.js
new file mode 100644
index 0000000000..7f50ad6dce
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-duplicate-value/_config.js
@@ -0,0 +1,81 @@
+export default {
+ html: `
+ Checked:
+
+
+
+ a
+ b
+ c
+ d
+
+
+
+ a
+ b
+ c
+ d
+ `,
+
+ async test({ assert, component, target, window }) {
+ const inputs = target.querySelectorAll("input");
+ const p = target.querySelector("p");
+
+ assert.equal(inputs[0].checked, false);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, false);
+ assert.equal(inputs[3].checked, false);
+
+ assert.equal(inputs[4].checked, false);
+ assert.equal(inputs[5].checked, false);
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, false);
+
+ const event = new window.Event("change");
+
+ inputs[0].checked = true;
+ await inputs[0].dispatchEvent(event);
+
+ assert.htmlEqual(p.innerHTML, `Checked: a`);
+
+ assert.equal(inputs[0].checked, true);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, false);
+ assert.equal(inputs[3].checked, false);
+
+ assert.equal(inputs[4].checked, true);
+ assert.equal(inputs[5].checked, false);
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, false);
+
+ inputs[3].checked = true;
+ await inputs[3].dispatchEvent(event);
+
+ assert.htmlEqual(p.innerHTML, `Checked: a,d`);
+
+ assert.equal(inputs[0].checked, true);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, false);
+ assert.equal(inputs[3].checked, true);
+
+ assert.equal(inputs[4].checked, true);
+ assert.equal(inputs[5].checked, false);
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, true);
+
+ inputs[4].checked = false;
+ await inputs[4].dispatchEvent(event);
+
+ assert.htmlEqual(p.innerHTML, `Checked: d`);
+
+ assert.equal(inputs[0].checked, false);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, false);
+ assert.equal(inputs[3].checked, true);
+
+ assert.equal(inputs[4].checked, false);
+ assert.equal(inputs[5].checked, false);
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, true);
+ }
+};
diff --git a/test/runtime/samples/binding-input-group-duplicate-value/main.svelte b/test/runtime/samples/binding-input-group-duplicate-value/main.svelte
new file mode 100644
index 0000000000..153e559d23
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-duplicate-value/main.svelte
@@ -0,0 +1,19 @@
+
+
+Checked: {foo}
+
+
+
+ a
+ b
+ c
+ d
+
+
+
+ a
+ b
+ c
+ d
\ No newline at end of file
diff --git a/test/runtime/samples/binding-input-group-each-1/_config.js b/test/runtime/samples/binding-input-group-each-1/_config.js
new file mode 100644
index 0000000000..92010296dc
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-1/_config.js
@@ -0,0 +1,275 @@
+const values = [
+ { name: 'Alpha' },
+ { name: 'Beta' },
+ { name: 'Gamma' }
+];
+
+const selected_array = [
+ [values[1]],
+ [],
+ [values[2]]
+];
+
+export default {
+ props: {
+ values,
+ selected_array
+ },
+
+ html: `
+
+
+
+ `,
+
+ async test({ assert, component, target, window }) {
+ const inputs = target.querySelectorAll('input');
+ assert.equal(inputs[0].checked, false);
+ assert.equal(inputs[1].checked, true);
+ assert.equal(inputs[2].checked, false);
+ assert.equal(inputs[3].checked, false);
+ assert.equal(inputs[4].checked, false);
+ assert.equal(inputs[5].checked, false);
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, false);
+ assert.equal(inputs[8].checked, true);
+
+ const event = new window.Event('change');
+
+ inputs[0].checked = true;
+ await inputs[0].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+ `);
+ inputs[3].checked = true;
+ await inputs[3].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+ `);
+
+ inputs[8].checked = false;
+ await inputs[8].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+ `);
+
+ component.selected_array = [[values[1], values[2]], [values[2]]];
+
+ assert.equal(inputs[0].checked, false);
+ assert.equal(inputs[1].checked, true);
+ assert.equal(inputs[2].checked, true);
+ assert.equal(inputs[3].checked, false);
+ assert.equal(inputs[4].checked, false);
+ assert.equal(inputs[5].checked, true);
+
+ assert.htmlEqual(target.innerHTML, `
+
+
+ `);
+ }
+};
diff --git a/test/runtime/samples/binding-input-group-each-1/main.svelte b/test/runtime/samples/binding-input-group-each-1/main.svelte
new file mode 100644
index 0000000000..5ed255c83a
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-1/main.svelte
@@ -0,0 +1,15 @@
+
+
+{#each selected_array as selected}
+
+ {#each values as value}
+
+ {value.name}
+
+ {/each}
+
{selected.map(v => v.name).join(', ')}
+
+{/each}
diff --git a/test/runtime/samples/binding-input-group-each-2/_config.js b/test/runtime/samples/binding-input-group-each-2/_config.js
new file mode 100644
index 0000000000..78d692d979
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-2/_config.js
@@ -0,0 +1,59 @@
+export default {
+ html: `
+
+ 1
+
+
+ 2
+
+
+ 3
+
+
+ 1, 2, 3
`,
+
+ async test({ assert, component, target, window }) {
+ const inputs = target.querySelectorAll('input');
+ assert.equal(inputs[0].checked, true);
+ assert.equal(inputs[1].checked, true);
+ assert.equal(inputs[2].checked, true);
+
+ const event = new window.Event('change');
+
+ inputs[0].checked = false;
+ await inputs[0].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+
+ 1
+
+
+ 2
+
+
+ 3
+
+
+ 2, 3
+ `);
+
+ component.selected = [[1, 3]];
+ assert.equal(inputs[0].checked, true);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, true);
+
+ assert.htmlEqual(target.innerHTML, `
+
+ 1
+
+
+ 2
+
+
+ 3
+
+
+ 1, 3
+ `);
+ }
+};
diff --git a/test/runtime/samples/binding-input-group-each-2/main.svelte b/test/runtime/samples/binding-input-group-each-2/main.svelte
new file mode 100644
index 0000000000..46f7e9e698
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-2/main.svelte
@@ -0,0 +1,17 @@
+
+
+{#each options as value}
+
+
+ {value}
+
+{/each}
+
+{selected[0].join(', ')}
\ No newline at end of file
diff --git a/test/runtime/samples/binding-input-group-each-3/_config.js b/test/runtime/samples/binding-input-group-each-3/_config.js
new file mode 100644
index 0000000000..92010296dc
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-3/_config.js
@@ -0,0 +1,275 @@
+const values = [
+ { name: 'Alpha' },
+ { name: 'Beta' },
+ { name: 'Gamma' }
+];
+
+const selected_array = [
+ [values[1]],
+ [],
+ [values[2]]
+];
+
+export default {
+ props: {
+ values,
+ selected_array
+ },
+
+ html: `
+
+
+
+ `,
+
+ async test({ assert, component, target, window }) {
+ const inputs = target.querySelectorAll('input');
+ assert.equal(inputs[0].checked, false);
+ assert.equal(inputs[1].checked, true);
+ assert.equal(inputs[2].checked, false);
+ assert.equal(inputs[3].checked, false);
+ assert.equal(inputs[4].checked, false);
+ assert.equal(inputs[5].checked, false);
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, false);
+ assert.equal(inputs[8].checked, true);
+
+ const event = new window.Event('change');
+
+ inputs[0].checked = true;
+ await inputs[0].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+ `);
+ inputs[3].checked = true;
+ await inputs[3].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+ `);
+
+ inputs[8].checked = false;
+ await inputs[8].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+ `);
+
+ component.selected_array = [[values[1], values[2]], [values[2]]];
+
+ assert.equal(inputs[0].checked, false);
+ assert.equal(inputs[1].checked, true);
+ assert.equal(inputs[2].checked, true);
+ assert.equal(inputs[3].checked, false);
+ assert.equal(inputs[4].checked, false);
+ assert.equal(inputs[5].checked, true);
+
+ assert.htmlEqual(target.innerHTML, `
+
+
+ `);
+ }
+};
diff --git a/test/runtime/samples/binding-input-group-each-3/main.svelte b/test/runtime/samples/binding-input-group-each-3/main.svelte
new file mode 100644
index 0000000000..42a7a1c4e9
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-3/main.svelte
@@ -0,0 +1,15 @@
+
+
+{#each selected_array as _, index}
+
+ {#each values as value}
+
+ {value.name}
+
+ {/each}
+
{selected_array[index].map(v => v.name).join(', ')}
+
+{/each}
diff --git a/test/runtime/samples/binding-input-group-each-4/_config.js b/test/runtime/samples/binding-input-group-each-4/_config.js
new file mode 100644
index 0000000000..f1168858b0
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-4/_config.js
@@ -0,0 +1,153 @@
+export default {
+ html: `
+ 1
+ 2
+ 3
+ 1
+ 1
+ 2
+ 3
+ 2
+ 1
+ 2
+ 3
+
+ 1
+ 2
+ 3
+ 3
+ `,
+
+ async test({ assert, component, target, window }) {
+ const inputs = target.querySelectorAll('input');
+ assert.equal(inputs[0].checked, true);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, false);
+
+ assert.equal(inputs[3].checked, false);
+ assert.equal(inputs[4].checked, true);
+ assert.equal(inputs[5].checked, false);
+
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, false);
+ assert.equal(inputs[8].checked, false);
+
+ assert.equal(inputs[9].checked, false);
+ assert.equal(inputs[10].checked, false);
+ assert.equal(inputs[11].checked, true);
+
+ const event = new window.Event('change');
+
+ inputs[2].checked = true;
+ await inputs[2].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ 1
+ 2
+ 3
+ 1, 3
+ 1
+ 2
+ 3
+ 2
+ 1
+ 2
+ 3
+
+ 1
+ 2
+ 3
+ 3
+ `);
+
+ inputs[9].checked = true;
+ await inputs[9].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ 1
+ 2
+ 3
+ 1, 3
+ 1
+ 2
+ 3
+ 2
+ 1
+ 2
+ 3
+
+ 1
+ 2
+ 3
+ 1, 3
+ `);
+
+ inputs[4].checked = false;
+ await inputs[4].dispatchEvent(event);
+ inputs[5].checked = true;
+ await inputs[5].dispatchEvent(event);
+ inputs[6].checked = true;
+ await inputs[6].dispatchEvent(event);
+ inputs[7].checked = true;
+ await inputs[7].dispatchEvent(event);
+ inputs[11].checked = false;
+ await inputs[11].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ 1
+ 2
+ 3
+ 1, 3
+ 1
+ 2
+ 3
+ 3
+ 1
+ 2
+ 3
+ 1, 2
+ 1
+ 2
+ 3
+ 1
+ `);
+
+ component.selected_array_1 = [[3], [1]];
+ component.selected_array_2 = [[], [2]];
+
+ assert.equal(inputs[0].checked, false);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, true);
+
+ assert.equal(inputs[3].checked, true);
+ assert.equal(inputs[4].checked, false);
+ assert.equal(inputs[5].checked, false);
+
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, false);
+ assert.equal(inputs[8].checked, false);
+
+ assert.equal(inputs[9].checked, false);
+ assert.equal(inputs[10].checked, true);
+ assert.equal(inputs[11].checked, false);
+
+ assert.htmlEqual(target.innerHTML, `
+ 1
+ 2
+ 3
+ 3
+ 1
+ 2
+ 3
+ 1
+ 1
+ 2
+ 3
+
+ 1
+ 2
+ 3
+ 2
+ `);
+ }
+};
diff --git a/test/runtime/samples/binding-input-group-each-4/main.svelte b/test/runtime/samples/binding-input-group-each-4/main.svelte
new file mode 100644
index 0000000000..0bbf5ea763
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-4/main.svelte
@@ -0,0 +1,33 @@
+
+
+{#each selected_array_1 as selected}
+ {#each options as value}
+
+
+ {value}
+
+ {/each}
+ {selected.join(', ')}
+{/each}
+
+{#each selected_array_2 as selected}
+ {#each options as value}
+
+
+ {value}
+
+ {/each}
+ {selected.join(', ')}
+{/each}
\ No newline at end of file
diff --git a/test/runtime/samples/binding-input-group-each-5/_config.js b/test/runtime/samples/binding-input-group-each-5/_config.js
new file mode 100644
index 0000000000..579225c627
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-5/_config.js
@@ -0,0 +1,160 @@
+export default {
+ html: `
+ 1
+ 2
+ 3
+ 1
+ 1
+ 2
+ 3
+ 1, 2, 3
+ 1
+ 2
+ 3
+ 2
+ 1
+ 2
+ 3
+ 1
+ `,
+
+ async test({ assert, component, target, window }) {
+ const inputs = target.querySelectorAll('input');
+ assert.equal(inputs[0].checked, true);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, false);
+
+ assert.equal(inputs[3].checked, true);
+ assert.equal(inputs[4].checked, true);
+ assert.equal(inputs[5].checked, true);
+
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, true);
+ assert.equal(inputs[8].checked, false);
+
+ assert.equal(inputs[9].checked, true);
+ assert.equal(inputs[10].checked, false);
+ assert.equal(inputs[11].checked, false);
+
+ const event = new window.Event('change');
+
+ inputs[2].checked = true;
+ await inputs[2].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ 1
+ 2
+ 3
+ 1, 3
+ 1
+ 2
+ 3
+ 1, 2, 3
+ 1
+ 2
+ 3
+ 2
+ 1
+ 2
+ 3
+ 1
+ `);
+
+ inputs[8].checked = true;
+ await inputs[8].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ 1
+ 2
+ 3
+ 1, 3
+ 1
+ 2
+ 3
+ 1, 2, 3
+ 1
+ 2
+ 3
+ 2, 3
+ 1
+ 2
+ 3
+ 1
+ `);
+
+ component.selected_index = [1, 1];
+
+ assert.htmlEqual(target.innerHTML, `
+ 1
+ 2
+ 3
+ 1, 2, 3
+ 1
+ 2
+ 3
+ 1, 2, 3
+ 1
+ 2
+ 3
+ 1
+ 1
+ 2
+ 3
+ 1
+ `);
+
+ assert.equal(inputs[0].checked, true);
+ assert.equal(inputs[1].checked, true);
+ assert.equal(inputs[2].checked, true);
+
+ assert.equal(inputs[3].checked, true);
+ assert.equal(inputs[4].checked, true);
+ assert.equal(inputs[5].checked, true);
+
+ assert.equal(inputs[6].checked, true);
+ assert.equal(inputs[7].checked, false);
+ assert.equal(inputs[8].checked, false);
+
+ assert.equal(inputs[9].checked, true);
+ assert.equal(inputs[10].checked, false);
+ assert.equal(inputs[11].checked, false);
+
+ inputs[5].checked = false;
+ await inputs[5].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ 1
+ 2
+ 3
+ 1, 2
+ 1
+ 2
+ 3
+ 1, 2
+ 1
+ 2
+ 3
+ 1
+ 1
+ 2
+ 3
+ 1
+ `);
+
+ assert.equal(inputs[0].checked, true);
+ assert.equal(inputs[1].checked, true);
+ assert.equal(inputs[2].checked, false);
+
+ assert.equal(inputs[3].checked, true);
+ assert.equal(inputs[4].checked, true);
+ assert.equal(inputs[5].checked, false);
+
+ assert.equal(inputs[6].checked, true);
+ assert.equal(inputs[7].checked, false);
+ assert.equal(inputs[8].checked, false);
+
+ assert.equal(inputs[9].checked, true);
+ assert.equal(inputs[10].checked, false);
+ assert.equal(inputs[11].checked, false);
+ }
+};
diff --git a/test/runtime/samples/binding-input-group-each-5/main.svelte b/test/runtime/samples/binding-input-group-each-5/main.svelte
new file mode 100644
index 0000000000..93bdce6510
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-5/main.svelte
@@ -0,0 +1,24 @@
+
+
+{#each selected_array as selected}
+ {#each selected_index as index}
+ {#each options as value}
+
+
+ {value}
+
+ {/each}
+ {selected[index].join(', ')}
+ {/each}
+{/each}
diff --git a/test/runtime/samples/binding-input-group-each-6/_config.js b/test/runtime/samples/binding-input-group-each-6/_config.js
new file mode 100644
index 0000000000..9eb251bf5d
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-6/_config.js
@@ -0,0 +1,87 @@
+export default {
+ html: `
+ x
+ y
+ z
+
+ x
+ y
+ z
+
+ x
+ y
+ z
+
+ `,
+
+ async test({ assert, component, target, window }) {
+ const inputs = target.querySelectorAll('input');
+ assert.equal(inputs[0].checked, false);
+ assert.equal(inputs[1].checked, false);
+ assert.equal(inputs[2].checked, false);
+
+ assert.equal(inputs[3].checked, false);
+ assert.equal(inputs[4].checked, false);
+ assert.equal(inputs[5].checked, false);
+
+ assert.equal(inputs[6].checked, false);
+ assert.equal(inputs[7].checked, false);
+ assert.equal(inputs[8].checked, false);
+
+ const event = new window.Event('change');
+
+ inputs[2].checked = true;
+ await inputs[2].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ x
+ y
+ z
+ z
+ x
+ y
+ z
+
+ x
+ y
+ z
+
+ `);
+
+ inputs[4].checked = true;
+ await inputs[4].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ x
+ y
+ z
+ z
+ x
+ y
+ z
+ y
+ x
+ y
+ z
+
+ `);
+
+ inputs[5].checked = true;
+ await inputs[5].dispatchEvent(event);
+
+ assert.htmlEqual(target.innerHTML, `
+ x
+ y
+ z
+ z
+ x
+ y
+ z
+ y, z
+ x
+ y
+ z
+
+ `);
+ }
+};
diff --git a/test/runtime/samples/binding-input-group-each-6/main.svelte b/test/runtime/samples/binding-input-group-each-6/main.svelte
new file mode 100644
index 0000000000..85be939e8a
--- /dev/null
+++ b/test/runtime/samples/binding-input-group-each-6/main.svelte
@@ -0,0 +1,22 @@
+
+
+{#each Object.keys(list) as key}
+ {#each values as value}
+
+
+ {value}
+
+ {/each}
+ {list[key].join(', ')}
+{/each}
diff --git a/test/runtime/samples/binding-input-number-2/_config.js b/test/runtime/samples/binding-input-number-2/_config.js
index a3510eb757..5daf50fd04 100644
--- a/test/runtime/samples/binding-input-number-2/_config.js
+++ b/test/runtime/samples/binding-input-number-2/_config.js
@@ -27,5 +27,5 @@ export default {
component.value = 1;
assert.equal(component.value, 1);
assert.equal(input.value, "1");
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-number/_config.js b/test/runtime/samples/binding-input-number/_config.js
index 869b9f9896..3c5919bc64 100644
--- a/test/runtime/samples/binding-input-number/_config.js
+++ b/test/runtime/samples/binding-input-number/_config.js
@@ -1,6 +1,6 @@
export default {
props: {
- count: 42,
+ count: 42
},
html: `
@@ -44,5 +44,5 @@ export default {
undefined undefined
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-range-change-with-max/_config.js b/test/runtime/samples/binding-input-range-change-with-max/_config.js
index 1fda90d83c..dc3cf4ce28 100644
--- a/test/runtime/samples/binding-input-range-change-with-max/_config.js
+++ b/test/runtime/samples/binding-input-range-change-with-max/_config.js
@@ -29,5 +29,5 @@ export default {
20 of 20
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-range-change/_config.js b/test/runtime/samples/binding-input-range-change/_config.js
index 62e9562770..f6ec2d9c53 100644
--- a/test/runtime/samples/binding-input-range-change/_config.js
+++ b/test/runtime/samples/binding-input-range-change/_config.js
@@ -1,6 +1,6 @@
export default {
props: {
- count: 42,
+ count: 42
},
html: `
@@ -34,5 +34,5 @@ export default {
number 44
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-range/_config.js b/test/runtime/samples/binding-input-range/_config.js
index 4c3d37a667..dc6178e088 100644
--- a/test/runtime/samples/binding-input-range/_config.js
+++ b/test/runtime/samples/binding-input-range/_config.js
@@ -1,6 +1,6 @@
export default {
props: {
- count: 42,
+ count: 42
},
html: `
@@ -34,5 +34,5 @@ export default {
number 44
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js b/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js
index 28cffdfa57..de4d6325b0 100644
--- a/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js
+++ b/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js
@@ -1,7 +1,7 @@
export default {
props: {
foo: 'a',
- items: ['x'],
+ items: ['x']
},
html: `
@@ -32,5 +32,5 @@ export default {
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js
index 6fdfc4be52..a1584c18b8 100644
--- a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js
+++ b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js
@@ -121,5 +121,5 @@ export default {
done:one / done:two / remaining:four
`);
- },
+ }
};
diff --git a/test/runtime/samples/binding-input-text-contextual/_config.js b/test/runtime/samples/binding-input-text-contextual/_config.js
index bb7f16c8bb..1c66ea7ff5 100644
--- a/test/runtime/samples/binding-input-text-contextual/_config.js
+++ b/test/runtime/samples/binding-input-text-contextual/_config.js
@@ -1,6 +1,6 @@
export default {
props: {
- items: ['one', 'two', 'three'],
+ items: ['one', 'two', 'three']
},
html: `
@@ -65,5 +65,5 @@ export default {
five