[ci] format
This commit is contained in:
parent
26bf12ef3c
commit
b0aca3c66a
2 changed files with 9 additions and 6 deletions
|
@ -63,9 +63,9 @@ function* render(Component, attrs, slots) {
|
||||||
const shadowContents = instance.renderShadow({});
|
const shadowContents = instance.renderShadow({});
|
||||||
if (shadowContents !== undefined) {
|
if (shadowContents !== undefined) {
|
||||||
const { mode = 'open', delegatesFocus } = instance.shadowRootOptions ?? {};
|
const { mode = 'open', delegatesFocus } = instance.shadowRootOptions ?? {};
|
||||||
// `delegatesFocus` is intentionally allowed to coerce to boolean to
|
// `delegatesFocus` is intentionally allowed to coerce to boolean to
|
||||||
// match web platform behavior.
|
// match web platform behavior.
|
||||||
const delegatesfocusAttr = delegatesFocus ? ' shadowrootdelegatesfocus' : '';
|
const delegatesfocusAttr = delegatesFocus ? ' shadowrootdelegatesfocus' : '';
|
||||||
yield `<template shadowroot="${mode}" shadowrootmode="${mode}"${delegatesfocusAttr}>`;
|
yield `<template shadowroot="${mode}" shadowrootmode="${mode}"${delegatesfocusAttr}>`;
|
||||||
yield* shadowContents;
|
yield* shadowContents;
|
||||||
yield '</template>';
|
yield '</template>';
|
||||||
|
|
|
@ -86,9 +86,12 @@ describe('renderToStaticMarkup', () => {
|
||||||
|
|
||||||
it('should render DSD attributes based on shadowRootOptions', async () => {
|
it('should render DSD attributes based on shadowRootOptions', async () => {
|
||||||
const tagName = 'lit-component';
|
const tagName = 'lit-component';
|
||||||
customElements.define(tagName, class extends LitElement {
|
customElements.define(
|
||||||
static shadowRootOptions = {...LitElement.shadowRootOptions, delegatesFocus: true};
|
tagName,
|
||||||
});
|
class extends LitElement {
|
||||||
|
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
||||||
|
}
|
||||||
|
);
|
||||||
const render = await renderToStaticMarkup(tagName);
|
const render = await renderToStaticMarkup(tagName);
|
||||||
expect(render).to.deep.equal({
|
expect(render).to.deep.equal({
|
||||||
html: `<${tagName}><template shadowroot=\"open\" shadowrootmode=\"open\" shadowrootdelegatesfocus><!--lit-part--><!--/lit-part--></template></${tagName}>`,
|
html: `<${tagName}><template shadowroot=\"open\" shadowrootmode=\"open\" shadowrootdelegatesfocus><!--lit-part--><!--/lit-part--></template></${tagName}>`,
|
||||||
|
|
Loading…
Reference in a new issue