forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support $$props and $$restProps for custom elements (sveltejs#5608)
- Loading branch information
1 parent
7571155
commit 52479ec
Showing
7 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters