mirror of https://github.com/sveltejs/svelte
parent
a30730cf2d
commit
f4294e378d
@ -0,0 +1,19 @@
|
|||||||
|
import { test } from '../../assert';
|
||||||
|
const tick = () => Promise.resolve();
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target, window }) {
|
||||||
|
window.temp_variable = true;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
delete window.temp_variable;
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<svelte:options
|
||||||
|
customElement={{
|
||||||
|
tag: 'custom-element',
|
||||||
|
shadow: () => ({
|
||||||
|
mode: 'open',
|
||||||
|
// This could also be some env variable.
|
||||||
|
clonable: window.temp_variable
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h1>Hello world!</h1>
|
||||||
Loading…
Reference in new issue