pull/7551/head
Yuichiro Yamashita 4 years ago
parent a4fa98c532
commit 038e7b092a

@ -0,0 +1,11 @@
export default {
skip_if_ssr: true,
skip_if_hydrate_from_ssr: true,
compileOptions: {
dev: true
},
props: {
selected: false
},
error: 'this={...} of <svelte:component> should specify a Svelte component.'
};

@ -0,0 +1,9 @@
<script>
import Sub from './Sub.svelte';
export let selected;
let banana = {};
let component = banana;
$: selected ? component = Sub : component = banana;
</script>
<svelte:component this={component} />

@ -0,0 +1,16 @@
export default {
compileOptions: {
dev: true
},
props: {
selected: true
},
test({ assert, component }) {
try {
component.selected = false;
throw new Error('Expected an error');
} catch (err) {
assert.equal(err.message, 'this={...} of <svelte:component> should specify a Svelte component.');
}
}
};

@ -0,0 +1,9 @@
<script>
import Sub from './Sub.svelte';
export let selected;
let banana = {};
let component = banana;
$: selected ? component = Sub : component = banana;
</script>
<svelte:component this={component} />
Loading…
Cancel
Save