mirror of https://github.com/sveltejs/svelte
parent
967e14e0ad
commit
648c62790d
@ -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,12 @@
|
||||
<script>
|
||||
import Child from "./child.svelte";
|
||||
import { onError } from "svelte";
|
||||
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:component this={Child} />
|
||||
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
test({ assert, component }) {
|
||||
assert.equal(component.error, true);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = [1, 2, 3];
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function handleClick() {
|
||||
a = 10;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each a as item}
|
||||
{item}
|
||||
{/each}
|
||||
|
||||
<button on:click={handleClick}></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,14 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {}
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
{#each a.b.c as item}
|
||||
{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.b.c as item}
|
||||
{item}
|
||||
{/each}
|
||||
@ -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,24 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
var a = {
|
||||
b: {
|
||||
c: false
|
||||
}
|
||||
};
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function clickEvent() {
|
||||
a = {};
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={clickEvent}></button>
|
||||
|
||||
{#if a.b.c === true}
|
||||
Hello world
|
||||
{/if}
|
||||
@ -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,4 @@
|
||||
<script>
|
||||
var a = {};
|
||||
console.log(a.b.c);
|
||||
</script>
|
||||
@ -0,0 +1,21 @@
|
||||
<script>
|
||||
import Child from "./child.svelte";
|
||||
import { onError } from "svelte";
|
||||
|
||||
var show = false;
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
|
||||
function clickEvent() {
|
||||
show = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={clickEvent}></button>
|
||||
|
||||
{#if show}
|
||||
<Child />
|
||||
{/if}
|
||||
@ -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>
|
||||
|
||||
{#if a.b.c === true}
|
||||
Hello world
|
||||
{/if}
|
||||
@ -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,15 @@
|
||||
<script>
|
||||
import Wrapper from "./wrapper.svelte";
|
||||
import Child from "./child.svelte";
|
||||
import { onError } from "svelte";
|
||||
|
||||
export var error = false;
|
||||
|
||||
onError(e => {
|
||||
error = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<Wrapper>
|
||||
<Child />
|
||||
</Wrapper>
|
||||
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import { onError } from "svelte";
|
||||
|
||||
onError(e => {});
|
||||
</script>
|
||||
|
||||
<slot />
|
||||
Loading…
Reference in new issue