File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ <script >
2
+ export let objectProp;
3
+ let count = 0 ;
4
+ $: objectPropCopy = [... objectProp];
5
+
6
+ $: incrementCount (), console .log (' propDependencyChanged' , objectProp);
7
+ const incrementCount = () => {
8
+ count++ ;
9
+ };
10
+ const clickAction = () => {
11
+ // note that this file shouldn't be formatted and the trailing comment must be rightnext to the variable name
12
+ // prettier-ignore
13
+ objectPropCopy = objectPropCopy// trailing comment
14
+ };
15
+ </script >
16
+
17
+ <button on:click ={clickAction }>click me!</button >
18
+
19
+ {objectPropCopy }
20
+ <div id ="render-count" >{count }</div >
Original file line number Diff line number Diff line change
1
+ export default {
2
+ async test ( { assert, target, window } ) {
3
+ const incrementButton = target . querySelector ( 'button' ) ;
4
+
5
+ assert . equal ( target . querySelector ( '#render-count' ) . innerHTML , '1' ) ;
6
+ await incrementButton . dispatchEvent ( new window . MouseEvent ( 'click' ) ) ;
7
+ assert . equal ( target . querySelector ( '#render-count' ) . innerHTML , '2' ) ;
8
+ }
9
+ } ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ import SomeComponent from ' ./SomeComponent.svelte' ;
3
+ let objectProp = [' name' , ' age' ];
4
+
5
+ // look in SomeComponent.svelte for explaination
6
+ </script >
7
+
8
+ <SomeComponent {objectProp } />
You can’t perform that action at this time.
0 commit comments