Keep completed wash fallback visible

This commit is contained in:
Jeppe Bundgaard
2026-06-04 03:01:09 +02:00
parent 58e7c8d6c9
commit 36ccd0c381
3 changed files with 21 additions and 4 deletions
@@ -57,6 +57,7 @@ const isCompletingWash = ref(false);
const isVehicleStepNextLoading = ref(false);
const hasStartFormUserInput = ref(false);
const hasExplicitWashTypeSelection = ref(false);
const hasCompletedGuidedWash = ref(false);
const shouldRestoreServerActiveWash = ref(false);
const isRestoringServerActiveWash = ref(false);
const isSyncingActiveWash = ref(false);
@@ -414,12 +415,14 @@ const { steps, clickableSteps, isNextButtonDisabled, handleConfirmNext, targetSt
currentStep.value = steps.VEHICLE;
const isCompletedWashState = computed(() => hasCompletedGuidedWash.value || currentStep.value === steps.COMPLETED);
const shouldShowWashFlow = computed(
() =>
doesCurrentDepartmentSelectionHaveSelfServeEnabled.value ||
washInProgress.value ||
isCompletingWash.value ||
currentStep.value === steps.COMPLETED
isCompletedWashState.value
);
const shouldShowDisabledDepartmentWarning = computed(
@@ -447,6 +450,7 @@ const resetGuidedWashStep = () => {
const finalizeGuidedWashCompletion = (laneId: number | string | null) => {
markRecentlyCompletedWash(laneId, licensePlateInput.value, getNumericCustomerNumber());
shouldRestoreServerActiveWash.value = false;
hasCompletedGuidedWash.value = true;
resetGuidedWashStep();
currentStep.value = steps.COMPLETED;
};
@@ -1115,6 +1119,7 @@ const applyServerActiveWash = async (activeWash: any) => {
editAnswers.value = false;
washActionError.value = null;
vehicleStepError.value = null;
hasCompletedGuidedWash.value = false;
currentStep.value = shouldRestoreTaskStep ? steps.TASKS : steps.WASH_IN_PROGRESS;
startElapsedTimer();
@@ -1203,6 +1208,7 @@ const clearLocalActiveWashFromServer = () => {
const completedLaneId = washLaneId.value;
markRecentlyCompletedWash(completedLaneId, licensePlateInput.value, getNumericCustomerNumber());
completedDurationMs.value = washStartTime.value ? now.value - washStartTime.value : 0;
hasCompletedGuidedWash.value = true;
currentStep.value = steps.COMPLETED;
washInProgress.value = false;
washLaneId.value = null;
@@ -1399,6 +1405,7 @@ const onVehicleStepNext = async () => {
isVehicleStepNextLoading.value = true;
try {
hasCompletedGuidedWash.value = false;
vehicleStepError.value = null;
licensePlateInput.value = normalizeLicensePlate(licensePlateInput.value);
ensureEffectiveLaneSelection();
@@ -1567,6 +1574,7 @@ const onCloseCompleted = () => {
washActionError.value = null;
answerSyncError.value = null;
hasStartFormUserInput.value = false;
hasCompletedGuidedWash.value = false;
markQuestionReviewRequired();
resetGuidedWashStep();
currentStep.value = steps.VEHICLE;
@@ -1929,7 +1937,7 @@ watch(
<template v-if="shouldShowWashFlow">
<b-steps
v-if="currentStep !== steps.COMPLETED"
v-if="!isCompletedWashState"
:key="currentStep"
v-model="currentStep"
class="self-serve-flow-steps"
@@ -2182,7 +2190,7 @@ watch(
</b-steps>
<div
v-if="currentStep === steps.COMPLETED"
v-if="isCompletedWashState"
class="self-serve-completed-fallback"
data-testid="self-serve-completed-fallback"
>
+5 -1
View File
@@ -66,10 +66,14 @@ describe("MyWashStart.vue production recovery contracts", () => {
it("keeps active and completed washes visible even if department availability changes", () => {
expect(source).toContain("const shouldShowWashFlow = computed(");
expect(source).toContain("const isCompletedWashState = computed(");
expect(source).toContain("const hasCompletedGuidedWash = ref(false);");
expect(source).toContain("washInProgress.value ||");
expect(source).toContain("isCompletingWash.value ||");
expect(source).toContain("currentStep.value === steps.COMPLETED");
expect(source).toContain("isCompletedWashState.value");
expect(source).toContain('<template v-if="shouldShowWashFlow">');
expect(source).toContain('v-if="!isCompletedWashState"');
expect(source).toContain('v-if="isCompletedWashState"');
expect(source).toContain("currentStep.value < steps.COMPLETED");
});
+5
View File
@@ -1278,6 +1278,11 @@ describe("MyWashStart", () => {
expect(wrapper.find('[data-testid="self-serve-nav-close"]').exists()).toBe(true);
});
wrapper.vm.currentStep = 0;
await nextTick();
expect(wrapper.find('[data-testid="completed-step-stub"]').exists()).toBe(true);
await wrapper.get('[data-testid="self-serve-nav-close"]').trigger("click");
await nextTick();