diff --git a/packages/ui-library/src/components/form-caption-group/index.test.ts b/packages/ui-library/src/components/form-caption-group/index.test.ts index c5794928c..4ac8484cb 100644 --- a/packages/ui-library/src/components/form-caption-group/index.test.ts +++ b/packages/ui-library/src/components/form-caption-group/index.test.ts @@ -4,7 +4,7 @@ import { BlrFormCaptionGroupRenderFunction } from './renderFunction'; import { BlrFormCaptionGroupType } from './index'; import { fixture, expect } from '@open-wc/testing'; -import { querySelectorDeep } from 'query-selector-shadow-dom'; +import { querySelectorAllDeep } from 'query-selector-shadow-dom'; import { BlrFormCaptionRenderFunction } from '../form-caption/renderFunction'; import { html } from 'lit-html'; @@ -33,8 +33,7 @@ const mixedCaptions = html` ${hintCaption} ${errorCaption} `; describe('blr-form-caption-group', () => { it('is rendering captions inside slot', async () => { const element = await fixture(BlrFormCaptionGroupRenderFunction(sampleParams, mixedCaptions)); - const caption = querySelectorDeep('blr-form-caption', element.getRootNode() as HTMLElement); - - expect(caption).to.exist; + const captions = querySelectorAllDeep('blr-form-caption', element.getRootNode() as HTMLElement); + expect(captions).to.be.lengthOf(captions.length); }); }); diff --git a/packages/ui-library/src/components/select/index.test.ts b/packages/ui-library/src/components/select/index.test.ts index 09ae7c348..392b3ba04 100644 --- a/packages/ui-library/src/components/select/index.test.ts +++ b/packages/ui-library/src/components/select/index.test.ts @@ -83,4 +83,11 @@ describe('blr-select', () => { expect(className).to.contain('sm'); }); + + it('is rendering options inside slot', async () => { + const element = await fixture(BlrSelectRenderFunction({ ...sampleParams, size: 'sm' }, optionsAsChildren)); + const options = querySelectorAllDeep('.blr-select-option', element?.getRootNode() as HTMLElement); + const optionsLength = optionsAsChildren.strings[0].trim().split('').filter(Boolean).length; + expect(options).to.be.lengthOf(optionsLength); + }); }); diff --git a/packages/ui-library/src/components/tab-bar/index.test.ts b/packages/ui-library/src/components/tab-bar/index.test.ts index 6d238200a..090bfc68f 100644 --- a/packages/ui-library/src/components/tab-bar/index.test.ts +++ b/packages/ui-library/src/components/tab-bar/index.test.ts @@ -3,7 +3,7 @@ import '@boiler/ui-library/dist/'; import { BlrTabBarRenderFunction } from './renderFunction'; import { fixture, expect } from '@open-wc/testing'; -import { querySelectorDeep } from 'query-selector-shadow-dom'; +import { querySelectorAllDeep, querySelectorDeep } from 'query-selector-shadow-dom'; import { html } from 'lit-html'; import { BlrTabBarType } from '.'; @@ -45,18 +45,23 @@ describe('blr-tab-bar', () => { it('has a size md by default', async () => { const element = await fixture(BlrTabBarRenderFunction(sampleParams, tabsAsChildren)); - const input = querySelectorDeep('.blr-tab-bar-group', element.getRootNode() as HTMLElement); - const className = input?.className; - + const tabBar = querySelectorDeep('.blr-tab-bar-group', element.getRootNode() as HTMLElement); + const className = tabBar?.className; expect(className).to.contain('md'); }); it('has a size sm when "size" is set to "sm" ', async () => { const element = await fixture(BlrTabBarRenderFunction({ ...sampleParams, size: 'sm' }, tabsAsChildren)); - const input = querySelectorDeep('.blr-tab-bar-group', element.getRootNode() as HTMLElement); - const className = input?.className; - + const tabBar = querySelectorDeep('.blr-tab-bar-group', element.getRootNode() as HTMLElement); + const className = tabBar?.className; expect(className).to.contain('sm'); }); + + it('is rendering tabs inside slot', async () => { + const element = await fixture(BlrTabBarRenderFunction({ ...sampleParams, size: 'sm' }, tabsAsChildren)); + const tabs = querySelectorAllDeep('.nav-item-container', element?.getRootNode() as HTMLElement); + const tabsLength = tabsAsChildren.strings[0].trim().split('

').filter(Boolean).length; + expect(tabs).to.be.lengthOf(tabsLength); + }); }); diff --git a/packages/ui-library/src/components/tooltip/index.test.ts b/packages/ui-library/src/components/tooltip/index.test.ts index bb6f62f98..825c50813 100644 --- a/packages/ui-library/src/components/tooltip/index.test.ts +++ b/packages/ui-library/src/components/tooltip/index.test.ts @@ -12,7 +12,10 @@ const sampleParams: BlrTooltipType = { placement: 'right', }; -const testContent = html`
`; +const testContent = html`
`; describe('blr-tooltip', () => { it('is having a tooltip bubble element', async () => { @@ -22,4 +25,9 @@ describe('blr-tooltip', () => { expect(tooltip).to.exist; }); + + it('is rendering the tooltip child element', async () => { + const element = await fixture(BlrTooltipRenderFunction(sampleParams, testContent)); + expect(element.childNodes[1]).to.exist; + }); });