@ -6,31 +6,26 @@ export default test({
dev : true
} ,
html : ` <button>items: null</button> <div>x</div> <input type="checkbox" value="1"><input type="checkbox" value="2"><input> ` ,
test ( { assert , target , warnings } ) {
const b tn = target . querySelector ( 'button' ) ;
ok ( b tn) ;
const [ button1 , button2 , button3 ] = target . querySelectorAll ( 'button' ) ;
ok ( b ut to n1 ) ;
flushSync ( ( ) => btn . click ( ) ) ;
assert . htmlEqual (
target . innerHTML ,
` <button>items: []</button> <div>x</div> <input type="checkbox" value="1"><input type="checkbox" value="2"><input> `
) ;
flushSync ( ( ) => button1 . click ( ) ) ;
assert . htmlEqual ( button1 . innerHTML , ` items: [] ` ) ;
flushSync ( ( ) => btn . click ( ) ) ;
assert . htmlEqual (
target . innerHTML ,
` <button>items: [0]</button> <div>x</div> <input type="checkbox" value="1"><input type="checkbox" value="2"><input> `
) ;
flushSync ( ( ) => button1 . click ( ) ) ;
assert . htmlEqual ( button1 . innerHTML , ` items: [0] ` ) ;
const input = target . querySelector ( 'input' ) ;
ok ( input ) ;
input . checked = true ;
flushSync ( ( ) => input . dispatchEvent ( new Event ( 'change' , { bubbles : true } ) ) ) ;
flushSync ( ( ) => button2 . click ( ) ) ;
flushSync ( ( ) => button3 . click ( ) ) ;
assert . deepEqual ( warnings , [
'Assignment to `items` property (main.svelte:9:24) will evaluate to the right-hand side, not the value of `items` following the assignment. This may result in unexpected behaviour.'
'Assignment to `items` property (main.svelte: 17 :24) will evaluate to the right-hand side, not the value of `items` following the assignment. This may result in unexpected behaviour.'
] ) ;
}
} ) ;