mirror of https://github.com/sveltejs/svelte
parent
880702d961
commit
b28f87a6f5
@ -1,32 +0,0 @@
|
|||||||
export default {
|
|
||||||
test(assert, component, target, window) {
|
|
||||||
const buttons = target.querySelectorAll('button');
|
|
||||||
const click = new window.MouseEvent('click');
|
|
||||||
|
|
||||||
const events = [];
|
|
||||||
component.$on('foo', event => {
|
|
||||||
const shouldThrow = event.detail;
|
|
||||||
|
|
||||||
events.push(shouldThrow);
|
|
||||||
if (shouldThrow) {
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttons[1].dispatchEvent(click);
|
|
||||||
assert.equal(events.toString(), 'false');
|
|
||||||
|
|
||||||
let threw = false;
|
|
||||||
try {
|
|
||||||
buttons[0].dispatchEvent(click);
|
|
||||||
} catch (err) {
|
|
||||||
threw = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.equal(threw, true);
|
|
||||||
assert.equal(events.toString(), 'false,true');
|
|
||||||
|
|
||||||
buttons[1].dispatchEvent(click);
|
|
||||||
assert.equal(events.toString(), 'false,true,false');
|
|
||||||
},
|
|
||||||
};
|
|
@ -1,8 +0,0 @@
|
|||||||
<script>
|
|
||||||
import { createEventDispatcher } from 'svelte';
|
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<button on:click="{() => dispatch('foo', true)}">throw</button>
|
|
||||||
<button on:click="{() => dispatch('foo', false)}">don't throw</button>
|
|
@ -1,9 +0,0 @@
|
|||||||
<script>
|
|
||||||
function state() {
|
|
||||||
// [svelte-upgrade warning]
|
|
||||||
// this function needs to be manually rewritten
|
|
||||||
return states;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<p>{state()["b-c"]}</p>
|
|
@ -1,3 +0,0 @@
|
|||||||
export default {
|
|
||||||
html: '<div><p>i am a widget</p></div>'
|
|
||||||
};
|
|
@ -1,7 +0,0 @@
|
|||||||
<script>
|
|
||||||
import Widget from './Widget.html';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<Widget b-c="i am a widget"/>
|
|
||||||
</div>
|
|
Loading…
Reference in new issue