mirror of https://github.com/sveltejs/svelte
parent
0df811fe86
commit
6ddad99ddd
@ -0,0 +1,4 @@
|
||||
export default {
|
||||
customElement: true,
|
||||
shadowDom: false
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
<svelte:options tag="custom-element"/>
|
||||
|
||||
<script>
|
||||
import './other.svelte'
|
||||
</script>
|
||||
|
||||
<other-element>Hello world</other-element>
|
@ -0,0 +1,3 @@
|
||||
<svelte:options tag="other-element"/>
|
||||
|
||||
<h1><slot/></h1>
|
@ -0,0 +1,17 @@
|
||||
import * as assert from 'assert';
|
||||
import CustomElement from './main.svelte';
|
||||
|
||||
export default function (target) {
|
||||
new CustomElement({
|
||||
target
|
||||
});
|
||||
|
||||
assert.equal(target.innerHTML, '<custom-element><other-element><h1>Hello world!</h1></other-element></custom-element>');
|
||||
|
||||
const el = target.querySelector('custom-element');
|
||||
const h1 = el.querySelector('h1');
|
||||
const { color } = getComputedStyle(h1);
|
||||
|
||||
assert.equal(h1.textContent, 'Hello world!');
|
||||
assert.equal(color, 'rgb(0, 0, 255)');
|
||||
}
|
Loading…
Reference in new issue