diff --git a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.html b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.html index 61e9854c37e..008c32e4ae1 100644 --- a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.html +++ b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.html @@ -6,7 +6,7 @@ (click)="toggleBookmark()" [icon]="bookmarked() ? 'pi pi-star-fill' : 'pi pi-star'" [loading]="loading()" - [label]="previewMode ? null : ('editpage.toolbar.bookmark.preview' | dm)" + [label]="previewMode ? null : ('editpage.toolbar.bookmark' | dm)" styleClass="p-button-text p-button-sm " [class.p-button-rounded]="previewMode" data-testId="bookmark-button" /> diff --git a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.spec.ts b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.spec.ts index 37cea00539f..d4e5ed3efe6 100644 --- a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.spec.ts +++ b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.spec.ts @@ -21,6 +21,11 @@ import { DotEmaBookmarksComponent } from './dot-ema-bookmarks.component'; import { mockCurrentUser } from '../../../../../shared/mocks'; import { UVEStore } from '../../../../../store/dot-uve.store'; +const mockStore = { + $previewMode: signal(false), + currentUser: signal(mockCurrentUser) +}; + describe('DotEmaBookmarksComponent', () => { let spectator: Spectator; @@ -30,10 +35,7 @@ describe('DotEmaBookmarksComponent', () => { providers: [ DialogService, HttpClient, - mockProvider(UVEStore, { - $previewMode: signal(false), - currentUser: signal(mockCurrentUser) - }), + mockProvider(UVEStore, mockStore), { provide: LoginService, useClass: LoginServiceMock @@ -125,15 +127,21 @@ describe('DotEmaBookmarksComponent', () => { ); }); + it('should have a label when preview mode is false', () => { + spectator.detectChanges(); + const button = spectator.debugElement.query(By.css('[data-testId="bookmark-button"]')); + + expect(button.nativeElement.textContent).toBe('editpage.toolbar.bookmark'); + }); + describe('preview mode', () => { it('should render the bookmark button with new UVE toolbar style when preview mode is true', () => { - const store = spectator.inject(UVEStore, true); - jest.spyOn(store, '$previewMode').mockReturnValue(signal(true)); + mockStore.$previewMode.set(true); spectator.detectChanges(); const button = spectator.debugElement.query(By.css('[data-testId="bookmark-button"]')); - expect(button.componentInstance.textContent).toBe(undefined); + expect(button.nativeElement.textContent).toBe(''); }); }); }); diff --git a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.ts b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.ts index 538a0cbd73a..2701ec8c48b 100644 --- a/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.ts +++ b/core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-toolbar/components/dot-ema-bookmarks/dot-ema-bookmarks.component.ts @@ -1,4 +1,3 @@ -import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, Component, @@ -34,7 +33,6 @@ export class DotEmaBookmarksComponent implements OnInit { @Input() url = ''; private readonly dotFavoritePageService = inject(DotFavoritePageService); - private readonly http = inject(HttpClient); private readonly dialogService = inject(DialogService); private readonly dotMessageService = inject(DotMessageService); private readonly destroyRef = inject(DestroyRef);