Skip to content

Commit 93f594e

Browse files
committed
fix(program-list): isolate TooltipInfoService and fix signal mutation
DeatilComponent (parent) provided TooltipInfoService and used 'base' key for the analytics button tooltip. ProgramListComponent inherited the same instance via DI, also using 'base' — hovering either opened both. - Add TooltipInfoService to ProgramListComponent.providers for isolation - Replace direct signal mutation (isHintExpertsVisible()['base'] = true) with proper tooltipInfoService.show/hide/isVisible calls - Remove unused isHintExpertsVisible field - Update spec: add TooltipInfoService to overrideComponent remove list, extend mock with isVisible/show/hide
1 parent 3beeba6 commit 93f594e

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

projects/social_platform/src/app/ui/pages/program/detail/list/list.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@
180180
<app-tooltip
181181
color="grey"
182182
iconSize="40"
183-
(show)="isHintExpertsVisible()['base'] = true"
183+
(show)="tooltipInfoService.show('base')"
184184
></app-tooltip>
185185

186-
@if (isHintExpertsVisible()["base"]) {
187-
<div class="tooltip__wrapper" (mouseleave)="isHintExpertsVisible()['base'] = false">
186+
@if (tooltipInfoService.isVisible('base')) {
187+
<div class="tooltip__wrapper" (mouseleave)="tooltipInfoService.hide('base')">
188188
<p class="tooltip__text text-body-10">
189189
Нажмите, чтобы открыть подсказку и узнать больше о процессе оценивания проектов
190190
</p>

projects/social_platform/src/app/ui/pages/program/detail/list/list.component.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ describe("ProgramListComponent", () => {
6161
};
6262

6363
const tooltipInfoServiceSpy = {
64-
isTooltipVisible: signal(false),
64+
isTooltipVisible: signal<Record<string, boolean>>({}),
65+
isVisible: vi.fn().mockReturnValue(false),
66+
show: vi.fn(),
67+
hide: vi.fn(),
6568
toggleTooltip: vi.fn(),
6669
};
6770

@@ -77,6 +80,7 @@ describe("ProgramListComponent", () => {
7780
ProgramProjectsFilterInfoService,
7881
ExportFileInfoService,
7982
SwipeService,
83+
TooltipInfoService,
8084
],
8185
},
8286
add: {

projects/social_platform/src/app/ui/pages/program/detail/list/list.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { LoggerService } from "@core/lib/services/logger/logger.service";
5858
ProgramProjectsFilterInfoService,
5959
ExportFileInfoService,
6060
SwipeService,
61+
TooltipInfoService,
6162
],
6263
changeDetection: ChangeDetectionStrategy.OnPush,
6364
})
@@ -73,7 +74,7 @@ export class ProgramListComponent implements OnInit, AfterViewInit {
7374
private readonly programDetailListUIInfoService = inject(ProgramDetailListUIInfoService);
7475
private readonly programProjectsFilterInfoService = inject(ProgramProjectsFilterInfoService);
7576
private readonly exportFileInfoService = inject(ExportFileInfoService);
76-
private readonly tooltipInfoService = inject(TooltipInfoService);
77+
protected readonly tooltipInfoService = inject(TooltipInfoService);
7778
private readonly swipeService = inject(SwipeService);
7879
private readonly logger = inject(LoggerService);
7980

@@ -90,7 +91,6 @@ export class ProgramListComponent implements OnInit, AfterViewInit {
9091
protected readonly isFilterOpen = this.swipeService.isFilterOpen;
9192
protected readonly ratingOptionsList = tagsFilter;
9293

93-
protected readonly isHintExpertsVisible = this.tooltipInfoService.isTooltipVisible;
9494
protected readonly isHintExpertsModal = this.programDetailListUIInfoService.isHintExpertsModal;
9595

9696
protected appWidth = window.innerWidth;

0 commit comments

Comments
 (0)