mirror of https://github.com/sveltejs/svelte
support $$props and $$restProps for custom elements (#5608)
parent
0ca36a16b5
commit
6fa3e91b5d
@ -0,0 +1,10 @@
|
||||
<svelte:options tag="custom-element"/>
|
||||
|
||||
<script>
|
||||
export let name;
|
||||
</script>
|
||||
|
||||
<p>name: {name}</p>
|
||||
<p>$$props: {JSON.stringify($$props)}</p>
|
||||
<p>$$restProps: {JSON.stringify($$restProps)}</p>
|
||||
|
@ -0,0 +1,13 @@
|
||||
import * as assert from 'assert';
|
||||
import './main.svelte';
|
||||
|
||||
export default function (target) {
|
||||
target.innerHTML = '<custom-element name="world" answer="42" test="svelte"></custom-element>';
|
||||
const el = target.querySelector('custom-element');
|
||||
|
||||
assert.htmlEqual(el.shadowRoot.innerHTML, `
|
||||
<p>name: world</p>
|
||||
<p>$$props: {"name":"world","answer":"42","test":"svelte"}</p>
|
||||
<p>$$restProps: {"answer":"42","test":"svelte"}</p>
|
||||
`);
|
||||
}
|
Loading…
Reference in new issue