mirror of https://github.com/sveltejs/svelte
parent
a902e1bded
commit
f4f7a13eb4
@ -0,0 +1,21 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
mode: ['client', 'hydrate'],
|
||||
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
|
||||
test({ assert, errors }) {
|
||||
const [button] = document.querySelectorAll('button');
|
||||
|
||||
try {
|
||||
flushSync(() => button.click());
|
||||
} catch (e) {
|
||||
assert.equal(errors.length, 1); // for whatever reason we can't get the name which should be UpdatedAtError
|
||||
assert.ok(/** @type {Error} */ (e).message.startsWith('effect_update_depth_exceeded'));
|
||||
}
|
||||
}
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
let condition = $state(false);
|
||||
let count = $state(0);
|
||||
|
||||
$effect(() => {
|
||||
if (condition) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<button onclick={() => condition = !condition}>toggle</button>
|
Loading…
Reference in new issue