From e3847d22f4aa32a4a3075c35d430f544df10c738 Mon Sep 17 00:00:00 2001 From: Tommmaso Menga Date: Wed, 24 Jul 2024 10:16:54 +0200 Subject: [PATCH] test(sbb-mini-button): stabilize ssr test --- .../mini-button-group.ssr.spec.ts | 32 +++++++++---------- .../mini-button-group/mini-button-group.ts | 2 +- .../boilerplate/component.ssr.spec.ts | 16 ++++------ 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/elements/mini-button-group/mini-button-group.ssr.spec.ts b/src/elements/mini-button-group/mini-button-group.ssr.spec.ts index 40893d9723..17bb770c3f 100644 --- a/src/elements/mini-button-group/mini-button-group.ssr.spec.ts +++ b/src/elements/mini-button-group/mini-button-group.ssr.spec.ts @@ -8,24 +8,22 @@ import '../button/mini-button.js'; import '../divider/divider.js'; describe(`sbb-mini-button-group ssr`, () => { - it('renders', () => { - let root: SbbMiniButtonGroupElement; + let root: SbbMiniButtonGroupElement; - beforeEach(async () => { - root = await ssrHydratedFixture( - html` - - - - `, - { - modules: ['./mini-button-group.js', '../divider/divider.js', '../button/mini-button.js'], - }, - ); - }); + beforeEach(async () => { + root = await ssrHydratedFixture( + html` + + + + `, + { + modules: ['./mini-button-group.js', '../divider/divider.js', '../button/mini-button.js'], + }, + ); + }); - it('renders', () => { - assert.instanceOf(root, SbbMiniButtonGroupElement); - }); + it('renders', () => { + assert.instanceOf(root, SbbMiniButtonGroupElement); }); }); diff --git a/src/elements/mini-button-group/mini-button-group.ts b/src/elements/mini-button-group/mini-button-group.ts index ff116904b0..a7dbc1a4fd 100644 --- a/src/elements/mini-button-group/mini-button-group.ts +++ b/src/elements/mini-button-group/mini-button-group.ts @@ -37,7 +37,7 @@ export class SbbMiniButtonGroupElement extends SbbNegativeMixin( } private _proxyNegative(): void { - this.querySelectorAll( + this.querySelectorAll?.( 'sbb-divider, sbb-mini-button', ).forEach((e) => (e.negative = this.negative)); } diff --git a/tools/generate-component/boilerplate/component.ssr.spec.ts b/tools/generate-component/boilerplate/component.ssr.spec.ts index 5db08c486e..550292f15a 100644 --- a/tools/generate-component/boilerplate/component.ssr.spec.ts +++ b/tools/generate-component/boilerplate/component.ssr.spec.ts @@ -6,17 +6,15 @@ import { ssrHydratedFixture } from '../core/testing/private.js'; import { __nameUpperCase__ } from './__noPrefixName__.js'; describe(`__name__ ssr`, () => { - it('renders', () => { - let root: __nameUpperCase__; + let root: __nameUpperCase__; - beforeEach(async () => { - root = await ssrHydratedFixture(html`<__name__ my-prop="Label">`, { - modules: ['./__noPrefixName__.js'], - }); + beforeEach(async () => { + root = await ssrHydratedFixture(html`<__name__ my-prop="Label">`, { + modules: ['./__noPrefixName__.js'], }); + }); - it('renders', () => { - assert.instanceOf(root, __nameUpperCase__); - }); + it('renders', () => { + assert.instanceOf(root, __nameUpperCase__); }); });