Skip to content

Commit 8ba80cd

Browse files
authored
Merge branch 'main' into rename-route-interface
2 parents 73e58bc + 07e9821 commit 8ba80cd

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"d3-transition": "^1.2.0",
5959
"d3-zoom": "^1.8.3",
6060
"graphql": "^15.5.0",
61-
"graphql-tag": "^2.12.4",
61+
"graphql-tag": "^2.12.5",
6262
"iso8601-duration": "^1.3.0",
6363
"lodash-es": "^4.17.21",
6464
"rxjs": "~6.6.7",

projects/components/src/input/input.component.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
:host {
55
::ng-deep {
6+
&.disabled {
7+
background-color: $gray-2;
8+
cursor: not-allowed;
9+
}
10+
611
.border {
712
&.mat-form-field {
813
height: inherit;

projects/components/src/input/input.component.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe('Input Component', () => {
1818

1919
spectator.tick();
2020
expect(spectator.query(MatInput)!.disabled).toBe(true);
21+
expect(spectator.query('mat-form-field')).toHaveClass('disabled');
2122
}));
2223

2324
test('should emit number values for inputs of type number', () => {

projects/components/src/input/input.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { InputAppearance } from './input-appearance';
77
styleUrls: ['./input.component.scss'],
88
changeDetection: ChangeDetectionStrategy.OnPush,
99
template: `
10-
<mat-form-field [ngClass]="this.appearance" floatLabel="never">
10+
<mat-form-field [ngClass]="this.getStyleClasses()" floatLabel="never">
1111
<input
1212
matInput
1313
[type]="this.type"
@@ -66,4 +66,8 @@ export class InputComponent<T extends string | number> implements OnChanges {
6666
return value as T | undefined;
6767
}
6868
}
69+
70+
public getStyleClasses(): string[] {
71+
return [this.appearance, this.disabled ? 'disabled' : ''];
72+
}
6973
}

projects/components/src/menu-dropdown/menu-dropdown.component.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ describe('Menu dropdown Component', () => {
2626

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

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

7977
expect(onClickSpy).not.toHaveBeenCalled();
8078
});
79+
80+
test('should not show the dropdown if no items to show.', () => {
81+
spectator = createHost(`<ht-menu-dropdown label="Settings" icon="${IconType.MoreHorizontal}"></ht-menu-dropdown>`);
82+
83+
expect(spectator.query('ht-popover-trigger')).not.toExist();
84+
});
8185
});

projects/components/src/menu-dropdown/menu-dropdown.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { MenuItemComponent } from './menu-item/menu-item.component';
99
changeDetection: ChangeDetectionStrategy.OnPush,
1010
template: `
1111
<ht-event-blocker event="click" [enabled]="true">
12-
<ht-popover [closeOnClick]="true" [disabled]="this.disabled">
12+
<ht-popover [closeOnClick]="true" [disabled]="this.disabled" *ngIf="this.items?.length > 0">
1313
<ht-popover-trigger>
1414
<div class="trigger-content" [ngClass]="{ disabled: this.disabled, labeled: !!this.label }">
1515
<ht-label *ngIf="this.label" class="trigger-label" [label]="this.label"> </ht-label>

0 commit comments

Comments
 (0)