mirror of https://github.com/sveltejs/svelte
parent
c0d92628dd
commit
3576c7443e
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ensure identifiers in destructuring contexts don't clash with existing ones
|
@ -0,0 +1,25 @@
|
|||||||
|
export default {
|
||||||
|
get props() {
|
||||||
|
return {
|
||||||
|
thePromise: new Promise((_) => {})
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `
|
||||||
|
Waiting...
|
||||||
|
`,
|
||||||
|
|
||||||
|
async test({ assert, component, target }) {
|
||||||
|
await (component.thePromise = Promise.resolve({ func: 12345 }));
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, '12345');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await (component.thePromise = Promise.reject({ func: 67890 }));
|
||||||
|
} catch (e) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, '67890');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
export let thePromise;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#await thePromise}
|
||||||
|
Waiting...
|
||||||
|
{:then { func }}
|
||||||
|
{(() => func)()}
|
||||||
|
{:catch { func: func_1 }}
|
||||||
|
{(() => func_1)()}
|
||||||
|
{/await}
|
@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
[12,13,14]
|
||||||
|
`
|
||||||
|
};
|
@ -0,0 +1,8 @@
|
|||||||
|
<script>
|
||||||
|
const func = 100;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if true}
|
||||||
|
{@const [func_1] = [[12, 13, 14]]}
|
||||||
|
{(() => JSON.stringify(func_1))()}
|
||||||
|
{/if}
|
@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<p>1</p>
|
||||||
|
<p>2</p>
|
||||||
|
<p>3</p>
|
||||||
|
<p>4</p>
|
||||||
|
<p>5</p>
|
||||||
|
`
|
||||||
|
};
|
@ -0,0 +1,3 @@
|
|||||||
|
{#each [1, 2, 3, 4, 5] as func}
|
||||||
|
<p>{(() => func)()}</p>
|
||||||
|
{/each}
|
Loading…
Reference in new issue