mirror of https://github.com/sveltejs/svelte
fix: port over props that were set prior to initialization (#9701)
...and then delete the property descriptor that shadows the prototype descriptor fixes #9487pull/9719/head
parent
d15bc822e0
commit
31d939fefa
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: port over props that were set prior to initialization
|
@ -0,0 +1,9 @@
|
||||
<svelte:options
|
||||
customElement={null}
|
||||
/>
|
||||
|
||||
<script>
|
||||
export let prop;
|
||||
</script>
|
||||
|
||||
<p>{prop}</p>
|
@ -0,0 +1,23 @@
|
||||
import * as assert from 'assert.js';
|
||||
import { tick } from 'svelte';
|
||||
import Main from './main.svelte';
|
||||
|
||||
export default async function (target) {
|
||||
target.innerHTML = '<custom-element red white></custom-element>';
|
||||
const ce = target.querySelector('custom-element');
|
||||
ce.prop = 1;
|
||||
customElements.define('custom-element', Main.element);
|
||||
await tick();
|
||||
await tick();
|
||||
|
||||
const ce_root = target.querySelector('custom-element').shadowRoot;
|
||||
const p = ce_root.querySelector('p');
|
||||
|
||||
assert.equal(p.textContent, '1');
|
||||
|
||||
ce.prop = 2;
|
||||
await tick();
|
||||
await tick();
|
||||
|
||||
assert.equal(p.textContent, '2');
|
||||
}
|
Loading…
Reference in new issue