Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Jun 25, 2024
1 parent f1090ac commit 65752d3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/runtime/vdom/vdom-annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ const parseVNodeAnnotations = (
* we need to insert the vnode annotations on the host element childrens as well
* as on the children from its shadowRoot if there is one
*/
const childNodes = [
...Array.from(node.childNodes),
...Array.from(node.shadowRoot?.childNodes || [])
];
const childNodes = [...Array.from(node.childNodes), ...Array.from(node.shadowRoot?.childNodes || [])];
childNodes.forEach((childNode) => {
const hostRef = getHostRef(childNode);
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
Expand Down
6 changes: 3 additions & 3 deletions test/wdio/declarative-shadow-dom/page-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Component, h, Prop } from '@stencil/core';
})
export class MyOtherComponent {
/**
* Set the number to be displayed.
*/
* Set the number to be displayed.
*/
@Prop() label!: number;

/**
Expand All @@ -19,7 +19,7 @@ export class MyOtherComponent {
render() {
const paginationItemClass: any = {
'pagination-item': true,
'active': this.active,
active: this.active,
};

return (
Expand Down
15 changes: 8 additions & 7 deletions test/wdio/declarative-shadow-dom/page-list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ describe('renderToString', () => {
});

beforeEach(async () => {
const { html } = await renderToString(
`<page-list last-page="5" current-page="1"></page-list>`,
{ serializeShadowRoot: true, prettyHtml: true, fullDocument: false },
);
const { html } = await renderToString(`<page-list last-page="5" current-page="1"></page-list>`, {
serializeShadowRoot: true,
prettyHtml: true,
fullDocument: false,
});
const stage = document.createElement('div');
stage.setAttribute('id', 'stage')
stage.setAttribute('id', 'stage');
stage.setHTMLUnsafe(html);
document.body.appendChild(stage);
});
Expand All @@ -25,15 +26,15 @@ describe('renderToString', () => {
});

it('can hydrate a nested shadow component', async () => {
expect(typeof customElements.get('page-list-item')).toBe('undefined')
expect(typeof customElements.get('page-list-item')).toBe('undefined');

// @ts-expect-error resolved through WDIO
const { defineCustomElements } = await import('/dist/loader/index.js');
defineCustomElements().catch(console.error);

// wait for Stencil to take over and reconcile
await browser.waitUntil(async () => customElements.get('page-list-item'));
expect(typeof customElements.get('page-list-item')).toBe('function')
expect(typeof customElements.get('page-list-item')).toBe('function');
await expect($('page-list')).toHaveText('0\n1\n2\n3\n4');
});
});
3 changes: 1 addition & 2 deletions test/wdio/declarative-shadow-dom/page-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Component, h, Prop, State } from '@stencil/core';
shadow: true,
})
export class PatternlibPagination {

@Prop({ mutable: true }) lastPage: number | null = null;
@State() pages: Array<number> = [];

Expand All @@ -29,7 +28,7 @@ export class PatternlibPagination {
<div>
<div class="pagination">
<div class="pagination-pages pagination-notation">
{this.pages.map(i => (
{this.pages.map((i) => (
<page-list-item label={i}></page-list-item>
))}
</div>
Expand Down

0 comments on commit 65752d3

Please sign in to comment.