Skip to content

Commit 643c92b

Browse files
committed
update tests for wizard compoennt
1 parent 0db5c96 commit 643c92b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/wizard/wizard-step-list.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ export function getStepStatus(
4646
if (farthestStepIndex >= index) {
4747
return StepStatusValues.Visited;
4848
}
49-
if (allowSkipTo && canSkip(activeStepIndex + 1, index, steps)) {
50-
return StepStatusValues.Next;
49+
if (allowSkipTo && index > activeStepIndex) {
50+
// Can we skip to this step? (all steps between current and this one are optional)
51+
if (canSkip(activeStepIndex + 1, index, steps)) {
52+
return StepStatusValues.Next;
53+
}
54+
// Immediate next step is also navigable if it's optional
55+
if (index === activeStepIndex + 1 && steps[index]?.isOptional) {
56+
return StepStatusValues.Next;
57+
}
5158
}
5259
return StepStatusValues.Unvisited;
5360
}

0 commit comments

Comments
 (0)