Skip to content

Commit a466021

Browse files
committed
failing test
1 parent df3342f commit a466021

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
import { flushSync } from 'svelte';
12
import { test } from '../../test';
23

34
export default test({
4-
ssrHtml: `<div></div>`,
5-
html: `<div>set from component</div>`
5+
ssrHtml: `<button>update</button><div></div>`,
6+
html: `<button>update</button><div>one</div>`,
7+
8+
test({ target, assert }) {
9+
const button = target.querySelector('button');
10+
11+
flushSync(() => button?.click());
12+
assert.htmlEqual(target.innerHTML, '<button>update</button><div>two</div>');
13+
}
614
});
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<script>
22
import Child from './Child.svelte';
3+
4+
let message = $state('one');
5+
6+
function attachment(message) {
7+
return (node) => {
8+
node.textContent = message;
9+
};
10+
}
311
</script>
412

5-
<Child {@attach (node) => node.textContent = 'set from component'} />
13+
<button onclick={() => message = 'two'}>update</button>
14+
15+
<Child {@attach attachment(message)} />

0 commit comments

Comments
 (0)