Skip to content

Commit dd93e20

Browse files
authored
fix: fix onboarding test for error popover (#3452)
1 parent 456ee36 commit dd93e20

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ describe('SpenderOnboardingConnectCardStepComponent', () => {
257257
fixture.detectChanges();
258258
const message = component.generateMessage();
259259
expect(message).toBe(
260-
`We ran into an issue while processing your request for the cards **** 1234, **** 5678 and **** 9012.<br><br>You can cancel and retry connecting the failed card or proceed to the next step.`
260+
`We ran into an issue while processing your request for the cards <span class='text-bold'>**** 1234, **** 5678</span> and <span class='text-bold'>**** 9012</span>.<br><br>You can cancel and retry connecting the failed card or proceed to the next step.`
261261
);
262262
});
263263

@@ -269,7 +269,7 @@ describe('SpenderOnboardingConnectCardStepComponent', () => {
269269
const message = component.generateMessage();
270270

271271
expect(message).toBe(
272-
`We ran into an issue while processing your request for the card **** 1234.<br><br> You can cancel and retry connecting the failed card or proceed to the next step.`
272+
`We ran into an issue while processing your request for the card <span class='text-bold'>**** 1234</span>.<br><br> You can cancel and retry connecting the failed card or proceed to the next step.`
273273
);
274274
});
275275
});
@@ -372,19 +372,19 @@ describe('SpenderOnboardingConnectCardStepComponent', () => {
372372
};
373373
const popoverSpy = jasmine.createSpyObj('popover', ['present', 'onWillDismiss']);
374374
spyOn(component, 'generateMessage').and.returnValue('Error message');
375-
const isStepSkippedSpy = spyOn(component.isStepSkipped, 'emit');
375+
const isStepCompleteSpy = spyOn(component.isStepComplete, 'emit');
376376
popoverSpy.onWillDismiss.and.resolveTo({
377377
data: {
378378
action: 'close',
379379
},
380380
});
381381
popoverController.create.and.resolveTo(popoverSpy);
382-
fixture.detectChanges();
383382
component.showErrorPopover();
383+
tick();
384384

385385
expect(popoverController.create).toHaveBeenCalledOnceWith(enrollmentErrorPopoverData2);
386386
tick();
387-
expect(isStepSkippedSpy).toHaveBeenCalledTimes(1);
387+
expect(isStepCompleteSpy).toHaveBeenCalledTimes(1);
388388
}));
389389

390390
it('should handle cancel action', () => {

src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ export class SpenderOnboardingConnectCardStepComponent implements OnInit, OnChan
132132
} else if (this.cardsList.failedCards.length > 1) {
133133
const allButLast = this.cardsList.failedCards.slice(0, -1).join(', ');
134134
const lastCard = this.cardsList.failedCards[this.cardsList.failedCards.length - 1];
135-
return `We ran into an issue while processing your request for the cards ${allButLast} and ${lastCard}.<br><br>You can cancel and retry connecting the failed card or proceed to the next step.`;
135+
return `We ran into an issue while processing your request for the cards <span class='text-bold'>${allButLast}</span> and <span class='text-bold'>${lastCard}</span>.<br><br>You can cancel and retry connecting the failed card or proceed to the next step.`;
136136
} else {
137-
return `We ran into an issue while processing your request for the card ${this.cardsList.failedCards[0]}.<br><br> You can cancel and retry connecting the failed card or proceed to the next step.`;
137+
return `We ran into an issue while processing your request for the card <span class='text-bold'>${this.cardsList.failedCards[0]}</span>.<br><br> You can cancel and retry connecting the failed card or proceed to the next step.`;
138138
}
139139
}
140140

@@ -167,10 +167,12 @@ export class SpenderOnboardingConnectCardStepComponent implements OnInit, OnChan
167167
action: string;
168168
}>;
169169

170-
if (!data && this.cardsList.successfulCards.length > 0) {
170+
if (this.cardsList.successfulCards.length > 0) {
171+
this.trackingService.eventTrack('Connect Cards Onboarding Step - Completed', {
172+
numberOfCards: this.cardsList.successfulCards.length,
173+
});
171174
this.isStepComplete.emit(true);
172-
}
173-
if (data.action === 'close') {
175+
} else if (data?.action === 'close') {
174176
this.isStepSkipped.emit(true);
175177
}
176178
}

src/global.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ ion-popover.camera-options-popover {
359359
text-align: left !important;
360360
}
361361

362+
.text-bold {
363+
font-weight: 500;
364+
}
365+
362366
.text-right {
363367
text-align: right !important;
364368
}

0 commit comments

Comments
 (0)