mirror of https://github.com/sveltejs/svelte
parent
ad2aba861b
commit
5343883edf
@ -0,0 +1,9 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, false);
|
||||
|
||||
component.visible = false;
|
||||
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,22 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
export var visible = true;
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function action(node, arg) {
|
||||
return {
|
||||
destroy() {
|
||||
a.b;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
<div use:action />
|
||||
{/if}
|
||||
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function action(node, arg) {
|
||||
a.b;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div use:action={10} />
|
||||
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function action() {
|
||||
a.b;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div use:action />
|
||||
@ -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,12 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {};
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<button on:click={() => console.log(a.b.c)}></button>
|
||||
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {};
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<a href={a.b.c}></a>
|
||||
@ -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,21 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {
|
||||
b: {
|
||||
c: "10"
|
||||
}
|
||||
};
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function clickEvent() {
|
||||
a = {};
|
||||
}
|
||||
</script>
|
||||
|
||||
<input bind:value={a.b.c} />
|
||||
<button on:click={clickEvent}></button>
|
||||
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {};
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<input bind:value={a.b.c} />
|
||||
Loading…
Reference in new issue