[ci] format

This commit is contained in:
natemoo-re 2023-02-24 18:13:07 +00:00 committed by fredkbot
parent 26bf12ef3c
commit b0aca3c66a
2 changed files with 9 additions and 6 deletions

View file

@ -63,9 +63,9 @@ function* render(Component, attrs, slots) {
const shadowContents = instance.renderShadow({});
if (shadowContents !== undefined) {
const { mode = 'open', delegatesFocus } = instance.shadowRootOptions ?? {};
// `delegatesFocus` is intentionally allowed to coerce to boolean to
// match web platform behavior.
const delegatesfocusAttr = delegatesFocus ? ' shadowrootdelegatesfocus' : '';
// `delegatesFocus` is intentionally allowed to coerce to boolean to
// match web platform behavior.
const delegatesfocusAttr = delegatesFocus ? ' shadowrootdelegatesfocus' : '';
yield `<template shadowroot="${mode}" shadowrootmode="${mode}"${delegatesfocusAttr}>`;
yield* shadowContents;
yield '</template>';

View file

@ -86,9 +86,12 @@ describe('renderToStaticMarkup', () => {
it('should render DSD attributes based on shadowRootOptions', async () => {
const tagName = 'lit-component';
customElements.define(tagName, class extends LitElement {
static shadowRootOptions = {...LitElement.shadowRootOptions, delegatesFocus: true};
});
customElements.define(
tagName,
class extends LitElement {
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
}
);
const render = await renderToStaticMarkup(tagName);
expect(render).to.deep.equal({
html: `<${tagName}><template shadowroot=\"open\" shadowrootmode=\"open\" shadowrootdelegatesfocus><!--lit-part--><!--/lit-part--></template></${tagName}>`,