-
Notifications
You must be signed in to change notification settings - Fork 15
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
test: 100% coverage of virtual-select component #2500
Conversation
modalController.create.and.resolveTo(selectionModalSpy); | ||
}); | ||
|
||
it('openModal(): should open select modal and set value equals to value returned by modal', fakeAsync(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if openModal():
is added in describe no need to add again inside the it, fix it for all
component.options = [ | ||
{ label: 'Business', value: 'BUSINESS' }, | ||
{ label: 'Economy', value: 'ECONOMY' }, | ||
{ label: '', value: '' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when do we get the label as empty string ?
spyOn(component, 'onChangeCallback'); | ||
}); | ||
|
||
it('should set the value and update the displayValue if any option.value is equal to innerValue', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should set the value and update the displayValue if any "option.value" is equal to innerValue
expect(component.displayValue).toEqual(''); | ||
//@ts-ignore | ||
expect(component.onChangeCallback).toHaveBeenCalledOnceWith(''); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one line space between each it()
//@ts-ignore | ||
expect(component.onChangeCallback).toHaveBeenCalledOnceWith({ travelClass: 'BUSINESS', vendor: 'vendor1' }); | ||
}); | ||
it('should set the value and update the displayValue if none of the conditions holds true', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, fix it for all
]; | ||
}); | ||
|
||
it('should set the value and update the displayValue if any option.value is equal to innerValue', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should set the value and update the displayValue if any "option.value" is equal to innerValue
expect(component.innerValue).toEqual(''); | ||
expect(component.displayValue).toEqual(''); | ||
}); | ||
it('should set the value and update the displayValue if innerValue and defaultLabelProps is defined', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one line gap
@@ -162,6 +163,7 @@ describe('VirtualSelectModalComponent', () => { | |||
//@ts-ignore | |||
expect(component.onChangeCallback).toHaveBeenCalledOnceWith({ travelClass: 'BUSINESS', vendor: 'vendor1' }); | |||
}); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added one line space, don't know why github not showing as resolved
|
Description
🤖 Generated by Copilot at 56b2cf7
Added a shared component and unit tests for virtual select modal. The
VirtualSelectComponent
allows users to select an option from a list using a modal, and integrates with theReactiveFormsModule
. Thevirtual-select.component.spec.ts
file contains the unit tests for the component's methods and properties. Themodal-controller.data.ts
file provides mock data for creating the modal.🤖 Generated by Copilot at 56b2cf7
Walkthrough
🤖 Generated by Copilot at 56b2cf7
VirtualSelectModalComponent
for testingVirtualSelectComponent
(link, link)ModalController
service (link)VirtualSelectComponent
's creation, modal opening, value setting, validation, andControlValueAccessor
methods (link)Clickup
Please add link here
Code Coverage
https://app.clickup.com/t/85zu3u05y
UI Preview
Please add screenshots for UI changes