diff --git a/test/js/samples/capture-inject-dev-only/_config.js b/test/js/samples/capture-inject-dev-only/_config.js new file mode 100644 index 0000000000..1e0819f22e --- /dev/null +++ b/test/js/samples/capture-inject-dev-only/_config.js @@ -0,0 +1,5 @@ +export default { + options: { + dev: false + } +}; \ No newline at end of file diff --git a/test/js/samples/capture-inject-dev-only/expected.js b/test/js/samples/capture-inject-dev-only/expected.js new file mode 100644 index 0000000000..9e930bdf15 --- /dev/null +++ b/test/js/samples/capture-inject-dev-only/expected.js @@ -0,0 +1,79 @@ +/* generated by Svelte vX.Y.Z */ +import { + SvelteComponent, + append, + detach, + element, + init, + insert, + listen, + noop, + safe_not_equal, + set_data, + space, + text +} from "svelte/internal"; + +function create_fragment(ctx) { + var p, t0, t1, input, dispose; + + return { + c() { + p = element("p"); + t0 = text(ctx.foo); + t1 = space(); + input = element("input"); + dispose = listen(input, "input", ctx.input_input_handler); + }, + + m(target, anchor) { + insert(target, p, anchor); + append(p, t0); + insert(target, t1, anchor); + insert(target, input, anchor); + + input.value = ctx.foo; + }, + + p(changed, ctx) { + if (changed.foo) { + set_data(t0, ctx.foo); + } + + if (changed.foo && (input.value !== ctx.foo)) input.value = ctx.foo; + }, + + i: noop, + o: noop, + + d(detaching) { + if (detaching) { + detach(p); + detach(t1); + detach(input); + } + + dispose(); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + let foo = "bar"; + + function input_input_handler() { + foo = this.value; + $$invalidate('foo', foo); + } + + return { foo, input_input_handler }; +} + +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/capture-inject-dev-only/input.svelte b/test/js/samples/capture-inject-dev-only/input.svelte new file mode 100644 index 0000000000..b4f2088b49 --- /dev/null +++ b/test/js/samples/capture-inject-dev-only/input.svelte @@ -0,0 +1,5 @@ + +
{foo}
+ \ No newline at end of file