Skip to content

Commit 2f8da78

Browse files
committed
add new test for wizard
1 parent 16247d4 commit 2f8da78

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/wizard/__integ__/wizard.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@ describe('Wizard keyboard navigation', () => {
9494
});
9595
});
9696

97+
describe('Wizard narrow viewport navigation', () => {
98+
test(
99+
'shows expandable step navigation at narrow viewport',
100+
useBrowser(async browser => {
101+
await browser.url('/#/light/wizard/simple?visualRefresh=true');
102+
const page = new WizardPageObject(browser);
103+
await page.setWindowSize({ width: 320, height: 600 });
104+
await page.waitForVisible(wizardWrapper.findPrimaryButton().toSelector());
105+
106+
// Expandable collapsed steps section should be visible at narrow viewport
107+
const collapsedStepsSelector = wizardWrapper.findByClassName('collapsed-steps').toSelector();
108+
await expect(page.isDisplayed(collapsedStepsSelector)).resolves.toBe(true);
109+
110+
// Sidebar navigation should be hidden
111+
const navigationSelector = wizardWrapper.findByClassName('navigation').toSelector();
112+
await expect(page.isDisplayed(navigationSelector)).resolves.toBe(false);
113+
})
114+
);
115+
});
116+
97117
describe('Wizard scroll to top upon navigation', () => {
98118
test(
99119
'in window',

src/wizard/wizard-step-navigation-expandable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function WizardStepNavigationExpandable({
2727
onSkipToClick,
2828
steps,
2929
}: WizardStepNavigationExpandableProps) {
30-
const [expanded, setExpanded] = useState(true);
30+
const [expanded, setExpanded] = useState(false);
3131
const collapsedStepsLabel = i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length);
3232
const headerAriaLabel = collapsedStepsLabel
3333
? `${collapsedStepsLabel} - ${i18nStrings.navigationAriaLabel ?? 'Steps'}`

0 commit comments

Comments
 (0)