Skip to content

Commit 7d57bff

Browse files
authored
Merge pull request #7180 from microting/copilot/implement-menu-icon-preview
Add icon preview to menu editor dialog
2 parents a5a00e2 + c708624 commit 7d57bff

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

eform-client/src/app/modules/advanced/modules/navigation-menu/components/menu-item/navigation-menu-item-edit/navigation-menu-item-edit.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ <h3 mat-dialog-title>{{'Edit menu entry' | translate}}</h3>
2424
placeholder="e.g., home, settings, dashboard"
2525
>
2626
</mat-form-field>
27+
<div class="d-flex flex-row align-items-center mb-3" *ngIf="item.icon">
28+
<span class="me-2">{{ 'Icon preview' | translate }}:</span>
29+
<mat-icon id="editIconPreview">{{ item.icon }}</mat-icon>
30+
</div>
2731
<div class="d-flex flex-row align-items-center need-wrapper"
2832
*ngIf="item.type === menuItemType.CustomLink || item.type === menuItemType.Link">
2933
<mat-form-field>

eform-client/src/app/modules/advanced/modules/navigation-menu/components/menu-item/navigation-menu-item-edit/navigation-menu-item-edit.component.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,25 @@ describe('NavigationMenuItemEditComponent', () => {
3434
it('should create', () => {
3535
expect(component).toBeTruthy();
3636
});
37+
38+
it('should display icon preview when icon is set', () => {
39+
component.item.icon = 'home';
40+
fixture.detectChanges();
41+
42+
const compiled = fixture.nativeElement;
43+
const iconPreview = compiled.querySelector('#editIconPreview');
44+
45+
expect(iconPreview).toBeTruthy();
46+
expect(iconPreview.textContent.trim()).toBe('home');
47+
});
48+
49+
it('should not display icon preview when icon is not set', () => {
50+
component.item.icon = '';
51+
fixture.detectChanges();
52+
53+
const compiled = fixture.nativeElement;
54+
const iconPreview = compiled.querySelector('#editIconPreview');
55+
56+
expect(iconPreview).toBeFalsy();
57+
});
3758
});

0 commit comments

Comments
 (0)