File tree 5 files changed +41
-0
lines changed
test/runtime/samples/dynamic-component-in-if
5 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ export default class Component extends Node {
78
78
) {
79
79
this . cannotUseInnerHTML ( ) ;
80
80
81
+ if ( this . expression ) {
82
+ block . addDependencies ( this . expression . dependencies ) ;
83
+ }
84
+
81
85
this . attributes . forEach ( attr => {
82
86
block . addDependencies ( attr . dependencies ) ;
83
87
} ) ;
Original file line number Diff line number Diff line change
1
+ < p > Bar</ p >
Original file line number Diff line number Diff line change
1
+ < p > Foo</ p >
Original file line number Diff line number Diff line change
1
+ export default {
2
+ html : `
3
+ <p>Foo</p>
4
+ ` ,
5
+
6
+ test ( assert , component , target ) {
7
+ const { Bar } = component . get ( ) ;
8
+
9
+ component . set ( {
10
+ x : Bar
11
+ } ) ;
12
+
13
+ assert . htmlEqual ( target . innerHTML , `
14
+ <p>Bar</p>
15
+ ` ) ;
16
+ }
17
+ } ;
Original file line number Diff line number Diff line change
1
+ {#if x}
2
+ < svelte:component this ={x}/ >
3
+ {/if}
4
+
5
+ < script >
6
+ import Foo from './Foo.html' ;
7
+ import Bar from './Bar.html' ;
8
+
9
+ export default {
10
+ data ( ) {
11
+ return {
12
+ x : Foo ,
13
+ Foo,
14
+ Bar
15
+ } ;
16
+ }
17
+ } ;
18
+ </ script >
You can’t perform that action at this time.
0 commit comments