Skip to content

Commit 96c0125

Browse files
authored
Merge pull request #769 from BY00565233/SURF-2077
test(hx-tabset): navigate between tabs
2 parents a59572e + 585a691 commit 96c0125

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/elements/hx-tabset/index.spec.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,5 +363,32 @@ describe('<hx-tabset> component tests', () => {
363363
expect(firstTabCount).to.equal(1);
364364
expect(secoundTabCount).to.equal(2);
365365
});
366+
367+
it(`should be able to navigate between one or more tabs and tab panels`, async () => {
368+
const mockup = `
369+
<hx-tabset>
370+
<hx-tablist>
371+
<hx-tab>First</hx-tab>
372+
<hx-tab>Second</hx-tab>
373+
<hx-tab>Third</hx-tab>
374+
</hx-tablist>
375+
<hx-tabcontent>
376+
<hx-tabpanel>tabpanel-1</hx-tabpanel>
377+
<hx-tabpanel>tabpanel-2</hx-tabpanel>
378+
<hx-tabpanel>tabpanel-3</hx-tabpanel>
379+
</hx-tabcontent>
380+
</hx-tabset>`;
381+
382+
const fragment = /** @type {HXTabsetElement} */ await fixture(mockup);
383+
384+
// Selected tab
385+
const selectedTab = fragment.querySelector('hx-tab:nth-child(2)');
386+
387+
// Data tabpanel
388+
const selectedContent = fragment.querySelector('hx-tabpanel:nth-child(2)');
389+
390+
expect(selectedTab).to.not.be.null;
391+
expect(selectedContent).to.not.be.null;
392+
});
366393
});
367394
});

0 commit comments

Comments
 (0)