[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({});
|
||||
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>';
|
||||
|
|
|
@ -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}>`,
|
||||
|
|
Loading…
Reference in a new issue