mirror of https://github.com/sveltejs/svelte
parent
e0568fd976
commit
90c8f97249
@ -0,0 +1,10 @@
|
||||
export default {
|
||||
async test({ assert, component, target, window }) {
|
||||
const button = target.querySelector('button');
|
||||
const event = new window.MouseEvent('click');
|
||||
|
||||
await button.dispatchEvent(event);
|
||||
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,25 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = [{
|
||||
a: {
|
||||
b: 10
|
||||
}
|
||||
}];
|
||||
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function clickEvent() {
|
||||
a = [{}];
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={clickEvent}></button>
|
||||
|
||||
{#each a as item (item.a.b)}
|
||||
{item}
|
||||
{/each}
|
||||
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,14 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = [{}]
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
{#each a as item (item.a.b)}
|
||||
{item}
|
||||
{/each}
|
||||
Loading…
Reference in new issue