mirror of https://github.com/sveltejs/svelte
parent
faea31a19d
commit
e14d3a6c7a
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
onError(e => {
|
||||
throw e;
|
||||
});
|
||||
|
||||
var a = {};
|
||||
console.log(a.b.c);
|
||||
</script>
|
||||
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
<script>
|
||||
var a = {};
|
||||
console.log(a.b.c);
|
||||
</script>
|
||||
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
@ -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;
|
||||
|
||||
a.b.c
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
@ -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;
|
||||
});
|
||||
|
||||
a.b.c
|
||||
</script>
|
||||
@ -0,0 +1,11 @@
|
||||
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);
|
||||
assert.equal(component.that, button);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {};
|
||||
var that;
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function clickEvent() {
|
||||
that = this;
|
||||
console.log(a.b.c);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={clickEvent}></button>
|
||||
@ -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,16 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {};
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function clickEvent() {
|
||||
console.log(a.b.c);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={clickEvent}></button>
|
||||
@ -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,22 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {
|
||||
b: {
|
||||
c: 10
|
||||
}
|
||||
};
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function causeError() {
|
||||
a = {};
|
||||
}
|
||||
</script>
|
||||
|
||||
{a.b.c}
|
||||
|
||||
<button on:click={causeError}></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.b.c}
|
||||
Loading…
Reference in new issue