From 0cf9861e1f6dbe52e1d9ca8d1d43e1eca015e0aa Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Tue, 3 Mar 2020 15:50:39 +0800 Subject: [PATCH 1/7] warn if passing slot not defined into Component --- src/compiler/compile/render_dom/index.ts | 3 ++- src/runtime/internal/dev.ts | 8 ++++++++ .../runtime/samples/component-slot-warning/Nested.svelte | 1 + test/runtime/samples/component-slot-warning/_config.js | 9 +++++++++ test/runtime/samples/component-slot-warning/main.svelte | 7 +++++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 test/runtime/samples/component-slot-warning/Nested.svelte create mode 100644 test/runtime/samples/component-slot-warning/_config.js create mode 100644 test/runtime/samples/component-slot-warning/main.svelte diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts index d6da6142768c..179115b5b248 100644 --- a/src/compiler/compile/render_dom/index.ts +++ b/src/compiler/compile/render_dom/index.ts @@ -412,7 +412,8 @@ export default function dom( ${unknown_props_check} - ${component.slots.size ? b`let { $$slots = {}, $$scope } = $$props;` : null} + ${component.slots.size || component.compile_options.dev ? b`let { $$slots = {}, $$scope } = $$props;` : null} + ${component.compile_options.dev && b`@validate_slot($$slots, [${Array.from(component.slots.keys()).map(key => `"${key}"`).join(',')}]);`} ${renderer.binding_groups.length > 0 && b`const $$binding_groups = [${renderer.binding_groups.map(_ => x`[]`)}];`} diff --git a/src/runtime/internal/dev.ts b/src/runtime/internal/dev.ts index 8aefc88ba7b0..865f23ce1165 100644 --- a/src/runtime/internal/dev.ts +++ b/src/runtime/internal/dev.ts @@ -89,6 +89,14 @@ export function validate_each_argument(arg) { } } +export function validate_slot(slot, keys) { + keys = new Set(keys); + for (const slot_key of Object.keys(slot)) { + if (!keys.has(slot_key)) { + console.warn(`Received unexpected slot named "${slot_key}"`); + } + } +} type Props = Record; export interface SvelteComponentDev { diff --git a/test/runtime/samples/component-slot-warning/Nested.svelte b/test/runtime/samples/component-slot-warning/Nested.svelte new file mode 100644 index 000000000000..c6f086d96c19 --- /dev/null +++ b/test/runtime/samples/component-slot-warning/Nested.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/runtime/samples/component-slot-warning/_config.js b/test/runtime/samples/component-slot-warning/_config.js new file mode 100644 index 000000000000..e652d8e4fd17 --- /dev/null +++ b/test/runtime/samples/component-slot-warning/_config.js @@ -0,0 +1,9 @@ +export default { + compileOptions: { + dev: true + }, + warnings: [ + 'Received unexpected slot named "default"', + 'Received unexpected slot named "slot1"' + ] +}; diff --git a/test/runtime/samples/component-slot-warning/main.svelte b/test/runtime/samples/component-slot-warning/main.svelte new file mode 100644 index 000000000000..c29ef3e85be2 --- /dev/null +++ b/test/runtime/samples/component-slot-warning/main.svelte @@ -0,0 +1,7 @@ + + + + + From 6931a0c1cf44d92f73f61a3b1e4ae045363db25e Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Tue, 3 Mar 2020 15:56:10 +0800 Subject: [PATCH 2/7] update js code snapshot --- test/js/samples/capture-inject-state/expected.js | 4 ++++ test/js/samples/debug-empty/expected.js | 6 +++++- test/js/samples/debug-foo-bar-baz-things/expected.js | 6 +++++- test/js/samples/debug-foo/expected.js | 6 +++++- test/js/samples/debug-hoisted/expected.js | 5 ++++- test/js/samples/debug-no-dependencies/expected.js | 5 ++++- .../samples/dev-warning-missing-data-computed/expected.js | 6 +++++- test/js/samples/loop-protect/expected.js | 8 ++++++-- 8 files changed, 38 insertions(+), 8 deletions(-) diff --git a/test/js/samples/capture-inject-state/expected.js b/test/js/samples/capture-inject-state/expected.js index 859314556580..017d9868d543 100644 --- a/test/js/samples/capture-inject-state/expected.js +++ b/test/js/samples/capture-inject-state/expected.js @@ -14,6 +14,7 @@ import { space, subscribe, text, + validate_slot, validate_store } from "svelte/internal"; @@ -114,6 +115,9 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); + let { $$slots = {}, $$scope } = $$props; + validate_slot($$slots, []); + $$self.$set = $$props => { if ("prop" in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop)); if ("alias" in $$props) $$invalidate(1, realName = $$props.alias); diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js index 87d78bd69821..6f16a655eede 100644 --- a/test/js/samples/debug-empty/expected.js +++ b/test/js/samples/debug-empty/expected.js @@ -12,7 +12,8 @@ import { safe_not_equal, set_data_dev, space, - text + text, + validate_slot } from "svelte/internal"; const file = undefined; @@ -75,6 +76,9 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); + let { $$slots = {}, $$scope } = $$props; + validate_slot($$slots, []); + $$self.$set = $$props => { if ("name" in $$props) $$invalidate(0, name = $$props.name); }; diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js index 589c4a783288..4352e981f842 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected.js @@ -14,7 +14,8 @@ import { set_data_dev, space, text, - validate_each_argument + validate_each_argument, + validate_slot } from "svelte/internal"; const file = undefined; @@ -179,6 +180,9 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); + let { $$slots = {}, $$scope } = $$props; + validate_slot($$slots, []); + $$self.$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js index 10129e1b2837..8767eb3acaba 100644 --- a/test/js/samples/debug-foo/expected.js +++ b/test/js/samples/debug-foo/expected.js @@ -14,7 +14,8 @@ import { set_data_dev, space, text, - validate_each_argument + validate_each_argument, + validate_slot } from "svelte/internal"; const file = undefined; @@ -171,6 +172,9 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); + let { $$slots = {}, $$scope } = $$props; + validate_slot($$slots, []); + $$self.$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js index 190ff12c50ee..a774f99b5de3 100644 --- a/test/js/samples/debug-hoisted/expected.js +++ b/test/js/samples/debug-hoisted/expected.js @@ -4,7 +4,8 @@ import { dispatch_dev, init, noop, - safe_not_equal + safe_not_equal, + validate_slot } from "svelte/internal"; const file = undefined; @@ -56,6 +57,8 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); + let { $$slots = {}, $$scope } = $$props; + validate_slot($$slots, []); $$self.$capture_state = () => ({ obj, kobzol }); $$self.$inject_state = $$props => { diff --git a/test/js/samples/debug-no-dependencies/expected.js b/test/js/samples/debug-no-dependencies/expected.js index a097869e747b..3f89b93bc11d 100644 --- a/test/js/samples/debug-no-dependencies/expected.js +++ b/test/js/samples/debug-no-dependencies/expected.js @@ -11,7 +11,8 @@ import { safe_not_equal, space, text, - validate_each_argument + validate_each_argument, + validate_slot } from "svelte/internal"; const file = undefined; @@ -141,6 +142,8 @@ function instance($$self, $$props) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); + let { $$slots = {}, $$scope } = $$props; + validate_slot($$slots, []); return []; } diff --git a/test/js/samples/dev-warning-missing-data-computed/expected.js b/test/js/samples/dev-warning-missing-data-computed/expected.js index 9c28e0406450..658260a080bf 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -12,7 +12,8 @@ import { safe_not_equal, set_data_dev, space, - text + text, + validate_slot } from "svelte/internal"; const file = undefined; @@ -72,6 +73,9 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); + let { $$slots = {}, $$scope } = $$props; + validate_slot($$slots, []); + $$self.$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); }; diff --git a/test/js/samples/loop-protect/expected.js b/test/js/samples/loop-protect/expected.js index f433bd61a962..3dfd75911e84 100644 --- a/test/js/samples/loop-protect/expected.js +++ b/test/js/samples/loop-protect/expected.js @@ -11,7 +11,8 @@ import { insert_dev, loop_guard, noop, - safe_not_equal + safe_not_equal, + validate_slot } from "svelte/internal"; const { console: console_1 } = globals; @@ -110,6 +111,9 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(` was created with unknown prop '${key}'`); }); + let { $$slots = {}, $$scope } = $$props; + validate_slot($$slots, []); + function div_binding($$value) { binding_callbacks[$$value ? "unshift" : "push"](() => { $$invalidate(0, node = $$value); @@ -161,4 +165,4 @@ class Component extends SvelteComponentDev { } } -export default Component; +export default Component; \ No newline at end of file From d9388caa03fdf3f6a3441dc90923b6c5f14d094c Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Wed, 4 Mar 2020 22:40:06 +0800 Subject: [PATCH 3/7] fix slot fallback not empty --- src/compiler/compile/render_dom/Block.ts | 4 ++-- .../compile/render_dom/wrappers/InlineComponent/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/compile/render_dom/Block.ts b/src/compiler/compile/render_dom/Block.ts index 62bdc5bdd9af..f9273f7fc93c 100644 --- a/src/compiler/compile/render_dom/Block.ts +++ b/src/compiler/compile/render_dom/Block.ts @@ -411,8 +411,8 @@ export default class Block { return body; } - has_content() { - return this.renderer.options.dev || + has_content(ignore_dev?: boolean) { + return (!ignore_dev && this.renderer.options.dev) || this.first || this.event_listeners.length > 0 || this.chunks.intro.length > 0 || diff --git a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts index 8c8bd706962e..660e4831a2d5 100644 --- a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts +++ b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts @@ -154,7 +154,7 @@ export default class InlineComponentWrapper extends Wrapper { // removing empty slot for (const slot of this.slots.keys()) { - if (!this.slots.get(slot).block.has_content()) { + if (!this.slots.get(slot).block.has_content(true)) { this.slots.delete(slot); } } From a31253de4eb1d8794692aeed97caf68c5ef82923 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Wed, 4 Mar 2020 19:17:42 -0500 Subject: [PATCH 4/7] tidy usage of block.has_content() --- src/compiler/compile/render_dom/Block.ts | 5 ++--- src/compiler/compile/render_dom/index.ts | 2 +- .../compile/render_dom/wrappers/InlineComponent/index.ts | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/compiler/compile/render_dom/Block.ts b/src/compiler/compile/render_dom/Block.ts index f9273f7fc93c..2da77d3fbf52 100644 --- a/src/compiler/compile/render_dom/Block.ts +++ b/src/compiler/compile/render_dom/Block.ts @@ -411,9 +411,8 @@ export default class Block { return body; } - has_content(ignore_dev?: boolean) { - return (!ignore_dev && this.renderer.options.dev) || - this.first || + has_content() { + return this.first || this.event_listeners.length > 0 || this.chunks.intro.length > 0 || this.chunks.outro.length > 0 || diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts index 179115b5b248..466e8db4986d 100644 --- a/src/compiler/compile/render_dom/index.ts +++ b/src/compiler/compile/render_dom/index.ts @@ -264,7 +264,7 @@ export default function dom( args.push(x`$$props`); } - const has_create_fragment = block.has_content(); + const has_create_fragment = component.compile_options.dev || block.has_content(); if (has_create_fragment) { body.push(b` function create_fragment(#ctx) { diff --git a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts index 660e4831a2d5..8c8bd706962e 100644 --- a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts +++ b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts @@ -154,7 +154,7 @@ export default class InlineComponentWrapper extends Wrapper { // removing empty slot for (const slot of this.slots.keys()) { - if (!this.slots.get(slot).block.has_content(true)) { + if (!this.slots.get(slot).block.has_content()) { this.slots.delete(slot); } } From 43781ae44eb1e9b5e898daf670fd9e095927f75b Mon Sep 17 00:00:00 2001 From: Conduitry Date: Wed, 4 Mar 2020 19:21:02 -0500 Subject: [PATCH 5/7] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0672d790ea4..f39308e5ffa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +* In `dev` mode, display a runtime warning when a component is passed an unexpected slot ([#1020](https://github.com/sveltejs/svelte/issues/1020), [#1447](https://github.com/sveltejs/svelte/issues/1447)) * In `vars` array, correctly indicate whether `module` variables are `mutated` or `reassigned` ([#3215](https://github.com/sveltejs/svelte/issues/3215)) * Fix spread props not updating in certain situations ([#3521](https://github.com/sveltejs/svelte/issues/3521), [#4480](https://github.com/sveltejs/svelte/issues/4480)) * Use the fallback content for slots if they are passed only whitespace ([#4092](https://github.com/sveltejs/svelte/issues/4092)) From 16021129d80c1208e971e238e80386f047651c88 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Wed, 4 Mar 2020 19:43:40 -0500 Subject: [PATCH 6/7] improve warning message --- src/compiler/compile/render_dom/index.ts | 2 +- src/runtime/internal/dev.ts | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts index 466e8db4986d..fc3c94a2be19 100644 --- a/src/compiler/compile/render_dom/index.ts +++ b/src/compiler/compile/render_dom/index.ts @@ -413,7 +413,7 @@ export default function dom( ${unknown_props_check} ${component.slots.size || component.compile_options.dev ? b`let { $$slots = {}, $$scope } = $$props;` : null} - ${component.compile_options.dev && b`@validate_slot($$slots, [${Array.from(component.slots.keys()).map(key => `"${key}"`).join(',')}]);`} + ${component.compile_options.dev && b`@validate_slots('${component.tag}', $$slots, [${[...component.slots.keys()].map(key => `'${key}'`).join(',')}]);`} ${renderer.binding_groups.length > 0 && b`const $$binding_groups = [${renderer.binding_groups.map(_ => x`[]`)}];`} diff --git a/src/runtime/internal/dev.ts b/src/runtime/internal/dev.ts index 865f23ce1165..751f1f802bc0 100644 --- a/src/runtime/internal/dev.ts +++ b/src/runtime/internal/dev.ts @@ -89,11 +89,10 @@ export function validate_each_argument(arg) { } } -export function validate_slot(slot, keys) { - keys = new Set(keys); +export function validate_slots(name, slot, keys) { for (const slot_key of Object.keys(slot)) { - if (!keys.has(slot_key)) { - console.warn(`Received unexpected slot named "${slot_key}"`); + if (!~keys.indexOf(slot_key)) { + console.warn(`<${name}> received an unexpected slot "${slot_key}".`); } } } From 0efe244e4069dbeaaa3a4bb3403b80e0ed02eec6 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Wed, 4 Mar 2020 19:51:25 -0500 Subject: [PATCH 7/7] update tests --- test/js/samples/capture-inject-state/expected.js | 4 ++-- test/js/samples/debug-empty/expected.js | 4 ++-- test/js/samples/debug-foo-bar-baz-things/expected.js | 4 ++-- test/js/samples/debug-foo/expected.js | 4 ++-- test/js/samples/debug-hoisted/expected.js | 4 ++-- test/js/samples/debug-no-dependencies/expected.js | 4 ++-- test/js/samples/dev-warning-missing-data-computed/expected.js | 4 ++-- test/js/samples/loop-protect/expected.js | 4 ++-- test/runtime/samples/component-slot-warning/_config.js | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/js/samples/capture-inject-state/expected.js b/test/js/samples/capture-inject-state/expected.js index 017d9868d543..cd719ac5d25f 100644 --- a/test/js/samples/capture-inject-state/expected.js +++ b/test/js/samples/capture-inject-state/expected.js @@ -14,7 +14,7 @@ import { space, subscribe, text, - validate_slot, + validate_slots, validate_store } from "svelte/internal"; @@ -116,7 +116,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slot($$slots, []); + validate_slots("Component", $$slots, []); $$self.$set = $$props => { if ("prop" in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop)); diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js index 6f16a655eede..dd142adb26b2 100644 --- a/test/js/samples/debug-empty/expected.js +++ b/test/js/samples/debug-empty/expected.js @@ -13,7 +13,7 @@ import { set_data_dev, space, text, - validate_slot + validate_slots } from "svelte/internal"; const file = undefined; @@ -77,7 +77,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slot($$slots, []); + validate_slots("Component", $$slots, []); $$self.$set = $$props => { if ("name" in $$props) $$invalidate(0, name = $$props.name); diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js index 4352e981f842..977702b99f5c 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected.js @@ -15,7 +15,7 @@ import { space, text, validate_each_argument, - validate_slot + validate_slots } from "svelte/internal"; const file = undefined; @@ -181,7 +181,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slot($$slots, []); + validate_slots("Component", $$slots, []); $$self.$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js index 8767eb3acaba..fe62ff77bfb1 100644 --- a/test/js/samples/debug-foo/expected.js +++ b/test/js/samples/debug-foo/expected.js @@ -15,7 +15,7 @@ import { space, text, validate_each_argument, - validate_slot + validate_slots } from "svelte/internal"; const file = undefined; @@ -173,7 +173,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slot($$slots, []); + validate_slots("Component", $$slots, []); $$self.$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js index a774f99b5de3..0e634297f08f 100644 --- a/test/js/samples/debug-hoisted/expected.js +++ b/test/js/samples/debug-hoisted/expected.js @@ -5,7 +5,7 @@ import { init, noop, safe_not_equal, - validate_slot + validate_slots } from "svelte/internal"; const file = undefined; @@ -58,7 +58,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slot($$slots, []); + validate_slots("Component", $$slots, []); $$self.$capture_state = () => ({ obj, kobzol }); $$self.$inject_state = $$props => { diff --git a/test/js/samples/debug-no-dependencies/expected.js b/test/js/samples/debug-no-dependencies/expected.js index 3f89b93bc11d..76068e8cf464 100644 --- a/test/js/samples/debug-no-dependencies/expected.js +++ b/test/js/samples/debug-no-dependencies/expected.js @@ -12,7 +12,7 @@ import { space, text, validate_each_argument, - validate_slot + validate_slots } from "svelte/internal"; const file = undefined; @@ -143,7 +143,7 @@ function instance($$self, $$props) { }); let { $$slots = {}, $$scope } = $$props; - validate_slot($$slots, []); + validate_slots("Component", $$slots, []); return []; } diff --git a/test/js/samples/dev-warning-missing-data-computed/expected.js b/test/js/samples/dev-warning-missing-data-computed/expected.js index 658260a080bf..0a50e2cd970a 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -13,7 +13,7 @@ import { set_data_dev, space, text, - validate_slot + validate_slots } from "svelte/internal"; const file = undefined; @@ -74,7 +74,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slot($$slots, []); + validate_slots("Component", $$slots, []); $$self.$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); diff --git a/test/js/samples/loop-protect/expected.js b/test/js/samples/loop-protect/expected.js index 3dfd75911e84..c52d9df437e5 100644 --- a/test/js/samples/loop-protect/expected.js +++ b/test/js/samples/loop-protect/expected.js @@ -12,7 +12,7 @@ import { loop_guard, noop, safe_not_equal, - validate_slot + validate_slots } from "svelte/internal"; const { console: console_1 } = globals; @@ -112,7 +112,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slot($$slots, []); + validate_slots("Component", $$slots, []); function div_binding($$value) { binding_callbacks[$$value ? "unshift" : "push"](() => { diff --git a/test/runtime/samples/component-slot-warning/_config.js b/test/runtime/samples/component-slot-warning/_config.js index e652d8e4fd17..6ffe624782e0 100644 --- a/test/runtime/samples/component-slot-warning/_config.js +++ b/test/runtime/samples/component-slot-warning/_config.js @@ -3,7 +3,7 @@ export default { dev: true }, warnings: [ - 'Received unexpected slot named "default"', - 'Received unexpected slot named "slot1"' + ' received an unexpected slot "default".', + ' received an unexpected slot "slot1".' ] };