mirror of https://github.com/sveltejs/svelte
commit
c6f053ebbb
@ -1 +1 @@
|
||||
{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["<Widget/>\n\n<script>\n\timport Widget from './Widget.html';\n\n\texport default {\n\t\tcomponents: {\n\t\t\tWidget\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["<Widget/>\n\n<script>\n\timport Widget from './Widget.html';\n\n\texport default {\n\t\tcomponents: {\n\t\t\tWidget\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@ -1 +1 @@
|
||||
{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["<p>widget</p>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["<p>widget</p>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@ -1 +1 @@
|
||||
{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["<p>Hello world!</p>\n\n<script>\n\texport default {\n\t\tonrender () {\n\t\t\tconsole.log( 'here' );\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["<p>Hello world!</p>\n\n<script>\n\texport default {\n\t\tonrender () {\n\t\t\tconsole.log( 'here' );\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@ -0,0 +1,41 @@
|
||||
let fulfil;
|
||||
|
||||
let thePromise = new Promise(f => {
|
||||
fulfil = f;
|
||||
});
|
||||
|
||||
export default {
|
||||
data: {
|
||||
thePromise
|
||||
},
|
||||
|
||||
html: `waiting`,
|
||||
|
||||
test(assert, component, target) {
|
||||
fulfil(9000);
|
||||
|
||||
return thePromise
|
||||
.then(() => {
|
||||
assert.htmlEqual(target.innerHTML, `resolved`);
|
||||
|
||||
let reject;
|
||||
|
||||
thePromise = new Promise((f, r) => {
|
||||
reject = r;
|
||||
});
|
||||
|
||||
component.set({
|
||||
thePromise
|
||||
});
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `waiting`);
|
||||
|
||||
reject(new Error('something broke'));
|
||||
|
||||
return thePromise.catch(() => {});
|
||||
})
|
||||
.then(() => {
|
||||
assert.htmlEqual(target.innerHTML, `rejected`);
|
||||
});
|
||||
}
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
{#await thePromise}
|
||||
waiting
|
||||
{:then}
|
||||
resolved
|
||||
{:catch}
|
||||
rejected
|
||||
{/await}
|
@ -0,0 +1,23 @@
|
||||
export default {
|
||||
test(assert, component) {
|
||||
const events = [];
|
||||
component.on('foo', (shouldThrow) => {
|
||||
events.push(shouldThrow);
|
||||
if (shouldThrow) {
|
||||
throw new Error();
|
||||
}
|
||||
});
|
||||
component.fire('foo', false);
|
||||
assert.equal(events.toString(), 'false');
|
||||
let threw = false;
|
||||
try {
|
||||
component.fire('foo', true);
|
||||
} catch (err) {
|
||||
threw = true;
|
||||
}
|
||||
assert.equal(threw, true);
|
||||
assert.equal(events.toString(), 'false,true');
|
||||
component.fire('foo', false);
|
||||
assert.equal(events.toString(), 'false,true,false');
|
||||
},
|
||||
};
|
@ -0,0 +1 @@
|
||||
Foo
|
@ -0,0 +1 @@
|
||||
Foo
|
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
nestedTransitions: true,
|
||||
data: { items: [] },
|
||||
html: `No items.`,
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
{#each items as item}
|
||||
<Widget {item}/>
|
||||
{:else}
|
||||
No items.
|
||||
{/each}
|
||||
|
||||
<script>
|
||||
export default { components: { Widget: './Widget.html' } };
|
||||
</script>
|
Loading…
Reference in new issue