proxied-state-each-blocks
Rich Harris 1 year ago committed by Dominic Gannaway
parent b45cd60198
commit 9bf3a6ddf0

@ -0,0 +1,12 @@
import { test } from '../../test';
export default test({
html: `<button>hello!</button>`,
async test({ assert, target }) {
const btn = target.querySelector('button');
await btn?.click();
assert.htmlEqual(target.innerHTML, `<button>goodbye!</button>`);
}
});

@ -0,0 +1,10 @@
<script>
import { magic } from 'svelte';
const ping = magic({});
ping.pong = { ping, pang: 'hello!' };
</script>
<button onclick={() => ping.pong.pang = 'goodbye!'}>
{ping.pong.ping.pong.ping.pong.pang}
</button>

@ -0,0 +1,12 @@
import { test } from '../../test';
export default test({
html: `<button>clicks: 0</button>`,
async test({ assert, target }) {
const btn = target.querySelector('button');
await btn?.click();
assert.htmlEqual(target.innerHTML, `<button>clicks: 1</button>`);
}
});

@ -0,0 +1,17 @@
<script>
import { magic } from 'svelte';
const inner = magic({
count: 0
})
const object = magic({
outer: {
inner
}
});
</script>
<button onclick={() => inner.count += 1}>
clicks: {object.outer.inner.count}
</button>
Loading…
Cancel
Save