@cauca-911/material 21.0.1 → 21.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -24
- package/{src/assets → assets}/i18n/cauca/en-material.json +104 -104
- package/{src/assets → assets}/i18n/cauca/es-material.json +104 -104
- package/{src/assets → assets}/i18n/cauca/fr-material.json +106 -106
- package/fesm2022/cauca-911-material.mjs +4145 -0
- package/fesm2022/cauca-911-material.mjs.map +1 -0
- package/package.json +38 -23
- package/types/cauca-911-material.d.ts +745 -0
- package/.eslintrc.json +0 -79
- package/README_PACKAGE.md +0 -5
- package/cauca-911-material-21.0.0.tgz +0 -0
- package/karma.conf.js +0 -50
- package/ng-package.json +0 -7
- package/src/lib/cauca-material.component.html +0 -1
- package/src/lib/cauca-material.component.spec.ts +0 -29
- package/src/lib/cauca-material.component.ts +0 -12
- package/src/lib/cauca-material.service.spec.ts +0 -16
- package/src/lib/cauca-material.service.ts +0 -7
- package/src/lib/components/button/button.component.html +0 -52
- package/src/lib/components/button/button.component.scss +0 -6
- package/src/lib/components/button/button.component.spec.ts +0 -142
- package/src/lib/components/button/button.component.ts +0 -22
- package/src/lib/components/buttons/base-button.ts +0 -35
- package/src/lib/components/buttons/basic-button/basic-button.component.html +0 -5
- package/src/lib/components/buttons/basic-button/basic-button.component.scss +0 -12
- package/src/lib/components/buttons/basic-button/basic-button.component.spec.ts +0 -106
- package/src/lib/components/buttons/basic-button/basic-button.component.ts +0 -17
- package/src/lib/components/buttons/fab-button/fab-button.component.html +0 -3
- package/src/lib/components/buttons/fab-button/fab-button.component.scss +0 -12
- package/src/lib/components/buttons/fab-button/fab-button.component.spec.ts +0 -82
- package/src/lib/components/buttons/fab-button/fab-button.component.ts +0 -16
- package/src/lib/components/buttons/flat-button/flat-button.component.html +0 -5
- package/src/lib/components/buttons/flat-button/flat-button.component.scss +0 -12
- package/src/lib/components/buttons/flat-button/flat-button.component.spec.ts +0 -106
- package/src/lib/components/buttons/flat-button/flat-button.component.ts +0 -17
- package/src/lib/components/buttons/icon-button/icon-button.component.html +0 -3
- package/src/lib/components/buttons/icon-button/icon-button.component.scss +0 -23
- package/src/lib/components/buttons/icon-button/icon-button.component.spec.ts +0 -38
- package/src/lib/components/buttons/icon-button/icon-button.component.ts +0 -15
- package/src/lib/components/buttons/link-button/link-button.component.html +0 -1
- package/src/lib/components/buttons/link-button/link-button.component.scss +0 -3
- package/src/lib/components/buttons/link-button/link-button.component.spec.ts +0 -97
- package/src/lib/components/buttons/link-button/link-button.component.ts +0 -25
- package/src/lib/components/buttons/menu-item/menu-item.component.html +0 -5
- package/src/lib/components/buttons/menu-item/menu-item.component.scss +0 -6
- package/src/lib/components/buttons/menu-item/menu-item.component.spec.ts +0 -66
- package/src/lib/components/buttons/menu-item/menu-item.component.ts +0 -19
- package/src/lib/components/buttons/raised-button/raised-button.component.html +0 -5
- package/src/lib/components/buttons/raised-button/raised-button.component.scss +0 -12
- package/src/lib/components/buttons/raised-button/raised-button.component.spec.ts +0 -108
- package/src/lib/components/buttons/raised-button/raised-button.component.ts +0 -17
- package/src/lib/components/buttons/refresh-button/refresh-button.component.html +0 -1
- package/src/lib/components/buttons/refresh-button/refresh-button.component.scss +0 -0
- package/src/lib/components/buttons/refresh-button/refresh-button.component.spec.ts +0 -81
- package/src/lib/components/buttons/refresh-button/refresh-button.component.ts +0 -19
- package/src/lib/components/buttons/round-button/round-button.component.html +0 -3
- package/src/lib/components/buttons/round-button/round-button.component.scss +0 -34
- package/src/lib/components/buttons/round-button/round-button.component.spec.ts +0 -26
- package/src/lib/components/buttons/round-button/round-button.component.ts +0 -14
- package/src/lib/components/buttons/stroked-button/stroked-button.component.html +0 -5
- package/src/lib/components/buttons/stroked-button/stroked-button.component.scss +0 -23
- package/src/lib/components/buttons/stroked-button/stroked-button.component.spec.ts +0 -114
- package/src/lib/components/buttons/stroked-button/stroked-button.component.ts +0 -17
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.html +0 -9
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.scss +0 -7
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.spec.ts +0 -68
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.ts +0 -155
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.html +0 -6
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.scss +0 -25
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.spec.ts +0 -23
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.ts +0 -23
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.html +0 -77
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.scss +0 -124
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.spec.ts +0 -96
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.ts +0 -228
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.html +0 -9
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.scss +0 -15
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.spec.ts +0 -105
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.ts +0 -48
- package/src/lib/components/cauca-date-time-picker/models/dialog-date-time-picker-data.ts +0 -29
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.html +0 -14
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.scss +0 -3
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.ts +0 -87
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.html +0 -12
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.scss +0 -3
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.spec.ts +0 -35
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.ts +0 -57
- package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.html +0 -49
- package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.ts +0 -56
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.html +0 -11
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.scss +0 -4
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.spec.ts +0 -39
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.ts +0 -20
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.html +0 -7
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.scss +0 -41
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.spec.ts +0 -24
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.ts +0 -67
- package/src/lib/components/deprecated-components/shared/models/menu-item.ts +0 -11
- package/src/lib/components/deprecated-components/shared/models/simple-dialog-data.ts +0 -5
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.html +0 -10
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.scss +0 -14
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.spec.ts +0 -90
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.ts +0 -41
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.html +0 -11
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.scss +0 -29
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.spec.ts +0 -137
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.ts +0 -47
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.html +0 -17
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.scss +0 -14
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.spec.ts +0 -96
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.ts +0 -40
- package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.spec.ts +0 -7
- package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.ts +0 -5
- package/src/lib/components/dialogs/dialog-styles.css +0 -9
- package/src/lib/components/dialogs/dialog-styles.scss +0 -9
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.html +0 -10
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.scss +0 -10
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.spec.ts +0 -91
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.ts +0 -32
- package/src/lib/components/dialogs/services/dialog.service.spec.ts +0 -82
- package/src/lib/components/dialogs/services/dialog.service.ts +0 -107
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.html +0 -24
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.scss +0 -22
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.spec.ts +0 -126
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.ts +0 -66
- package/src/lib/components/inputs/color-picker/color-picker.component.html +0 -9
- package/src/lib/components/inputs/color-picker/color-picker.component.scss +0 -0
- package/src/lib/components/inputs/color-picker/color-picker.component.spec.ts +0 -29
- package/src/lib/components/inputs/color-picker/color-picker.component.ts +0 -111
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.html +0 -13
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.scss +0 -0
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.spec.ts +0 -80
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.ts +0 -46
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.html +0 -40
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.scss +0 -39
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.spec.ts +0 -135
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.ts +0 -263
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.html +0 -6
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.scss +0 -27
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.spec.ts +0 -90
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.ts +0 -17
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.html +0 -5
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.scss +0 -8
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.spec.ts +0 -98
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.ts +0 -16
- package/src/lib/components/inputs/password/password-input/password-input.component.html +0 -11
- package/src/lib/components/inputs/password/password-input/password-input.component.scss +0 -12
- package/src/lib/components/inputs/password/password-input/password-input.component.spec.ts +0 -141
- package/src/lib/components/inputs/password/password-input/password-input.component.ts +0 -67
- package/src/lib/components/inputs/password/password-selection/password-selection.component.html +0 -15
- package/src/lib/components/inputs/password/password-selection/password-selection.component.scss +0 -32
- package/src/lib/components/inputs/password/password-selection/password-selection.component.spec.ts +0 -138
- package/src/lib/components/inputs/password/password-selection/password-selection.component.ts +0 -101
- package/src/lib/components/inputs/select-with-search/select-with-search.component.html +0 -19
- package/src/lib/components/inputs/select-with-search/select-with-search.component.scss +0 -0
- package/src/lib/components/inputs/select-with-search/select-with-search.component.spec.ts +0 -215
- package/src/lib/components/inputs/select-with-search/select-with-search.component.ts +0 -108
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.html +0 -14
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.scss +0 -48
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.spec.ts +0 -48
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.ts +0 -19
- package/src/lib/components/layout/group-container/group-container.component.html +0 -6
- package/src/lib/components/layout/group-container/group-container.component.scss +0 -22
- package/src/lib/components/layout/group-container/group-container.component.spec.ts +0 -34
- package/src/lib/components/layout/group-container/group-container.component.ts +0 -14
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.html +0 -13
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.scss +0 -27
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.spec.ts +0 -144
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.ts +0 -52
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.html +0 -4
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.scss +0 -10
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.spec.ts +0 -80
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.ts +0 -28
- package/src/lib/components/layout/page-title/page-title.component.html +0 -28
- package/src/lib/components/layout/page-title/page-title.component.scss +0 -40
- package/src/lib/components/layout/page-title/page-title.component.spec.ts +0 -162
- package/src/lib/components/layout/page-title/page-title.component.ts +0 -28
- package/src/lib/components/layout/sections/main-section/main-section.component.html +0 -6
- package/src/lib/components/layout/sections/main-section/main-section.component.scss +0 -27
- package/src/lib/components/layout/sections/main-section/main-section.component.spec.ts +0 -42
- package/src/lib/components/layout/sections/main-section/main-section.component.ts +0 -13
- package/src/lib/components/layout/sections/section-column/section-column.component.html +0 -3
- package/src/lib/components/layout/sections/section-column/section-column.component.scss +0 -18
- package/src/lib/components/layout/sections/section-column/section-column.component.spec.ts +0 -35
- package/src/lib/components/layout/sections/section-column/section-column.component.ts +0 -12
- package/src/lib/components/layout/sections/section-field/section-field.component.html +0 -21
- package/src/lib/components/layout/sections/section-field/section-field.component.scss +0 -44
- package/src/lib/components/layout/sections/section-field/section-field.component.spec.ts +0 -74
- package/src/lib/components/layout/sections/section-field/section-field.component.ts +0 -22
- package/src/lib/components/list-paginator/list-paginator.component.html +0 -16
- package/src/lib/components/list-paginator/list-paginator.component.scss +0 -46
- package/src/lib/components/list-paginator/list-paginator.component.spec.ts +0 -248
- package/src/lib/components/list-paginator/list-paginator.component.ts +0 -81
- package/src/lib/components/misc/loading-error/loading-error.component.html +0 -11
- package/src/lib/components/misc/loading-error/loading-error.component.scss +0 -0
- package/src/lib/components/misc/loading-error/loading-error.component.spec.ts +0 -75
- package/src/lib/components/misc/loading-error/loading-error.component.ts +0 -18
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.html +0 -3
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.scss +0 -0
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.spec.ts +0 -43
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.ts +0 -16
- package/src/lib/components/misc/snack-bar/snack-bar.component.html +0 -16
- package/src/lib/components/misc/snack-bar/snack-bar.component.scss +0 -84
- package/src/lib/components/misc/snack-bar/snack-bar.component.spec.ts +0 -136
- package/src/lib/components/misc/snack-bar/snack-bar.component.ts +0 -39
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.html +0 -11
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.scss +0 -0
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.spec.ts +0 -67
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.ts +0 -15
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.html +0 -11
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.scss +0 -0
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.spec.ts +0 -77
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.ts +0 -17
- package/src/lib/components/presenters/badge/badge.component.html +0 -6
- package/src/lib/components/presenters/badge/badge.component.scss +0 -10
- package/src/lib/components/presenters/badge/badge.component.spec.ts +0 -41
- package/src/lib/components/presenters/badge/badge.component.ts +0 -18
- package/src/lib/components/presenters/icon/icon.component.scss +0 -9
- package/src/lib/components/presenters/icon/icon.component.spec.ts +0 -38
- package/src/lib/components/presenters/icon/icon.component.ts +0 -37
- package/src/lib/core/breadcrumb.service.spec.ts +0 -35
- package/src/lib/core/breadcrumb.service.ts +0 -24
- package/src/lib/core/directives/auto-trim-and-lower.directive.spec.ts +0 -22
- package/src/lib/core/directives/auto-trim-and-lower.directive.ts +0 -19
- package/src/lib/core/directives/form-error/form-error.module.ts +0 -21
- package/src/lib/core/directives/form-error/has-error-root.directive.ts +0 -31
- package/src/lib/core/directives/form-error/has-error.directive.ts +0 -95
- package/src/lib/core/loading-state.service.spec.ts +0 -57
- package/src/lib/core/loading-state.service.ts +0 -44
- package/src/lib/core/models/breadcrumb-location.ts +0 -6
- package/src/lib/core/models/password-validation.ts +0 -20
- package/src/lib/core/validators/password/password-validator.spec.ts +0 -155
- package/src/lib/core/validators/password/password-validator.ts +0 -30
- package/src/lib/provide-cauca-material.ts +0 -10
- package/src/public-api.ts +0 -70
- package/src/test.ts +0 -17
- package/tsconfig.lib.json +0 -18
- package/tsconfig.lib.prod.json +0 -4
- package/tsconfig.spec.json +0 -17
- /package/{src/assets → assets}/images/loading.gif +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FabButtonComponent } from './fab-button.component';
|
|
4
|
-
import { HarnessLoader } from '@angular/cdk/testing';
|
|
5
|
-
import {MatIconHarness} from '@angular/material/icon/testing';
|
|
6
|
-
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
|
7
|
-
import { MatButtonHarness } from '@angular/material/button/testing';
|
|
8
|
-
|
|
9
|
-
describe('FabButtonComponent', () => {
|
|
10
|
-
let component: FabButtonComponent;
|
|
11
|
-
let fixture: ComponentFixture<FabButtonComponent>;
|
|
12
|
-
let loader: HarnessLoader;
|
|
13
|
-
|
|
14
|
-
beforeEach(async () => {
|
|
15
|
-
await TestBed.configureTestingModule({
|
|
16
|
-
imports: [
|
|
17
|
-
FabButtonComponent,
|
|
18
|
-
]
|
|
19
|
-
})
|
|
20
|
-
.compileComponents();
|
|
21
|
-
|
|
22
|
-
fixture = TestBed.createComponent(FabButtonComponent);
|
|
23
|
-
loader = TestbedHarnessEnvironment.loader(fixture);
|
|
24
|
-
component = fixture.componentInstance;
|
|
25
|
-
fixture.detectChanges();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should create', () => {
|
|
29
|
-
expect(component).toBeTruthy();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should display the provided icon', async() => {
|
|
33
|
-
fixture.componentRef.setInput('icon', 'twidelidou');
|
|
34
|
-
|
|
35
|
-
fixture.detectChanges();
|
|
36
|
-
|
|
37
|
-
const icon = await loader.getHarness(MatIconHarness);
|
|
38
|
-
expect(await icon.getName()).toBe(component.icon());
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should disable button when disabled is set', async () => {
|
|
42
|
-
fixture.componentRef.setInput('isDisabled', true);
|
|
43
|
-
|
|
44
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
45
|
-
expect(await button.isDisabled()).toBeTrue();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should enable button when disabled is not set', async () => {
|
|
49
|
-
fixture.componentRef.setInput('isDisabled', false);
|
|
50
|
-
|
|
51
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
52
|
-
expect(await button.isDisabled()).toBeFalse();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should disable button when disabled is not set and show load icon', async () => {
|
|
56
|
-
fixture.componentRef.setInput('isInProgress', true);
|
|
57
|
-
|
|
58
|
-
fixture.detectChanges();
|
|
59
|
-
|
|
60
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
61
|
-
const icon = await button.getHarness(MatIconHarness);
|
|
62
|
-
expect(await button.isDisabled()).toBeTrue();
|
|
63
|
-
expect(await icon.getName()).toBe('update');
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('should not show any icon when not set', async () => {
|
|
67
|
-
fixture.componentRef.setInput('icon', null);
|
|
68
|
-
|
|
69
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
70
|
-
const icon = await button.getHarnessOrNull(MatIconHarness);
|
|
71
|
-
expect(icon).toBe(null);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('should emit buttonClick event when clicked', async () => {
|
|
75
|
-
const clickSpy = spyOn(component.buttonClick, 'emit');
|
|
76
|
-
const button = await loader.getHarness(MatButtonHarness);
|
|
77
|
-
|
|
78
|
-
await button.click();
|
|
79
|
-
|
|
80
|
-
expect(clickSpy).toHaveBeenCalled();
|
|
81
|
-
});
|
|
82
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, computed } from '@angular/core';
|
|
2
|
-
import { MatButtonModule, } from '@angular/material/button';
|
|
3
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
4
|
-
import { BaseButtonWithLabel } from '../base-button';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'cauca-fab-button',
|
|
8
|
-
standalone: true,
|
|
9
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
-
imports: [MatButtonModule, MatIconModule],
|
|
11
|
-
templateUrl: './fab-button.component.html',
|
|
12
|
-
styleUrl: './fab-button.component.scss',
|
|
13
|
-
})
|
|
14
|
-
export class FabButtonComponent extends BaseButtonWithLabel {
|
|
15
|
-
public iconColor = computed(() => this.color() === 'primary' ? 'white' : undefined);
|
|
16
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<button mat-flat-button [ngClass]="small() ? 'small-button' : ''" [color]="color()" onclick="this.blur()" [disabled]="buttonDisabled()" (click)="buttonClick.emit();">
|
|
2
|
-
@if(showIcon() && iconAlignment() === 'left') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
3
|
-
@if (translateLabel()) {{{label()|translate}}} @else {{{label()}}}
|
|
4
|
-
@if(showIcon() && iconAlignment() === 'right') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
5
|
-
</button>
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FlatButtonComponent } from './flat-button.component';
|
|
4
|
-
import { MatIconHarness } from '@angular/material/icon/testing';
|
|
5
|
-
import { MatButtonHarness } from '@angular/material/button/testing';
|
|
6
|
-
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
|
7
|
-
import { HarnessLoader } from '@angular/cdk/testing';
|
|
8
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
9
|
-
import { MockPipe } from 'ng-mocks';
|
|
10
|
-
|
|
11
|
-
describe('FlatButtonComponent', () => {
|
|
12
|
-
let component: FlatButtonComponent;
|
|
13
|
-
let fixture: ComponentFixture<FlatButtonComponent>;
|
|
14
|
-
let loader: HarnessLoader;
|
|
15
|
-
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
await TestBed.configureTestingModule({
|
|
18
|
-
imports: [
|
|
19
|
-
FlatButtonComponent,
|
|
20
|
-
],
|
|
21
|
-
declarations: [MockPipe(TranslatePipe, key => key)]
|
|
22
|
-
})
|
|
23
|
-
.compileComponents();
|
|
24
|
-
|
|
25
|
-
fixture = TestBed.createComponent(FlatButtonComponent);
|
|
26
|
-
loader = TestbedHarnessEnvironment.loader(fixture);
|
|
27
|
-
component = fixture.componentInstance;
|
|
28
|
-
fixture.detectChanges();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should create', () => {
|
|
32
|
-
expect(component).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should display the provided icon', async() => {
|
|
36
|
-
fixture.componentRef.setInput('icon', 'twidelidou');
|
|
37
|
-
|
|
38
|
-
fixture.detectChanges();
|
|
39
|
-
|
|
40
|
-
const icon = await loader.getHarness(MatIconHarness);
|
|
41
|
-
expect(await icon.getName()).toBe(component.icon());
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should display the label', async () => {
|
|
45
|
-
fixture.componentRef.setInput('label', 'twidelidou');
|
|
46
|
-
|
|
47
|
-
fixture.detectChanges();
|
|
48
|
-
|
|
49
|
-
const button = await loader.getHarness(MatButtonHarness);
|
|
50
|
-
expect(await button.getText()).toContain(component.label());
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should disable button when disabled is set', async () => {
|
|
54
|
-
fixture.componentRef.setInput('isDisabled', true);
|
|
55
|
-
|
|
56
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
57
|
-
expect(await button.isDisabled()).toBeTrue();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should enable button when disabled is not set', async () => {
|
|
61
|
-
fixture.componentRef.setInput('isDisabled', false);
|
|
62
|
-
|
|
63
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
64
|
-
expect(await button.isDisabled()).toBeFalse();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should disable button when disabled is not set and show load icon', async () => {
|
|
68
|
-
fixture.componentRef.setInput('isInProgress', true);
|
|
69
|
-
|
|
70
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
71
|
-
const icon = await button.getHarness(MatIconHarness);
|
|
72
|
-
expect(await button.isDisabled()).toBeTrue();
|
|
73
|
-
expect(await icon.getName()).toBe('update');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('should not show any icon when not set', async () => {
|
|
77
|
-
fixture.componentRef.setInput('icon', null);
|
|
78
|
-
|
|
79
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
80
|
-
const icon = await button.getHarnessOrNull(MatIconHarness);
|
|
81
|
-
expect(icon).toBe(null);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should emit buttonClick event when clicked', async () => {
|
|
85
|
-
const clickSpy = spyOn(component.buttonClick, 'emit');
|
|
86
|
-
const button = await loader.getHarness(MatButtonHarness);
|
|
87
|
-
|
|
88
|
-
await button.click();
|
|
89
|
-
|
|
90
|
-
expect(clickSpy).toHaveBeenCalled();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should add small-button class when small is set', () => {
|
|
94
|
-
fixture.componentRef.setInput('small', false);
|
|
95
|
-
|
|
96
|
-
fixture.detectChanges();
|
|
97
|
-
|
|
98
|
-
expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
|
|
99
|
-
|
|
100
|
-
fixture.componentRef.setInput('small', true);
|
|
101
|
-
|
|
102
|
-
fixture.detectChanges();
|
|
103
|
-
|
|
104
|
-
expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
|
|
105
|
-
});
|
|
106
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NgClass } from '@angular/common';
|
|
2
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { MatButton } from '@angular/material/button';
|
|
4
|
-
import { MatIcon } from '@angular/material/icon';
|
|
5
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
6
|
-
import { BaseButtonWithLabel } from '../base-button';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'cauca-flat-button',
|
|
10
|
-
standalone: true,
|
|
11
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
-
imports: [MatIcon, MatButton, TranslateModule, NgClass],
|
|
13
|
-
templateUrl: './flat-button.component.html',
|
|
14
|
-
styleUrl: './flat-button.component.scss'
|
|
15
|
-
})
|
|
16
|
-
export class FlatButtonComponent extends BaseButtonWithLabel {
|
|
17
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<button (mouseenter)="onMouseEnter()" (mouseleave)="onMouseLeave()" mat-icon-button onclick="this.blur()" (click)="buttonClick.emit();" [disabled]="buttonDisabled()">
|
|
2
|
-
<mat-icon [style.color]="iconColor()" [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon>
|
|
3
|
-
</button>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: flex;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.mdc-button.mat-white,
|
|
6
|
-
.mat-stroked-button.mat-white {
|
|
7
|
-
color: white;
|
|
8
|
-
border-color: white;
|
|
9
|
-
}
|
|
10
|
-
.mdc-button.mat-white:hover,
|
|
11
|
-
.mat-mdc-outlined-button.mat-white:hover {
|
|
12
|
-
background-color: transparent;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
mat-icon {
|
|
16
|
-
color: #006496;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.mat-mdc-button-disabled {
|
|
20
|
-
.mat-icon {
|
|
21
|
-
color: rgba(18, 16, 20, 0.38);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { IconButtonComponent } from './icon-button.component';
|
|
4
|
-
import { HarnessLoader } from '@angular/cdk/testing';
|
|
5
|
-
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
|
6
|
-
import { MatIconHarness } from '@angular/material/icon/testing';
|
|
7
|
-
|
|
8
|
-
describe('IconButtonComponent', () => {
|
|
9
|
-
let component: IconButtonComponent;
|
|
10
|
-
let fixture: ComponentFixture<IconButtonComponent>;
|
|
11
|
-
let loader: HarnessLoader;
|
|
12
|
-
|
|
13
|
-
beforeEach(async () => {
|
|
14
|
-
await TestBed.configureTestingModule({
|
|
15
|
-
imports: [IconButtonComponent]
|
|
16
|
-
})
|
|
17
|
-
.compileComponents();
|
|
18
|
-
|
|
19
|
-
fixture = TestBed.createComponent(IconButtonComponent);
|
|
20
|
-
loader = TestbedHarnessEnvironment.loader(fixture);
|
|
21
|
-
component = fixture.componentInstance;
|
|
22
|
-
fixture.detectChanges();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should create', () => {
|
|
26
|
-
expect(component).toBeTruthy();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should display the provided icon', async() => {
|
|
30
|
-
fixture.componentRef.setInput('icon', 'twidelidou');
|
|
31
|
-
|
|
32
|
-
fixture.detectChanges();
|
|
33
|
-
|
|
34
|
-
const icon = await loader.getHarness(MatIconHarness);
|
|
35
|
-
expect(await icon.getName()).toBe(component.icon());
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
-
import { MatIconButton } from '@angular/material/button';
|
|
3
|
-
import { MatIcon } from '@angular/material/icon';
|
|
4
|
-
import { BaseButton } from '../base-button';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'cauca-icon-button',
|
|
8
|
-
standalone: true,
|
|
9
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
-
imports: [MatIconButton, MatIcon],
|
|
11
|
-
templateUrl: './icon-button.component.html',
|
|
12
|
-
styleUrl: './icon-button.component.scss'
|
|
13
|
-
})
|
|
14
|
-
export class IconButtonComponent extends BaseButton {
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<cauca-button class="link-button" icon="link" type="stroked" color="primary" (buttonClick)="copyLink()" [label]="'copyLink'|translate" />
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { Clipboard } from '@angular/cdk/clipboard';
|
|
3
|
-
import { MockComponents, MockPipe, ngMocks } from 'ng-mocks';
|
|
4
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
5
|
-
|
|
6
|
-
import { LinkButtonComponent } from './link-button.component';
|
|
7
|
-
import { ButtonComponent } from '../../button/button.component';
|
|
8
|
-
|
|
9
|
-
describe('LinkButtonComponent', () => {
|
|
10
|
-
let component: LinkButtonComponent;
|
|
11
|
-
let fixture: ComponentFixture<LinkButtonComponent>;
|
|
12
|
-
let clipboardSpy: jasmine.SpyObj<Clipboard>;
|
|
13
|
-
|
|
14
|
-
beforeEach(async () => {
|
|
15
|
-
const clipboard = jasmine.createSpyObj('Clipboard', ['copy']);
|
|
16
|
-
|
|
17
|
-
await TestBed.configureTestingModule({
|
|
18
|
-
imports: [
|
|
19
|
-
LinkButtonComponent,
|
|
20
|
-
...MockComponents(ButtonComponent),
|
|
21
|
-
MockPipe(TranslatePipe, value => value)
|
|
22
|
-
],
|
|
23
|
-
providers: [
|
|
24
|
-
{ provide: Clipboard, useValue: clipboard }
|
|
25
|
-
]
|
|
26
|
-
}).compileComponents();
|
|
27
|
-
|
|
28
|
-
fixture = TestBed.createComponent(LinkButtonComponent);
|
|
29
|
-
component = fixture.componentInstance;
|
|
30
|
-
clipboardSpy = TestBed.inject(Clipboard) as jasmine.SpyObj<Clipboard>;
|
|
31
|
-
fixture.detectChanges();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should create', () => {
|
|
35
|
-
expect(component).toBeTruthy();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('should render cauca-button with correct properties', () => {
|
|
39
|
-
const buttonElement = ngMocks.find(fixture.debugElement, ButtonComponent);
|
|
40
|
-
const buttonComponent = buttonElement.componentInstance; expect(buttonComponent.icon).toBe('link');
|
|
41
|
-
expect(buttonComponent.type).toBe('stroked');
|
|
42
|
-
expect(buttonComponent.color).toBe('primary');
|
|
43
|
-
expect(buttonComponent.label).toBe('copyLink');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should have link-button class', () => {
|
|
47
|
-
const buttonElement = ngMocks.find(fixture.debugElement, 'cauca-button');
|
|
48
|
-
|
|
49
|
-
expect(buttonElement.nativeElement.classList).toContain('link-button');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe('copyLink', () => {
|
|
53
|
-
it('should copy correct link when segments are provided', () => {
|
|
54
|
-
fixture.componentRef.setInput('segments', ['path1', 'path2', 'path3']);
|
|
55
|
-
|
|
56
|
-
component.copyLink();
|
|
57
|
-
|
|
58
|
-
const expectedUrl = `${location.origin}/path1/path2/path3`;
|
|
59
|
-
expect(clipboardSpy.copy).toHaveBeenCalledWith(expectedUrl);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('should copy origin only when empty segments array is provided', () => {
|
|
63
|
-
fixture.componentRef.setInput('segments', []);
|
|
64
|
-
|
|
65
|
-
component.copyLink();
|
|
66
|
-
|
|
67
|
-
expect(clipboardSpy.copy).toHaveBeenCalledWith(location.origin);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should copy link with single segment', () => {
|
|
71
|
-
fixture.componentRef.setInput('segments', ['single-path']);
|
|
72
|
-
|
|
73
|
-
component.copyLink();
|
|
74
|
-
|
|
75
|
-
const expectedUrl = `${location.origin}/single-path`;
|
|
76
|
-
expect(clipboardSpy.copy).toHaveBeenCalledWith(expectedUrl);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('should handle segments with special characters', () => {
|
|
80
|
-
fixture.componentRef.setInput('segments', ['path-with-dash', 'path_with_underscore', 'path123']);
|
|
81
|
-
|
|
82
|
-
component.copyLink();
|
|
83
|
-
|
|
84
|
-
const expectedUrl = `${location.origin}/path-with-dash/path_with_underscore/path123`;
|
|
85
|
-
expect(clipboardSpy.copy).toHaveBeenCalledWith(expectedUrl);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('should call copyLink when button is clicked', () => {
|
|
90
|
-
spyOn(component, 'copyLink');
|
|
91
|
-
const buttonElement = ngMocks.find(fixture.debugElement, ButtonComponent);
|
|
92
|
-
|
|
93
|
-
buttonElement.componentInstance.buttonClick.emit();
|
|
94
|
-
|
|
95
|
-
expect(component.copyLink).toHaveBeenCalled();
|
|
96
|
-
});
|
|
97
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
-
import { Clipboard } from '@angular/cdk/clipboard';
|
|
3
|
-
import { ButtonComponent } from '../../button/button.component';
|
|
4
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'cauca-link-button',
|
|
9
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
-
templateUrl: './link-button.component.html',
|
|
11
|
-
styleUrls: ['./link-button.component.scss'],
|
|
12
|
-
imports: [ButtonComponent, TranslatePipe]
|
|
13
|
-
})
|
|
14
|
-
export class LinkButtonComponent {
|
|
15
|
-
public readonly segments = input<string[]>();
|
|
16
|
-
|
|
17
|
-
public constructor(
|
|
18
|
-
private readonly clipboard: Clipboard,
|
|
19
|
-
) {}
|
|
20
|
-
|
|
21
|
-
public copyLink(): void {
|
|
22
|
-
const link = location.origin + this.segments().map((segment: string) => `/${segment}`).join('');
|
|
23
|
-
this.clipboard.copy(link);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<button (mouseenter)="onMouseEnter()" (mouseleave)="onMouseLeave()" mat-menu-item [ngClass]="small() ? 'small-button' : ''" class="change-password-menu-item" [matMenuTriggerFor]="trigger()" [disabled]="buttonDisabled()" (click)="buttonClick.emit()">
|
|
2
|
-
@if(showIcon() && iconAlignment() === 'left') { <mat-icon [style.color]="iconColor()" [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
3
|
-
@if (translateLabel()) {{{label()|translate}}} @else {{{label()}}}
|
|
4
|
-
@if(showIcon() && iconAlignment() === 'right') { <mat-icon [style.color]="iconColor()" [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
5
|
-
</button>
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MenuItemComponent } from './menu-item.component';
|
|
4
|
-
import { HarnessLoader } from '@angular/cdk/testing';
|
|
5
|
-
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
|
6
|
-
import { MatIconHarness } from '@angular/material/icon/testing';
|
|
7
|
-
import { MatMenuItemHarness } from '@angular/material/menu/testing';
|
|
8
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
9
|
-
import { MockPipe } from 'ng-mocks';
|
|
10
|
-
|
|
11
|
-
describe('MenuItemComponent', () => {
|
|
12
|
-
let component: MenuItemComponent;
|
|
13
|
-
let fixture: ComponentFixture<MenuItemComponent>;
|
|
14
|
-
let loader: HarnessLoader;
|
|
15
|
-
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
await TestBed.configureTestingModule({
|
|
18
|
-
imports: [
|
|
19
|
-
MenuItemComponent,
|
|
20
|
-
],
|
|
21
|
-
declarations: [MockPipe(TranslatePipe, key => key)]
|
|
22
|
-
})
|
|
23
|
-
.compileComponents();
|
|
24
|
-
|
|
25
|
-
fixture = TestBed.createComponent(MenuItemComponent);
|
|
26
|
-
loader = TestbedHarnessEnvironment.loader(fixture);
|
|
27
|
-
component = fixture.componentInstance;
|
|
28
|
-
fixture.detectChanges();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should create', () => {
|
|
32
|
-
expect(component).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should display the provided icon', async() => {
|
|
36
|
-
fixture.componentRef.setInput('icon', 'twidelidou');
|
|
37
|
-
|
|
38
|
-
fixture.detectChanges();
|
|
39
|
-
|
|
40
|
-
const icon = await loader.getHarness(MatIconHarness);
|
|
41
|
-
expect(await icon.getName()).toBe(component.icon());
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should display the label', async () => {
|
|
45
|
-
fixture.componentRef.setInput('label', 'twidelidou');
|
|
46
|
-
|
|
47
|
-
fixture.detectChanges();
|
|
48
|
-
|
|
49
|
-
const button = await loader.getHarness(MatMenuItemHarness);
|
|
50
|
-
expect(await button.getText()).toContain(component.label());
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should add small-button class when small is set', () => {
|
|
54
|
-
fixture.componentRef.setInput('small', false);
|
|
55
|
-
|
|
56
|
-
fixture.detectChanges();
|
|
57
|
-
|
|
58
|
-
expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
|
|
59
|
-
|
|
60
|
-
fixture.componentRef.setInput('small', true);
|
|
61
|
-
|
|
62
|
-
fixture.detectChanges();
|
|
63
|
-
|
|
64
|
-
expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, InputSignal, input, } from '@angular/core';
|
|
2
|
-
import { MatIcon } from '@angular/material/icon';
|
|
3
|
-
import { MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
|
4
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
-
import { BaseButtonWithLabel } from '../base-button';
|
|
6
|
-
import { NgClass } from '@angular/common';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'cauca-menu-item',
|
|
10
|
-
standalone: true,
|
|
11
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
-
imports: [MatMenuItem, TranslateModule, MatIcon, MatMenuTrigger, NgClass],
|
|
13
|
-
templateUrl: './menu-item.component.html',
|
|
14
|
-
styleUrl: './menu-item.component.scss',
|
|
15
|
-
})
|
|
16
|
-
export class MenuItemComponent extends BaseButtonWithLabel {
|
|
17
|
-
public translateLabel: InputSignal<boolean> = input(false);
|
|
18
|
-
public trigger: InputSignal<any> = input();
|
|
19
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<button mat-raised-button [ngClass]="small() ? 'small-button' : ''" [color]="color()" onclick="this.blur()" [disabled]="buttonDisabled()" (click)="buttonClick.emit()">
|
|
2
|
-
@if (showIcon() && iconAlignment() === 'left') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
3
|
-
@if (translateLabel()) {{{label()|translate}}} @else {{{label()}}}
|
|
4
|
-
@if (showIcon() && iconAlignment() === 'right') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
5
|
-
</button>
|