mirror of https://github.com/sveltejs/svelte
parent
ac21f62c96
commit
33eeefa3ba
@ -0,0 +1,13 @@
|
|||||||
|
import { test } from '../../assert';
|
||||||
|
const tick = () => Promise.resolve();
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target }) {
|
||||||
|
target.innerHTML = '<custom-element></custom-element>';
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
const el = target.querySelector('custom-element');
|
||||||
|
|
||||||
|
assert.equal(el.shadowRoot, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<svelte:options customElement={{ tag: "custom-element", shadow: { mode: 'closed' } }} />
|
||||||
|
|
||||||
|
<h1>Hello world!</h1>
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
import { test } from '../../assert';
|
||||||
|
const tick = () => Promise.resolve();
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target }) {
|
||||||
|
target.innerHTML = '<custom-element></custom-element>';
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
/** @type {ShadowRoot} */
|
||||||
|
const shadowRoot = target.querySelector('custom-element').shadowRoot;
|
||||||
|
|
||||||
|
assert.equal(shadowRoot.mode, 'open');
|
||||||
|
assert.equal(shadowRoot.clonable, true);
|
||||||
|
assert.equal(shadowRoot.delegatesFocus, true);
|
||||||
|
assert.equal(shadowRoot.serializable, true);
|
||||||
|
assert.equal(shadowRoot.slotAssignment, 'manual');
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
<svelte:options
|
||||||
|
customElement={{
|
||||||
|
tag: 'custom-element',
|
||||||
|
shadow: {
|
||||||
|
mode: 'open',
|
||||||
|
clonable: true,
|
||||||
|
delegatesFocus: true,
|
||||||
|
serializable: true,
|
||||||
|
slotAssignment: 'manual',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h1>Hello world!</h1>
|
||||||
Loading…
Reference in new issue