From c1f9e4851e4246018832ceb5ad2d8a1b4945e06b Mon Sep 17 00:00:00 2001 From: Davide Mininni Date: Tue, 27 Aug 2024 10:25:36 +0200 Subject: [PATCH] test: add tests --- .../selection-expansion-panel.spec.ts | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/src/elements/selection-expansion-panel/selection-expansion-panel.spec.ts b/src/elements/selection-expansion-panel/selection-expansion-panel.spec.ts index 90a39fb47a..05081cd10f 100644 --- a/src/elements/selection-expansion-panel/selection-expansion-panel.spec.ts +++ b/src/elements/selection-expansion-panel/selection-expansion-panel.spec.ts @@ -693,4 +693,96 @@ describe(`sbb-selection-expansion-panel`, () => { expect(checkboxes[5]).not.to.have.attribute('disabled'); }); }); + + describe.only('size s', () => { + it('checkbox group', async () => { + const root = await fixture(html` + + + Value 1 +
Inner content
+
+ + Value 2 +
Inner content
+
+
+ `); + await waitForLitRender(root); + expect( + root.querySelector('sbb-selection-expansion-panel#one')!.getAttribute('data-size'), + ).to.be.equal('s'); + expect( + root.querySelector('sbb-selection-expansion-panel#two')!.getAttribute('data-size'), + ).to.be.equal('s'); + root.setAttribute('size', 'm'); + await waitForLitRender(root); + expect( + root.querySelector('sbb-selection-expansion-panel#one')!.getAttribute('data-size'), + ).to.be.equal('m'); + expect( + root.querySelector('sbb-selection-expansion-panel#two')!.getAttribute('data-size'), + ).to.be.equal('m'); + }); + + it('checkbox panel', async () => { + const root = await fixture(html` + + Value +
Inner content
+
+ `); + await waitForLitRender(root); + expect(root.getAttribute('data-size')).to.be.equal('s'); + const panel = root.querySelector('sbb-checkbox-panel')!; + panel.setAttribute('size', 'm'); + await waitForLitRender(root); + expect(root.getAttribute('data-size')).to.be.equal('m'); + }); + + it('radio group', async () => { + const root = await fixture(html` + + + Value 1 +
Inner content
+
+ + Value 2 +
Inner content
+
+
+ `); + await waitForLitRender(root); + expect( + root.querySelector('sbb-selection-expansion-panel#one')!.getAttribute('data-size'), + ).to.be.equal('s'); + expect( + root.querySelector('sbb-selection-expansion-panel#two')!.getAttribute('data-size'), + ).to.be.equal('s'); + root.setAttribute('size', 'm'); + await waitForLitRender(root); + expect( + root.querySelector('sbb-selection-expansion-panel#one')!.getAttribute('data-size'), + ).to.be.equal('m'); + expect( + root.querySelector('sbb-selection-expansion-panel#two')!.getAttribute('data-size'), + ).to.be.equal('m'); + }); + + it('radio panel', async () => { + const root = await fixture(html` + + Value +
Inner content
+
+ `); + await waitForLitRender(root); + expect(root.getAttribute('data-size')).to.be.equal('s'); + const panel = root.querySelector('sbb-radio-button-panel')!; + panel.setAttribute('size', 'm'); + await waitForLitRender(root); + expect(root.getAttribute('data-size')).to.be.equal('m'); + }); + }); });