Skip to content

Commit 9f0760c

Browse files
committed
test(headless/tabs): added placeholder test
1 parent b7438d1 commit 9f0760c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

packages/kit-headless/src/components/tabs/tabs.spec.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,35 @@ describe('Tabs', () => {
441441

442442
it(`GIVEN 3 tabs and the focus is on the third,
443443
WHEN triggering the 'end' key
444-
THEN the focus should be on the first tab`, () => {
444+
THEN the focus should be on the last tab`, () => {
445445
cy.mount(<ThreeTabsComponent />);
446446

447447
cy.findByRole('tab', { name: /Tab 1/i }).type('{end}');
448448

449449
cy.findByRole('tab', { name: /Tab 3/i }).should('have.focus');
450450
});
451451

452+
it.skip(
453+
`GIVEN 3 tabs on a long page and the focus is on the third,
454+
WHEN triggering the 'end' key
455+
THEN the focus should be on the last tab and page should not scroll`,
456+
{ scrollBehavior: false },
457+
() => {
458+
cy.mount(
459+
<div>
460+
<div style="height:900px">
461+
<ThreeTabsComponent />
462+
</div>
463+
<div data-testid="scroll-target">Outside</div>
464+
</div>
465+
);
466+
467+
cy.findByRole('tab', { name: /Tab 1/i }).type('{pageDown}');
468+
469+
cy.window().its('scrollY').should('equal', 0);
470+
}
471+
);
472+
452473
it(`GIVEN 3 tabs and the first is disabled and the focus is on the third,
453474
WHEN triggering the 'end' key
454475
THEN the focus should be on the second tab`, () => {

packages/kit-headless/src/components/tabs/tabs.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { KeyCode } from '../../utils/key-code.type';
2525
2626
* POST V1:
2727
* - RTL
28+
* Add automated tests for preventDefault on end, home, pageDown, pageUp
2829
* NOTE: scrolling support? or multiple lines? (probably not for headless but for tailwind / material )
2930
* Add ability to close tabs with an ❌ icon (and keyboard support)
3031

0 commit comments

Comments
 (0)