Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ describe('Menu dropdown Component', () => {

test('should display trigger content as expected', () => {
spectator = createHost(
`
<ht-menu-dropdown label="Settings" icon="${IconType.MoreHorizontal}">
</ht-menu-dropdown>`
`<ht-menu-dropdown label="Settings" icon="${IconType.MoreHorizontal}"><ht-menu-item label="Option 1"></ht-menu-item></ht-menu-dropdown>`
);

expect(spectator.query('.trigger-content')).toExist();
Expand Down Expand Up @@ -78,4 +76,10 @@ describe('Menu dropdown Component', () => {

expect(onClickSpy).not.toHaveBeenCalled();
});

test('should not show the dropdown if no items to show.', () => {
spectator = createHost(`<ht-menu-dropdown label="Settings" icon="${IconType.MoreHorizontal}"></ht-menu-dropdown>`);

expect(spectator.query('ht-popover-trigger')).not.toExist();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { MenuItemComponent } from './menu-item/menu-item.component';
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<ht-event-blocker event="click" [enabled]="true">
<ht-popover [closeOnClick]="true" [disabled]="this.disabled">
<ht-popover [closeOnClick]="true" [disabled]="this.disabled" *ngIf="this.items?.length > 0">
<ht-popover-trigger>
<div class="trigger-content" [ngClass]="{ disabled: this.disabled, labeled: !!this.label }">
<ht-label *ngIf="this.label" class="trigger-label" [label]="this.label"> </ht-label>
Expand Down