Skip to content

Commit

Permalink
[AAE-18450] test enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
wojd0 committed Dec 4, 2023
1 parent 829fb2a commit 2a280ed
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();
});
});
Expand Down

0 comments on commit 2a280ed

Please sign in to comment.