Skip to content
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
4 changes: 0 additions & 4 deletions modules/ui/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ <h1 class="main-heading">Testrun</h1>
<div class="tips-container">
<app-help-tip
*ngIf="hasConnectionSettings === false"
[class.closed-tip]="isClosedTip"
[data]="HelpTips.step1"
[target]="settingTipTarget"
(onCLoseTip)="onCLoseTip($event)"
Expand All @@ -246,7 +245,6 @@ <h1 class="main-heading">Testrun</h1>
(!!calloutState.get('outdated_devices_callout') &&
isAllDevicesOutdated))
"
[class.closed-tip]="isClosedTip"
[data]="HelpTips.step2"
[target]="deviceTipTarget"
(onCLoseTip)="onCLoseTip($event)"
Expand All @@ -261,7 +259,6 @@ <h1 class="main-heading">Testrun</h1>
!reports.length &&
!isAllDevicesOutdated
"
[class.closed-tip]="isClosedTip"
[data]="HelpTips.step3"
[target]="testingTipTarget"
(onCLoseTip)="onCLoseTip($event)"
Expand All @@ -274,7 +271,6 @@ <h1 class="main-heading">Testrun</h1>
hasRiskProfiles === false &&
systemStatus === StatusOfTestrun.InProgress
"
[class.closed-tip]="isClosedTip"
[data]="HelpTips.step4"
[target]="riskAssessmentTipTarget"
(onCLoseTip)="onCLoseTip($event)"
Expand Down
28 changes: 28 additions & 0 deletions modules/ui/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,34 @@ describe('AppComponent', () => {
expect(router.url).toBe(Routes.Testing);
}));
});

it('should add "closed-tip" class to the tip on click "close" button on tip', fakeAsync(() => {
const helpTipEl = compiled.querySelector('app-help-tip') as HTMLElement;
const helpTipCloseBtn = compiled.querySelector(
'app-help-tip .close-button'
) as HTMLButtonElement;

helpTipCloseBtn.click();
tick(100);

expect(helpTipEl.classList.contains('closed-tip')).toBeTrue();
}));

it('should remove "closed-tip" class from the tip on click toolbar "help tips" button', fakeAsync(() => {
const helpTipEl = compiled.querySelector('app-help-tip') as HTMLElement;
helpTipEl.classList.add('closed-tip');
const helpTipsBtn = compiled.querySelector(
'.app-toolbar-button-help-tips'
) as HTMLButtonElement;

helpTipsBtn.click();
tick(100);

expect(
mockFocusManagerService.focusFirstElementInContainer
).toHaveBeenCalledWith(helpTipEl);
expect(helpTipEl.classList.contains('closed-tip')).toBeFalse();
}));
});

describe('with devices set and systemStatus data', () => {
Expand Down
6 changes: 5 additions & 1 deletion modules/ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export class AppComponent implements AfterViewInit {
private cdr = inject(ChangeDetectorRef);
appStore = inject(AppStore);
private renderer = inject(Renderer2);
private el = inject(ElementRef);

public readonly CalloutType = CalloutType;
public readonly StatusOfTestrun = StatusOfTestrun;
Expand Down Expand Up @@ -298,11 +299,14 @@ export class AppComponent implements AfterViewInit {
const helpTipButton = window.document.querySelector(
'.app-toolbar-button-help-tips'
) as HTMLButtonElement;
const helpTipEl = window.document.querySelector('app-help-tip');
const helpTipEl = this.el.nativeElement.querySelector('app-help-tip');

timer(100).subscribe(() => {
if (isClosed) {
this.renderer.addClass(helpTipEl, 'closed-tip');
helpTipButton.focus();
} else {
this.renderer.removeClass(helpTipEl, 'closed-tip');
this.focusManagerService.focusFirstElementInContainer(helpTipEl);
}
});
Expand Down