mirror of https://github.com/sveltejs/svelte
parent
96e97682e0
commit
840a7bed4b
@ -0,0 +1,13 @@
|
||||
<svelte:options tag="custom-element" shadowdom="none" />
|
||||
|
||||
<script>
|
||||
export let name;
|
||||
</script>
|
||||
|
||||
<h1>Hello {name}!</h1>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,16 @@
|
||||
import * as assert from 'assert';
|
||||
import { tick } from 'svelte';
|
||||
import './main.svelte';
|
||||
|
||||
export default async function (target) {
|
||||
target.innerHTML = '<custom-element name="world"></custom-element>';
|
||||
await tick();
|
||||
|
||||
const el = target.querySelector('custom-element');
|
||||
const h1 = el.querySelector('h1');
|
||||
|
||||
assert.equal(el.name, 'world');
|
||||
assert.equal(el.shadowRoot, null);
|
||||
assert.equal(h1.innerHTML, 'Hello world!');
|
||||
assert.equal(getComputedStyle(h1).color, 'rgb(255, 0, 0)');
|
||||
}
|
||||
Loading…
Reference in new issue