;
@@ -29,10 +44,18 @@ export function bind(component, name, callback) {
}
}
+export function create_component(block) {
+ block && block.c();
+}
+
+export function claim_component(block, parent_nodes) {
+ block && block.l(parent_nodes);
+}
+
export function mount_component(component, target, anchor) {
const { fragment, on_mount, on_destroy, after_update } = component.$$;
- fragment.m(target, anchor);
+ fragment && fragment.m(target, anchor);
// onMount happens before the initial afterUpdate
add_render_callback(() => {
@@ -51,15 +74,16 @@ export function mount_component(component, target, anchor) {
}
export function destroy_component(component, detaching) {
- if (component.$$.fragment) {
- run_all(component.$$.on_destroy);
+ const $$ = component.$$;
+ if ($$.fragment !== null) {
+ run_all($$.on_destroy);
- component.$$.fragment.d(detaching);
+ $$.fragment && $$.fragment.d(detaching);
// TODO null out other refs, including component.$$ (but need to
// preserve final state?)
- component.$$.on_destroy = component.$$.fragment = null;
- component.$$.ctx = {};
+ $$.on_destroy = $$.fragment = null;
+ $$.ctx = {};
}
}
@@ -115,15 +139,17 @@ export function init(component, options, instance, create_fragment, not_equal, p
$$.update();
ready = true;
run_all($$.before_update);
- $$.fragment = create_fragment($$.ctx);
+
+ // `false` as a special case of no DOM component
+ $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
if (options.target) {
if (options.hydrate) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- $$.fragment!.l(children(options.target));
+ $$.fragment && $$.fragment!.l(children(options.target));
} else {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- $$.fragment!.c();
+ $$.fragment && $$.fragment!.c();
}
if (options.intro) transition_in(component.$$.fragment);
diff --git a/src/runtime/internal/scheduler.ts b/src/runtime/internal/scheduler.ts
index e3d7181fcb..7cb00c085b 100644
--- a/src/runtime/internal/scheduler.ts
+++ b/src/runtime/internal/scheduler.ts
@@ -70,10 +70,10 @@ export function flush() {
}
function update($$) {
- if ($$.fragment) {
+ if ($$.fragment !== null) {
$$.update($$.dirty);
run_all($$.before_update);
- $$.fragment.p($$.dirty, $$.ctx);
+ $$.fragment && $$.fragment.p($$.dirty, $$.ctx);
$$.dirty = null;
$$.after_update.forEach(add_render_callback);
diff --git a/src/runtime/transition/index.ts b/src/runtime/transition/index.ts
index ec19ca1b68..0a20c81b1f 100644
--- a/src/runtime/transition/index.ts
+++ b/src/runtime/transition/index.ts
@@ -1,4 +1,4 @@
-import { cubicOut, cubicInOut } from 'svelte/easing';
+import { cubicOut, cubicInOut, linear } from 'svelte/easing';
import { assign, is_function } from 'svelte/internal';
type EasingFunction = (t: number) => number;
@@ -43,17 +43,20 @@ export function blur(node: Element, {
interface FadeParams {
delay: number;
duration: number;
+ easing: EasingFunction;
}
export function fade(node: Element, {
delay = 0,
- duration = 400
+ duration = 400,
+ easing = linear
}: FadeParams): TransitionConfig {
const o = +getComputedStyle(node).opacity;
return {
delay,
duration,
+ easing,
css: t => `opacity: ${t * o}`
};
}
diff --git a/test/css/samples/unused-selector-string-concat/_config.js b/test/css/samples/unused-selector-string-concat/_config.js
new file mode 100644
index 0000000000..81318fd3ac
--- /dev/null
+++ b/test/css/samples/unused-selector-string-concat/_config.js
@@ -0,0 +1,143 @@
+export default {
+ warnings: [
+ {
+ code: 'css-unused-selector',
+ message: 'Unused CSS selector',
+ frame:
+ ` 9: `,
+ start: { line: 28, column: 2, character: 595 },
+ end: { line: 28, column: 9, character: 602 },
+ pos: 595,
+ },
+ ],
+};
diff --git a/test/css/samples/unused-selector-string-concat/expected.css b/test/css/samples/unused-selector-string-concat/expected.css
new file mode 100644
index 0000000000..756c2eecae
--- /dev/null
+++ b/test/css/samples/unused-selector-string-concat/expected.css
@@ -0,0 +1 @@
+.foo.svelte-xyz{color:red}.foocc.svelte-xyz{color:red}.aa.svelte-xyz{color:red}.bb.svelte-xyz{color:red}.cc.svelte-xyz{color:red}.dd.svelte-xyz{color:red}.aabar.svelte-xyz{color:red}.fooddbar.svelte-xyz{color:red}.baz.svelte-xyz{color:red}
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-string-concat/input.svelte b/test/css/samples/unused-selector-string-concat/input.svelte
new file mode 100644
index 0000000000..0f69463e78
--- /dev/null
+++ b/test/css/samples/unused-selector-string-concat/input.svelte
@@ -0,0 +1,29 @@
+
+
+
+ some stuff
+
+
+
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-ternary-bailed/_config.js b/test/css/samples/unused-selector-ternary-bailed/_config.js
new file mode 100644
index 0000000000..e5f82e4a85
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-bailed/_config.js
@@ -0,0 +1,3 @@
+export default {
+ warnings: [],
+};
diff --git a/test/css/samples/unused-selector-ternary-bailed/expected.css b/test/css/samples/unused-selector-ternary-bailed/expected.css
new file mode 100644
index 0000000000..042d33f3cc
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-bailed/expected.css
@@ -0,0 +1 @@
+.thing.svelte-xyz{color:blue}.active.svelte-xyz{color:blue}.thing.active.svelte-xyz{color:blue}.hover.svelte-xyz{color:blue}.hover.unused.svelte-xyz{color:blue}.unused.svelte-xyz{color:blue}
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-ternary-bailed/input.svelte b/test/css/samples/unused-selector-ternary-bailed/input.svelte
new file mode 100644
index 0000000000..f9af44ec8b
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-bailed/input.svelte
@@ -0,0 +1,18 @@
+
+
+
+ some stuff
+
+
+
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-ternary-concat/_config.js b/test/css/samples/unused-selector-ternary-concat/_config.js
new file mode 100644
index 0000000000..5015fccb25
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-concat/_config.js
@@ -0,0 +1,25 @@
+export default {
+ warnings: [
+ {
+ code: 'css-unused-selector',
+ end: {
+ character: 205,
+ column: 9,
+ line: 14,
+ },
+ frame: `
+ 12: .thing.active {color: blue;}
+ 13:
+ 14: .unused {color: blue;}
+ ^
+ 15: `,
+ message: 'Unused CSS selector',
+ pos: 198,
+ start: {
+ character: 198,
+ column: 2,
+ line: 14,
+ },
+ },
+ ],
+};
diff --git a/test/css/samples/unused-selector-ternary-concat/expected.css b/test/css/samples/unused-selector-ternary-concat/expected.css
new file mode 100644
index 0000000000..8142a20e83
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-concat/expected.css
@@ -0,0 +1 @@
+.thing.svelte-xyz{color:blue}.active.svelte-xyz{color:blue}.thing.active.svelte-xyz{color:blue}
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-ternary-concat/input.svelte b/test/css/samples/unused-selector-ternary-concat/input.svelte
new file mode 100644
index 0000000000..8db417c928
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-concat/input.svelte
@@ -0,0 +1,15 @@
+
+
+
+ some stuff
+
+
+
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-ternary-nested/_config.js b/test/css/samples/unused-selector-ternary-nested/_config.js
new file mode 100644
index 0000000000..afee5ac822
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-nested/_config.js
@@ -0,0 +1,31 @@
+export default {
+ warnings: [
+ {
+ code: 'css-unused-selector',
+ message: 'Unused CSS selector',
+ frame: `
+ 13: .thing.active {color: blue;}
+ 14: .hover { color: blue; }
+ 15: .hover.unused { color: blue; }
+ ^
+ 16:
+ 17: .unused {color: blue;}`,
+ start: { line: 15, column: 2, character: 261 },
+ end: { line: 15, column: 15, character: 274 },
+ pos: 261,
+ },
+ {
+ code: 'css-unused-selector',
+ message: 'Unused CSS selector',
+ frame: `
+ 15: .hover.unused { color: blue; }
+ 16:
+ 17: .unused {color: blue;}
+ ^
+ 18: `,
+ start: { line: 17, column: 2, character: 295 },
+ end: { line: 17, column: 9, character: 302 },
+ pos: 295,
+ },
+ ],
+};
diff --git a/test/css/samples/unused-selector-ternary-nested/expected.css b/test/css/samples/unused-selector-ternary-nested/expected.css
new file mode 100644
index 0000000000..85a95ad23e
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-nested/expected.css
@@ -0,0 +1 @@
+.thing.svelte-xyz{color:blue}.active.svelte-xyz{color:blue}.thing.active.svelte-xyz{color:blue}.hover.svelte-xyz{color:blue}
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-ternary-nested/input.svelte b/test/css/samples/unused-selector-ternary-nested/input.svelte
new file mode 100644
index 0000000000..a7a8f0e02a
--- /dev/null
+++ b/test/css/samples/unused-selector-ternary-nested/input.svelte
@@ -0,0 +1,18 @@
+
+
+
+ some stuff
+
+
+
\ No newline at end of file
diff --git a/test/js/samples/bindings-readonly-order/expected.js b/test/js/samples/bindings-readonly-order/expected.js
new file mode 100644
index 0000000000..b7e004ec23
--- /dev/null
+++ b/test/js/samples/bindings-readonly-order/expected.js
@@ -0,0 +1,82 @@
+import {
+ SvelteComponent,
+ attr,
+ detach,
+ element,
+ init,
+ insert,
+ listen,
+ noop,
+ run_all,
+ safe_not_equal,
+ space
+} from "svelte/internal";
+
+function create_fragment(ctx) {
+ let input0;
+ let t;
+ let input1;
+ let dispose;
+
+ return {
+ c() {
+ input0 = element("input");
+ t = space();
+ input1 = element("input");
+ attr(input0, "type", "file");
+ attr(input1, "type", "file");
+
+ dispose = [
+ listen(input0, "change", ctx.input0_change_handler),
+ listen(input1, "change", ctx.input1_change_handler)
+ ];
+ },
+ m(target, anchor) {
+ insert(target, input0, anchor);
+ insert(target, t, anchor);
+ insert(target, input1, anchor);
+ },
+ p: noop,
+ i: noop,
+ o: noop,
+ d(detaching) {
+ if (detaching) detach(input0);
+ if (detaching) detach(t);
+ if (detaching) detach(input1);
+ run_all(dispose);
+ }
+ };
+}
+
+function instance($$self, $$props, $$invalidate) {
+ let { files } = $$props;
+
+ function input0_change_handler() {
+ files = this.files;
+ $$invalidate("files", files);
+ }
+
+ function input1_change_handler() {
+ files = this.files;
+ $$invalidate("files", files);
+ }
+
+ $$self.$set = $$props => {
+ if ("files" in $$props) $$invalidate("files", files = $$props.files);
+ };
+
+ return {
+ files,
+ input0_change_handler,
+ input1_change_handler
+ };
+}
+
+class Component extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance, create_fragment, safe_not_equal, { files: 0 });
+ }
+}
+
+export default Component;
\ No newline at end of file
diff --git a/test/js/samples/bindings-readonly-order/input.svelte b/test/js/samples/bindings-readonly-order/input.svelte
new file mode 100644
index 0000000000..9a133b90f2
--- /dev/null
+++ b/test/js/samples/bindings-readonly-order/input.svelte
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/test/js/samples/component-static-array/expected.js b/test/js/samples/component-static-array/expected.js
index 2c38d80f30..0f32421e91 100644
--- a/test/js/samples/component-static-array/expected.js
+++ b/test/js/samples/component-static-array/expected.js
@@ -1,5 +1,6 @@
import {
SvelteComponent,
+ create_component,
destroy_component,
init,
mount_component,
@@ -15,7 +16,7 @@ function create_fragment(ctx) {
return {
c() {
- nested.$$.fragment.c();
+ create_component(nested.$$.fragment);
},
m(target, anchor) {
mount_component(nested, target, anchor);
diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js
index d60aeb3939..817db4e494 100644
--- a/test/js/samples/component-static-immutable/expected.js
+++ b/test/js/samples/component-static-immutable/expected.js
@@ -1,5 +1,6 @@
import {
SvelteComponent,
+ create_component,
destroy_component,
init,
mount_component,
@@ -15,7 +16,7 @@ function create_fragment(ctx) {
return {
c() {
- nested.$$.fragment.c();
+ create_component(nested.$$.fragment);
},
m(target, anchor) {
mount_component(nested, target, anchor);
diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js
index d60aeb3939..817db4e494 100644
--- a/test/js/samples/component-static-immutable2/expected.js
+++ b/test/js/samples/component-static-immutable2/expected.js
@@ -1,5 +1,6 @@
import {
SvelteComponent,
+ create_component,
destroy_component,
init,
mount_component,
@@ -15,7 +16,7 @@ function create_fragment(ctx) {
return {
c() {
- nested.$$.fragment.c();
+ create_component(nested.$$.fragment);
},
m(target, anchor) {
mount_component(nested, target, anchor);
diff --git a/test/js/samples/component-static-var/expected.js b/test/js/samples/component-static-var/expected.js
index e1372a7b6d..0120b2c8cf 100644
--- a/test/js/samples/component-static-var/expected.js
+++ b/test/js/samples/component-static-var/expected.js
@@ -1,5 +1,6 @@
import {
SvelteComponent,
+ create_component,
destroy_component,
detach,
element,
@@ -28,9 +29,9 @@ function create_fragment(ctx) {
return {
c() {
- foo.$$.fragment.c();
+ create_component(foo.$$.fragment);
t0 = space();
- bar.$$.fragment.c();
+ create_component(bar.$$.fragment);
t1 = space();
input = element("input");
dispose = listen(input, "input", ctx.input_input_handler);
diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js
index 14b85a917a..76321cfd82 100644
--- a/test/js/samples/component-static/expected.js
+++ b/test/js/samples/component-static/expected.js
@@ -1,5 +1,6 @@
import {
SvelteComponent,
+ create_component,
destroy_component,
init,
mount_component,
@@ -15,7 +16,7 @@ function create_fragment(ctx) {
return {
c() {
- nested.$$.fragment.c();
+ create_component(nested.$$.fragment);
},
m(target, anchor) {
mount_component(nested, target, anchor);
diff --git a/test/js/samples/component-store-file-invalidate/expected.js b/test/js/samples/component-store-file-invalidate/expected.js
index 987f3971a1..5a466d7786 100644
--- a/test/js/samples/component-store-file-invalidate/expected.js
+++ b/test/js/samples/component-store-file-invalidate/expected.js
@@ -2,24 +2,12 @@ import {
SvelteComponent,
component_subscribe,
init,
- noop,
safe_not_equal,
set_store_value
} from "svelte/internal";
import { count } from "./store.js";
-function create_fragment(ctx) {
- return {
- c: noop,
- m: noop,
- p: noop,
- i: noop,
- o: noop,
- d: noop
- };
-}
-
function instance($$self, $$props, $$invalidate) {
let $count;
component_subscribe($$self, count, $$value => $$invalidate("$count", $count = $$value));
@@ -34,7 +22,7 @@ function instance($$self, $$props, $$invalidate) {
class Component extends SvelteComponent {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal, { increment: 0 });
+ init(this, options, instance, null, safe_not_equal, { increment: 0 });
}
get increment() {
diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js
index a63ee30ca0..d4b0289212 100644
--- a/test/js/samples/computed-collapsed-if/expected.js
+++ b/test/js/samples/computed-collapsed-if/expected.js
@@ -1,15 +1,4 @@
-import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal";
-
-function create_fragment(ctx) {
- return {
- c: noop,
- m: noop,
- p: noop,
- i: noop,
- o: noop,
- d: noop
- };
-}
+import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
function instance($$self, $$props, $$invalidate) {
let { x } = $$props;
@@ -32,7 +21,7 @@ function instance($$self, $$props, $$invalidate) {
class Component extends SvelteComponent {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal, { x: 0, a: 0, b: 0 });
+ init(this, options, instance, null, safe_not_equal, { x: 0, a: 0, b: 0 });
}
get a() {
diff --git a/test/js/samples/deconflict-globals/expected.js b/test/js/samples/deconflict-globals/expected.js
index bf67b6aae4..92492dcd05 100644
--- a/test/js/samples/deconflict-globals/expected.js
+++ b/test/js/samples/deconflict-globals/expected.js
@@ -1,17 +1,6 @@
-import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal";
+import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
import { onMount } from "svelte";
-function create_fragment(ctx) {
- return {
- c: noop,
- m: noop,
- p: noop,
- i: noop,
- o: noop,
- d: noop
- };
-}
-
function instance($$self, $$props, $$invalidate) {
let { foo = "bar" } = $$props;
@@ -29,7 +18,7 @@ function instance($$self, $$props, $$invalidate) {
class Component extends SvelteComponent {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal, { foo: 0 });
+ init(this, options, instance, null, safe_not_equal, { foo: 0 });
}
}
diff --git a/test/js/samples/dynamic-import/expected.js b/test/js/samples/dynamic-import/expected.js
index 95a50f4a4d..605f19983f 100644
--- a/test/js/samples/dynamic-import/expected.js
+++ b/test/js/samples/dynamic-import/expected.js
@@ -1,5 +1,6 @@
import {
SvelteComponent,
+ create_component,
destroy_component,
init,
mount_component,
@@ -17,7 +18,7 @@ function create_fragment(ctx) {
return {
c() {
- lazyload.$$.fragment.c();
+ create_component(lazyload.$$.fragment);
},
m(target, anchor) {
mount_component(lazyload, target, anchor);
diff --git a/test/js/samples/empty-dom/expected.js b/test/js/samples/empty-dom/expected.js
new file mode 100644
index 0000000000..6ae0bc2999
--- /dev/null
+++ b/test/js/samples/empty-dom/expected.js
@@ -0,0 +1,15 @@
+import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
+
+function instance($$self) {
+ const a = 1 + 2;
+ return {};
+}
+
+class Component extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance, null, safe_not_equal, {});
+ }
+}
+
+export default Component;
\ No newline at end of file
diff --git a/test/js/samples/empty-dom/input.svelte b/test/js/samples/empty-dom/input.svelte
new file mode 100644
index 0000000000..3098443ea3
--- /dev/null
+++ b/test/js/samples/empty-dom/input.svelte
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/test/js/samples/event-handler-dynamic/expected.js b/test/js/samples/event-handler-dynamic/expected.js
new file mode 100644
index 0000000000..0678d229b9
--- /dev/null
+++ b/test/js/samples/event-handler-dynamic/expected.js
@@ -0,0 +1,107 @@
+import {
+ SvelteComponent,
+ append,
+ detach,
+ element,
+ init,
+ insert,
+ listen,
+ noop,
+ run_all,
+ safe_not_equal,
+ set_data,
+ space,
+ text
+} from "svelte/internal";
+
+function create_fragment(ctx) {
+ let p0;
+ let button0;
+ let t1;
+ let button1;
+ let t3;
+ let p1;
+ let t4;
+ let t5;
+ let button2;
+ let dispose;
+
+ return {
+ c() {
+ p0 = element("p");
+ button0 = element("button");
+ button0.textContent = "set handler 1";
+ t1 = space();
+ button1 = element("button");
+ button1.textContent = "set handler 2";
+ t3 = space();
+ p1 = element("p");
+ t4 = text(ctx.number);
+ t5 = space();
+ button2 = element("button");
+ button2.textContent = "click";
+
+ dispose = [
+ listen(button0, "click", ctx.updateHandler1),
+ listen(button1, "click", ctx.updateHandler2),
+ listen(button2, "click", function () {
+ ctx.clickHandler.apply(this, arguments);
+ })
+ ];
+ },
+ m(target, anchor) {
+ insert(target, p0, anchor);
+ append(p0, button0);
+ append(p0, t1);
+ append(p0, button1);
+ insert(target, t3, anchor);
+ insert(target, p1, anchor);
+ append(p1, t4);
+ insert(target, t5, anchor);
+ insert(target, button2, anchor);
+ },
+ p(changed, new_ctx) {
+ ctx = new_ctx;
+ if (changed.number) set_data(t4, ctx.number);
+ },
+ i: noop,
+ o: noop,
+ d(detaching) {
+ if (detaching) detach(p0);
+ if (detaching) detach(t3);
+ if (detaching) detach(p1);
+ if (detaching) detach(t5);
+ if (detaching) detach(button2);
+ run_all(dispose);
+ }
+ };
+}
+
+function instance($$self, $$props, $$invalidate) {
+ let clickHandler;
+ let number = 0;
+
+ function updateHandler1() {
+ $$invalidate("clickHandler", clickHandler = () => $$invalidate("number", number = 1));
+ }
+
+ function updateHandler2() {
+ $$invalidate("clickHandler", clickHandler = () => $$invalidate("number", number = 2));
+ }
+
+ return {
+ clickHandler,
+ number,
+ updateHandler1,
+ updateHandler2
+ };
+}
+
+class Component extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance, create_fragment, safe_not_equal, {});
+ }
+}
+
+export default Component;
\ No newline at end of file
diff --git a/test/js/samples/event-handler-dynamic/input.svelte b/test/js/samples/event-handler-dynamic/input.svelte
new file mode 100644
index 0000000000..17c9ae6cf0
--- /dev/null
+++ b/test/js/samples/event-handler-dynamic/input.svelte
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+{ number }
+
+
\ No newline at end of file
diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js
index d9176f35f7..be1ff282c3 100644
--- a/test/js/samples/non-imported-component/expected.js
+++ b/test/js/samples/non-imported-component/expected.js
@@ -1,5 +1,6 @@
import {
SvelteComponent,
+ create_component,
destroy_component,
detach,
init,
@@ -22,9 +23,9 @@ function create_fragment(ctx) {
return {
c() {
- imported.$$.fragment.c();
+ create_component(imported.$$.fragment);
t = space();
- nonimported.$$.fragment.c();
+ create_component(nonimported.$$.fragment);
},
m(target, anchor) {
mount_component(imported, target, anchor);
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 abd22c4da0..69fd368ee8 100644
--- a/test/js/samples/reactive-values-non-topologically-ordered/expected.js
+++ b/test/js/samples/reactive-values-non-topologically-ordered/expected.js
@@ -1,15 +1,4 @@
-import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal";
-
-function create_fragment(ctx) {
- return {
- c: noop,
- m: noop,
- p: noop,
- i: noop,
- o: noop,
- d: noop
- };
-}
+import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
function instance($$self, $$props, $$invalidate) {
let { x } = $$props;
@@ -36,7 +25,7 @@ function instance($$self, $$props, $$invalidate) {
class Component extends SvelteComponent {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal, { x: 0 });
+ init(this, options, instance, null, safe_not_equal, { x: 0 });
}
}
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 6b68368894..233e9ef835 100644
--- a/test/js/samples/reactive-values-non-writable-dependencies/expected.js
+++ b/test/js/samples/reactive-values-non-writable-dependencies/expected.js
@@ -1,15 +1,4 @@
-import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal";
-
-function create_fragment(ctx) {
- return {
- c: noop,
- m: noop,
- p: noop,
- i: noop,
- o: noop,
- d: noop
- };
-}
+import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
function instance($$self, $$props, $$invalidate) {
let { a = 1 } = $$props;
@@ -32,7 +21,7 @@ function instance($$self, $$props, $$invalidate) {
class Component extends SvelteComponent {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal, { a: 0, b: 0 });
+ init(this, options, instance, null, safe_not_equal, { a: 0, b: 0 });
}
}
diff --git a/test/js/samples/setup-method/expected.js b/test/js/samples/setup-method/expected.js
index 40fc049383..e22398748e 100644
--- a/test/js/samples/setup-method/expected.js
+++ b/test/js/samples/setup-method/expected.js
@@ -1,16 +1,4 @@
-import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal";
-
-function create_fragment(ctx) {
- return {
- c: noop,
- m: noop,
- p: noop,
- i: noop,
- o: noop,
- d: noop
- };
-}
-
+import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
const SOME_CONSTANT = 42;
function foo(bar) {
@@ -20,7 +8,7 @@ function foo(bar) {
class Component extends SvelteComponent {
constructor(options) {
super();
- init(this, options, null, create_fragment, safe_not_equal, { foo: 0 });
+ init(this, options, null, null, safe_not_equal, { foo: 0 });
}
get foo() {
diff --git a/test/runtime/samples/attribute-static-quotemarks/_config.js b/test/runtime/samples/attribute-static-quotemarks/_config.js
index 794d01c29f..3d389c2273 100644
--- a/test/runtime/samples/attribute-static-quotemarks/_config.js
+++ b/test/runtime/samples/attribute-static-quotemarks/_config.js
@@ -1,3 +1,8 @@
export default {
- html: `foo`
+ html: `
+
+ foo
+ bar
+
+ `
};
\ No newline at end of file
diff --git a/test/runtime/samples/attribute-static-quotemarks/main.svelte b/test/runtime/samples/attribute-static-quotemarks/main.svelte
index 5f9c68c53c..e01af9f098 100644
--- a/test/runtime/samples/attribute-static-quotemarks/main.svelte
+++ b/test/runtime/samples/attribute-static-quotemarks/main.svelte
@@ -1 +1,4 @@
-foo
\ No newline at end of file
+
+ foo
+ bar
+
\ No newline at end of file
diff --git a/test/runtime/samples/component-event-handler-dynamic/Button.svelte b/test/runtime/samples/component-event-handler-dynamic/Button.svelte
new file mode 100644
index 0000000000..9b5b7a5f67
--- /dev/null
+++ b/test/runtime/samples/component-event-handler-dynamic/Button.svelte
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test/runtime/samples/component-event-handler-dynamic/_config.js b/test/runtime/samples/component-event-handler-dynamic/_config.js
new file mode 100644
index 0000000000..415b860828
--- /dev/null
+++ b/test/runtime/samples/component-event-handler-dynamic/_config.js
@@ -0,0 +1,18 @@
+export default {
+ html: `
+
+
+ `,
+
+ async test({ assert, component, target, window }) {
+ const [updateButton, button] = target.querySelectorAll('button');
+ const event = new window.MouseEvent('click');
+
+ await button.dispatchEvent(event);
+ assert.equal(component.count, 1);
+
+ await updateButton.dispatchEvent(event);
+ await button.dispatchEvent(event);
+ assert.equal(component.count, 11);
+ }
+};
diff --git a/test/runtime/samples/component-event-handler-dynamic/main.svelte b/test/runtime/samples/component-event-handler-dynamic/main.svelte
new file mode 100644
index 0000000000..7555ea8c17
--- /dev/null
+++ b/test/runtime/samples/component-event-handler-dynamic/main.svelte
@@ -0,0 +1,11 @@
+
+
+
+
\ No newline at end of file
diff --git a/test/runtime/samples/component-event-handler-modifier-once-dynamic/Button.svelte b/test/runtime/samples/component-event-handler-modifier-once-dynamic/Button.svelte
new file mode 100644
index 0000000000..9b5b7a5f67
--- /dev/null
+++ b/test/runtime/samples/component-event-handler-modifier-once-dynamic/Button.svelte
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test/runtime/samples/component-event-handler-modifier-once-dynamic/_config.js b/test/runtime/samples/component-event-handler-modifier-once-dynamic/_config.js
new file mode 100644
index 0000000000..8796e0faf6
--- /dev/null
+++ b/test/runtime/samples/component-event-handler-modifier-once-dynamic/_config.js
@@ -0,0 +1,18 @@
+export default {
+ html: `
+
+
+ `,
+
+ async test({ assert, component, target, window }) {
+ const [updateButton, button] = target.querySelectorAll('button');
+ const event = new window.MouseEvent('click');
+
+ await updateButton.dispatchEvent(event);
+ await button.dispatchEvent(event);
+ assert.equal(component.count, 10);
+
+ await button.dispatchEvent(event);
+ assert.equal(component.count, 10);
+ }
+};
diff --git a/test/runtime/samples/component-event-handler-modifier-once-dynamic/main.svelte b/test/runtime/samples/component-event-handler-modifier-once-dynamic/main.svelte
new file mode 100644
index 0000000000..93ec90d5ce
--- /dev/null
+++ b/test/runtime/samples/component-event-handler-modifier-once-dynamic/main.svelte
@@ -0,0 +1,11 @@
+
+
+
+
\ No newline at end of file
diff --git a/test/runtime/samples/empty-dom/_config.js b/test/runtime/samples/empty-dom/_config.js
new file mode 100644
index 0000000000..e3e3d0ecd5
--- /dev/null
+++ b/test/runtime/samples/empty-dom/_config.js
@@ -0,0 +1,3 @@
+export default {
+ html: '',
+};
\ No newline at end of file
diff --git a/test/runtime/samples/empty-dom/main.svelte b/test/runtime/samples/empty-dom/main.svelte
new file mode 100644
index 0000000000..3098443ea3
--- /dev/null
+++ b/test/runtime/samples/empty-dom/main.svelte
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/test/runtime/samples/event-handler-dynamic/_config.js b/test/runtime/samples/event-handler-dynamic/_config.js
new file mode 100644
index 0000000000..41cfd6e729
--- /dev/null
+++ b/test/runtime/samples/event-handler-dynamic/_config.js
@@ -0,0 +1,50 @@
+export default {
+ html: `
+
+
+
+
+ 0
+
+ `,
+
+ async test({ assert, component, target, window }) {
+ const [updateButton1, updateButton2, button] = target.querySelectorAll(
+ 'button'
+ );
+
+ const event = new window.MouseEvent('click');
+
+ await button.dispatchEvent(event);
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+
+ 0
+
+ `);
+
+ await updateButton1.dispatchEvent(event);
+ await button.dispatchEvent(event);
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+
+ 1
+
+ `);
+
+ await updateButton2.dispatchEvent(event);
+ await button.dispatchEvent(event);
+ assert.htmlEqual(target.innerHTML, `
+
+
+
+
+ 2
+
+ `);
+ },
+};
diff --git a/test/runtime/samples/event-handler-dynamic/main.svelte b/test/runtime/samples/event-handler-dynamic/main.svelte
new file mode 100644
index 0000000000..17c9ae6cf0
--- /dev/null
+++ b/test/runtime/samples/event-handler-dynamic/main.svelte
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+{ number }
+
+
\ No newline at end of file