From 2a280eda29036ada39da6693900fec53ad8b8aec Mon Sep 17 00:00:00 2001 From: Wojciech Duda <69160975+wojd0@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:15:05 +0100 Subject: [PATCH] [AAE-18450] test enhancements --- .../radio-buttons-cloud.widget.spec.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/radio-buttons/radio-buttons-cloud.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/radio-buttons/radio-buttons-cloud.widget.spec.ts index cb5ca724787..990d637435f 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/radio-buttons/radio-buttons-cloud.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/radio-buttons/radio-buttons-cloud.widget.spec.ts @@ -151,8 +151,7 @@ describe('RadioButtonsCloudWidgetComponent', () => { }); fixture.detectChanges(); - const selectedOption = await loader.getHarness(MatRadioButtonHarness.with({ checked: true })); - expect(await selectedOption.getLabelText()).toBe('opt-name-2'); + await loader.getHarness(MatRadioButtonHarness.with({ checked: true, label: 'opt-name-2' })); expect(widget.field.isValid).toBe(true); }); @@ -195,7 +194,8 @@ describe('RadioButtonsCloudWidgetComponent', () => { }); it('should change the value of the form when an option is clicked', async () => { - widget.field = new FormFieldModel(new FormModel({}), { + const form = new FormModel({}); + widget.field = new FormFieldModel(form, { id: 'radio-id', name: 'radio-name-label', type: FormFieldTypes.RADIO_BUTTONS, @@ -223,18 +223,20 @@ describe('RadioButtonsCloudWidgetComponent', () => { }); it('should show tooltip', async () => { + const radioButton = await loader.getHarness(MatRadioButtonHarness); + await (await radioButton.host()).hover(); const tooltip = await loader.getHarness(MatTooltipHarness); - await tooltip.show(); expect(await tooltip.getTooltipText()).toBe('my custom tooltip'); }); it('should hide tooltip', async () => { const radioButton = await loader.getHarness(MatRadioButtonHarness); + const tooltipElement = await loader.getHarness(MatTooltipHarness); - await radioButton.focus(); - await radioButton.blur(); + await (await radioButton.host()).hover(); + expect(await tooltipElement.isOpen()).toBeTrue(); - const tooltipElement = await loader.getHarness(MatTooltipHarness); + await (await radioButton.host()).mouseAway(); expect(await tooltipElement.isOpen()).toBeFalse(); }); });