mirror of https://github.com/sveltejs/svelte
fix: port over props that were set prior to initialization (#9704)
Svelte 5 version of #9701pull/9721/head
parent
2e461eb314
commit
65fa717ccd
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: port over props that were set prior to initialization
|
@ -0,0 +1,25 @@
|
|||||||
|
import { test } from '../../assert';
|
||||||
|
|
||||||
|
const tick = () => Promise.resolve();
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target, componentCtor }) {
|
||||||
|
target.innerHTML = '<custom-element red white></custom-element>';
|
||||||
|
const ce = target.querySelector('custom-element');
|
||||||
|
ce.prop = 1;
|
||||||
|
customElements.define('custom-element', componentCtor.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');
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
export let prop;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p>{prop}</p>
|
Loading…
Reference in new issue