From 7bd2ed6096e51167ae094611f5287584075d62a4 Mon Sep 17 00:00:00 2001 From: Ivan Hofer Date: Tue, 10 Nov 2020 08:04:44 +0100 Subject: [PATCH] add 'noop' param to some more tests --- test/js/samples/action/expected.js | 2 +- .../expected.js | 11 +++--- .../component-static-immutable/expected.js | 2 +- .../component-static-immutable2/expected.js | 2 +- .../expected.js | 3 +- .../samples/computed-collapsed-if/expected.js | 4 +-- test/js/samples/css-media-query/expected.js | 12 +++---- .../css-shadow-dom-keyframes/expected.js | 3 +- .../js/samples/deconflict-globals/expected.js | 4 +-- .../samples/dont-invalidate-this/expected.js | 2 +- test/js/samples/dynamic-import/expected.js | 2 +- test/js/samples/empty-dom/expected.js | 4 +-- .../event-handler-no-passive/expected.js | 2 +- test/js/samples/event-modifiers/expected.js | 6 ++-- .../js/samples/head-no-whitespace/expected.js | 2 +- test/js/samples/hoisted-const/expected.js | 2 +- test/js/samples/hoisted-let/expected.js | 2 +- .../samples/hydrated-void-element/expected.js | 2 +- .../inline-style-unoptimized/expected.js | 2 +- .../inline-style-without-updates/expected.js | 2 +- .../input-no-initial-value/expected.js | 2 +- test/js/samples/legacy-input-type/expected.js | 2 +- test/js/samples/media-bindings/expected.js | 34 ++++++++++++------- .../non-imported-component/expected.js | 2 +- .../samples/non-mutable-reference/expected.js | 2 +- .../expected.js | 4 +-- .../expected.js | 4 +-- test/js/samples/setup-method/expected.js | 4 +-- test/js/samples/svg-title/expected.js | 2 +- .../expected.js | 2 +- test/js/samples/video-bindings/expected.js | 20 +++++++---- 31 files changed, 80 insertions(+), 69 deletions(-) diff --git a/test/js/samples/action/expected.js b/test/js/samples/action/expected.js index d52960bddd..767a4574b8 100644 --- a/test/js/samples/action/expected.js +++ b/test/js/samples/action/expected.js @@ -60,7 +60,7 @@ function link(node) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index 41a574eba5..b32c38dd02 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -2,6 +2,7 @@ import { SvelteComponent, append, + appendStyleIfNotPresent, attr, detach, element, @@ -13,11 +14,8 @@ import { text } from "svelte/internal"; -function add_css() { - var style = element("style"); - style.id = "svelte-1a7i8ec-style"; - style.textContent = "p.svelte-1a7i8ec{color:red}"; - append(document.head, style); +function add_css(customStyleTag) { + appendStyleIfNotPresent(customStyleTag || document.head, "svelte-1a7i8ec-style", "p.svelte-1a7i8ec{color:red}"); } function create_fragment(ctx) { @@ -58,8 +56,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-1a7i8ec-style")) add_css(); - init(this, options, instance, create_fragment, safe_not_equal, { foo: 0 }, noop); + init(this, options, instance, create_fragment, safe_not_equal, { foo: 0 }, add_css); } } diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js index b0c4165413..7de4e04bb9 100644 --- a/test/js/samples/component-static-immutable/expected.js +++ b/test/js/samples/component-static-immutable/expected.js @@ -48,7 +48,7 @@ function instance($$self) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, not_equal, {}); + init(this, options, instance, create_fragment, not_equal, {}, noop); } } diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js index b0c4165413..7de4e04bb9 100644 --- a/test/js/samples/component-static-immutable2/expected.js +++ b/test/js/samples/component-static-immutable2/expected.js @@ -48,7 +48,7 @@ function instance($$self) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, not_equal, {}); + init(this, options, instance, create_fragment, not_equal, {}, noop); } } diff --git a/test/js/samples/component-store-file-invalidate/expected.js b/test/js/samples/component-store-file-invalidate/expected.js index d2fb3d0be4..27cfd9a56a 100644 --- a/test/js/samples/component-store-file-invalidate/expected.js +++ b/test/js/samples/component-store-file-invalidate/expected.js @@ -3,6 +3,7 @@ import { SvelteComponent, component_subscribe, init, + noop, safe_not_equal, set_store_value } from "svelte/internal"; @@ -23,7 +24,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, { increment: 0 }); + init(this, options, instance, null, safe_not_equal, { increment: 0 }, noop); } get increment() { diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js index 3e70d6a7ae..aea9578652 100644 --- a/test/js/samples/computed-collapsed-if/expected.js +++ b/test/js/samples/computed-collapsed-if/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; +import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; function instance($$self, $$props, $$invalidate) { let { x } = $$props; @@ -22,7 +22,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, { x: 0, a: 1, b: 2 }); + init(this, options, instance, null, safe_not_equal, { x: 0, a: 1, b: 2 }, noop); } get a() { diff --git a/test/js/samples/css-media-query/expected.js b/test/js/samples/css-media-query/expected.js index f477670059..007636ce09 100644 --- a/test/js/samples/css-media-query/expected.js +++ b/test/js/samples/css-media-query/expected.js @@ -1,7 +1,7 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - append, + appendStyleIfNotPresent, attr, detach, element, @@ -11,11 +11,8 @@ import { safe_not_equal } from "svelte/internal"; -function add_css() { - var style = element("style"); - style.id = "svelte-1slhpfn-style"; - style.textContent = "@media(min-width: 1px){div.svelte-1slhpfn{color:red}}"; - append(document.head, style); +function add_css(customStyleTag) { + appendStyleIfNotPresent(customStyleTag || document.head, "svelte-1slhpfn-style", "@media(min-width: 1px){div.svelte-1slhpfn{color:red}}"); } function create_fragment(ctx) { @@ -41,8 +38,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-1slhpfn-style")) add_css(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, add_css); } } diff --git a/test/js/samples/css-shadow-dom-keyframes/expected.js b/test/js/samples/css-shadow-dom-keyframes/expected.js index 82a39e5924..5f87f4a0a8 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected.js @@ -45,7 +45,8 @@ class Component extends SvelteElement { null, create_fragment, safe_not_equal, - {} + {}, + noop ); if (options) { diff --git a/test/js/samples/deconflict-globals/expected.js b/test/js/samples/deconflict-globals/expected.js index 7168eba6a5..290f8e6509 100644 --- a/test/js/samples/deconflict-globals/expected.js +++ b/test/js/samples/deconflict-globals/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; +import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; import { onMount } from "svelte"; @@ -20,7 +20,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, { foo: 0 }); + init(this, options, instance, null, safe_not_equal, { foo: 0 }, noop); } } diff --git a/test/js/samples/dont-invalidate-this/expected.js b/test/js/samples/dont-invalidate-this/expected.js index 0b155373a1..33d86f4148 100644 --- a/test/js/samples/dont-invalidate-this/expected.js +++ b/test/js/samples/dont-invalidate-this/expected.js @@ -45,7 +45,7 @@ function make_uppercase() { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/dynamic-import/expected.js b/test/js/samples/dynamic-import/expected.js index d1085f431b..559ad9217c 100644 --- a/test/js/samples/dynamic-import/expected.js +++ b/test/js/samples/dynamic-import/expected.js @@ -47,7 +47,7 @@ const func = () => import("./Foo.svelte"); class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/empty-dom/expected.js b/test/js/samples/empty-dom/expected.js index d5c80be696..b3e57758c1 100644 --- a/test/js/samples/empty-dom/expected.js +++ b/test/js/samples/empty-dom/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; +import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; function instance($$self) { const a = 1 + 2; @@ -9,7 +9,7 @@ function instance($$self) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, {}); + init(this, options, instance, null, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/event-handler-no-passive/expected.js b/test/js/samples/event-handler-no-passive/expected.js index 4d4b910d4e..de4b3225a2 100644 --- a/test/js/samples/event-handler-no-passive/expected.js +++ b/test/js/samples/event-handler-no-passive/expected.js @@ -46,7 +46,7 @@ const touchstart_handler = e => e.preventDefault(); class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/event-modifiers/expected.js b/test/js/samples/event-modifiers/expected.js index 3901753661..b444d4cba1 100644 --- a/test/js/samples/event-modifiers/expected.js +++ b/test/js/samples/event-modifiers/expected.js @@ -76,17 +76,17 @@ function create_fragment(ctx) { } function handleTouchstart() { - + } // ... function handleClick() { - + } // ... class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/head-no-whitespace/expected.js b/test/js/samples/head-no-whitespace/expected.js index 444bad3fd4..cf7104c744 100644 --- a/test/js/samples/head-no-whitespace/expected.js +++ b/test/js/samples/head-no-whitespace/expected.js @@ -40,7 +40,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/hoisted-const/expected.js b/test/js/samples/hoisted-const/expected.js index 2842b54751..af72500ea9 100644 --- a/test/js/samples/hoisted-const/expected.js +++ b/test/js/samples/hoisted-const/expected.js @@ -38,7 +38,7 @@ function get_answer() { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/hoisted-let/expected.js b/test/js/samples/hoisted-let/expected.js index 285b124118..d5401f2f21 100644 --- a/test/js/samples/hoisted-let/expected.js +++ b/test/js/samples/hoisted-let/expected.js @@ -38,7 +38,7 @@ function get_answer() { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/hydrated-void-element/expected.js b/test/js/samples/hydrated-void-element/expected.js index e53d16d925..b7e9990d1e 100644 --- a/test/js/samples/hydrated-void-element/expected.js +++ b/test/js/samples/hydrated-void-element/expected.js @@ -57,7 +57,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js index 0688f14b9b..fac15c691a 100644 --- a/test/js/samples/inline-style-unoptimized/expected.js +++ b/test/js/samples/inline-style-unoptimized/expected.js @@ -66,7 +66,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { style: 0, key: 1, value: 2 }); + init(this, options, instance, create_fragment, safe_not_equal, { style: 0, key: 1, value: 2 }, noop); } } diff --git a/test/js/samples/inline-style-without-updates/expected.js b/test/js/samples/inline-style-without-updates/expected.js index 375896f259..8a3768a048 100644 --- a/test/js/samples/inline-style-without-updates/expected.js +++ b/test/js/samples/inline-style-without-updates/expected.js @@ -35,7 +35,7 @@ let color = "red"; class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/input-no-initial-value/expected.js b/test/js/samples/input-no-initial-value/expected.js index 3354aa3111..8ece8f5ce2 100644 --- a/test/js/samples/input-no-initial-value/expected.js +++ b/test/js/samples/input-no-initial-value/expected.js @@ -83,7 +83,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, {}); + init(this, options, instance, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js index 2b76a48522..6f07bbc8d5 100644 --- a/test/js/samples/legacy-input-type/expected.js +++ b/test/js/samples/legacy-input-type/expected.js @@ -33,7 +33,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index 9ee63938fa..78f248588c 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -215,19 +215,27 @@ class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { - buffered: 0, - seekable: 1, - played: 2, - currentTime: 3, - duration: 4, - paused: 5, - volume: 6, - muted: 7, - playbackRate: 8, - seeking: 9, - ended: 10 - }, noop); + init( + this, + options, + instance, + create_fragment, + safe_not_equal, + { + buffered: 0, + seekable: 1, + played: 2, + currentTime: 3, + duration: 4, + paused: 5, + volume: 6, + muted: 7, + playbackRate: 8, + seeking: 9, + ended: 10 + }, + noop + ); } } diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index 5a6b8e8bb7..5c77f9d9f4 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -59,7 +59,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/non-mutable-reference/expected.js b/test/js/samples/non-mutable-reference/expected.js index 93f2145a2e..46b175dcb0 100644 --- a/test/js/samples/non-mutable-reference/expected.js +++ b/test/js/samples/non-mutable-reference/expected.js @@ -34,7 +34,7 @@ let name = "world"; class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } 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 15290496d5..29ca096fdd 100644 --- a/test/js/samples/reactive-values-non-topologically-ordered/expected.js +++ b/test/js/samples/reactive-values-non-topologically-ordered/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; +import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; function instance($$self, $$props, $$invalidate) { let { x } = $$props; @@ -26,7 +26,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, { x: 0 }); + init(this, options, instance, null, safe_not_equal, { x: 0 }, noop); } } 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 5196a770d9..82e4309827 100644 --- a/test/js/samples/reactive-values-non-writable-dependencies/expected.js +++ b/test/js/samples/reactive-values-non-writable-dependencies/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; +import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; function instance($$self, $$props, $$invalidate) { let { a = 1 } = $$props; @@ -22,7 +22,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, { a: 0, b: 1 }); + init(this, options, instance, null, safe_not_equal, { a: 0, b: 1 }, noop); } } diff --git a/test/js/samples/setup-method/expected.js b/test/js/samples/setup-method/expected.js index 8e30a03a7d..a5d2f046aa 100644 --- a/test/js/samples/setup-method/expected.js +++ b/test/js/samples/setup-method/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; +import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; const SOME_CONSTANT = 42; @@ -14,7 +14,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, { foo: 0 }); + init(this, options, instance, null, safe_not_equal, { foo: 0 }, noop); } get foo() { diff --git a/test/js/samples/svg-title/expected.js b/test/js/samples/svg-title/expected.js index cd7ae3b551..aacef416e2 100644 --- a/test/js/samples/svg-title/expected.js +++ b/test/js/samples/svg-title/expected.js @@ -39,7 +39,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/valid-inner-html-for-static-element/expected.js b/test/js/samples/valid-inner-html-for-static-element/expected.js index f1ced27ba4..241e083b61 100644 --- a/test/js/samples/valid-inner-html-for-static-element/expected.js +++ b/test/js/samples/valid-inner-html-for-static-element/expected.js @@ -32,7 +32,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, null, create_fragment, safe_not_equal, {}); + init(this, options, null, create_fragment, safe_not_equal, {}, noop); } } diff --git a/test/js/samples/video-bindings/expected.js b/test/js/samples/video-bindings/expected.js index 09f3b4a75f..5199c7fa83 100644 --- a/test/js/samples/video-bindings/expected.js +++ b/test/js/samples/video-bindings/expected.js @@ -115,12 +115,20 @@ class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { - currentTime: 0, - videoHeight: 1, - videoWidth: 2, - offsetWidth: 3 - }, noop); + init( + this, + options, + instance, + create_fragment, + safe_not_equal, + { + currentTime: 0, + videoHeight: 1, + videoWidth: 2, + offsetWidth: 3 + }, + noop + ); } }