mirror of https://github.com/sveltejs/svelte
parent
5b426bc8e2
commit
ed16aa2a81
@ -0,0 +1,17 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
mode: ['client'],
|
||||||
|
compileOptions: {
|
||||||
|
runes: undefined
|
||||||
|
},
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const p = target.querySelector('p');
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
assert.equal(p?.innerHTML, '0');
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
import { get, set } from "./test.svelte.js";
|
||||||
|
|
||||||
|
$$props;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{get()}</p>
|
||||||
|
|
||||||
|
<button onclick={()=>set()}></button>
|
@ -0,0 +1,9 @@
|
|||||||
|
let count = $state(0);
|
||||||
|
|
||||||
|
export function get() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function set() {
|
||||||
|
count++;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
mode: ['client'],
|
||||||
|
compileOptions: {
|
||||||
|
runes: undefined
|
||||||
|
},
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const p = target.querySelector('p');
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
assert.equal(p?.innerHTML, '0');
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
import { get, set } from "./test.svelte.js";
|
||||||
|
|
||||||
|
$$restProps;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{get()}</p>
|
||||||
|
|
||||||
|
<button onclick={()=>set()}></button>
|
@ -0,0 +1,9 @@
|
|||||||
|
let count = $state(0);
|
||||||
|
|
||||||
|
export function get() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function set() {
|
||||||
|
count++;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
mode: ['client'],
|
||||||
|
compileOptions: {
|
||||||
|
runes: undefined
|
||||||
|
},
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const p = target.querySelector('p');
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
assert.equal(p?.innerHTML, '0');
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
import { get, set } from "./test.svelte.js";
|
||||||
|
|
||||||
|
$: console.log("");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{get()}</p>
|
||||||
|
|
||||||
|
<button onclick={()=>set()}></button>
|
@ -0,0 +1,9 @@
|
|||||||
|
let count = $state(0);
|
||||||
|
|
||||||
|
export function get() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function set() {
|
||||||
|
count++;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
mode: ['client'],
|
||||||
|
compileOptions: {
|
||||||
|
runes: undefined
|
||||||
|
},
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const p = target.querySelector('p');
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
flushSync(() => {
|
||||||
|
btn?.click();
|
||||||
|
});
|
||||||
|
assert.equal(p?.innerHTML, '0');
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
import { get, set } from "./test.svelte.js";
|
||||||
|
|
||||||
|
export let x = 42;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{x}
|
||||||
|
<p>{get()}</p>
|
||||||
|
|
||||||
|
<button onclick={()=>set()}></button>
|
@ -0,0 +1,9 @@
|
|||||||
|
let count = $state(0);
|
||||||
|
|
||||||
|
export function get() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function set() {
|
||||||
|
count++;
|
||||||
|
}
|
Loading…
Reference in new issue