Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIH-10158 Error adding panel member to booking #1268

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i
this.displayErrorNoParticipants = false;
this.displayAdd();
this.enableFields();
this.participantDetails = Object.assign({}, participantDetails);
this.participantDetails = { ...participantDetails };

if (participantDetails.is_exist_person) {
this.disableLastFirstNames();
Expand All @@ -216,10 +216,10 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i
party: this.participantDetails.case_role_name,
role: this.participantDetails.hearing_role_name,
title: this.participantDetails.title ?? this.constants.PleaseSelect,
firstName: this.participantDetails.first_name.trim(),
lastName: this.participantDetails.last_name.trim(),
email: this.participantDetails.email.trim() || '',
phone: this.participantDetails.phone.trim() || '',
firstName: this.participantDetails.first_name?.trim(),
shaed-parkar marked this conversation as resolved.
Show resolved Hide resolved
lastName: this.participantDetails.last_name?.trim(),
email: this.participantDetails.email?.trim() || '',
phone: this.participantDetails.phone?.trim() || '',
displayName: this.participantDetails.display_name?.trim() || '',
companyName: this.participantDetails.company?.trim() || '',
companyNameIndividual: this.participantDetails.company?.trim() || '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,19 @@ describe('AddParticipantComponent', () => {
expect(component.displayAddButton).toBeTruthy();
expect(component.displayUpdateButton).toBeFalsy();
});
it('should populate the form fields when values are null', () => {
participant.email = null;
participant.phone = null;
participant.display_name = null;
participant.company = null;
participant.representee = null;
component.getParticipant(participant);
expect(email.value).toBe('');
expect(phone.value).toBe('');
expect(displayName.value).toBe('');
expect(companyName.value).toBe('');
expect(representing.value).toBe('');
});
it('should clear all fields and reset to initial value', () => {
component.getParticipant(participant);
component.clearForm();
Expand Down
Loading