mirror of https://github.com/sveltejs/svelte
parent
56b71665b5
commit
fa3d118550
@ -1,12 +1,15 @@
|
|||||||
import { test } from '../../test';
|
import { test } from '../../test';
|
||||||
|
|
||||||
export default test({
|
export default test({
|
||||||
html: `<button></button>`,
|
html: `<button type="button">Update Text</button><div></div>`,
|
||||||
|
|
||||||
async test({ assert, target }) {
|
async test({ assert, target }) {
|
||||||
const btn = target.querySelector('button');
|
const btn = target.querySelector('button');
|
||||||
|
|
||||||
await btn?.click();
|
await btn?.click();
|
||||||
assert.htmlEqual(target.innerHTML, `<button>foo</button>`);
|
assert.htmlEqual(
|
||||||
|
target.innerHTML,
|
||||||
|
`<button type="button">Update Text</button><div>updated</div>`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
let foo = $state();
|
let text = $state('');
|
||||||
|
|
||||||
|
function update_text() {
|
||||||
|
text = 'updated';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button on:click={() => foo = 'foo'}>{foo}</button>
|
<button type="button" on:click={update_text}>Update Text</button>
|
||||||
|
|
||||||
|
<div>{text}</div>
|
||||||
|
|||||||
@ -1,15 +1,12 @@
|
|||||||
import { test } from '../../test';
|
import { test } from '../../test';
|
||||||
|
|
||||||
export default test({
|
export default test({
|
||||||
html: `<button type="button">Update Text</button><div></div>`,
|
html: `<button></button>`,
|
||||||
|
|
||||||
async test({ assert, target }) {
|
async test({ assert, target }) {
|
||||||
const btn = target.querySelector('button');
|
const btn = target.querySelector('button');
|
||||||
|
|
||||||
await btn?.click();
|
await btn?.click();
|
||||||
assert.htmlEqual(
|
assert.htmlEqual(target.innerHTML, `<button>foo</button>`);
|
||||||
target.innerHTML,
|
|
||||||
`<button type="button">Update Text</button><div>updated</div>`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
let text = $state('');
|
let foo = $state();
|
||||||
|
|
||||||
function update_text() {
|
|
||||||
text = 'updated';
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button type="button" on:click={update_text}>Update Text</button>
|
<button on:click={() => foo = 'foo'}>{foo}</button>
|
||||||
|
|
||||||
<div>{text}</div>
|
|
||||||
|
|||||||
Loading…
Reference in new issue