@cauca-911/material 21.0.1-beta.5 → 21.0.2
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 +4137 -0
- package/fesm2022/cauca-911-material.mjs.map +1 -0
- package/package.json +17 -2
- package/types/cauca-911-material.d.ts +745 -0
- package/.eslintrc.json +0 -79
- package/README_PACKAGE.md +0 -5
- 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 -35
- 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
package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.spec.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MenuExpandablePanelComponent } from './menu-expandable-panel.component';
|
|
4
|
-
import { MockComponent, MockModule, MockPipe, ngMocks } from 'ng-mocks';
|
|
5
|
-
import { MatIcon } from '@angular/material/icon';
|
|
6
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
7
|
-
import { By } from '@angular/platform-browser';
|
|
8
|
-
import { Router } from '@angular/router';
|
|
9
|
-
import { MenuExpandablePanelItemComponent } from '../menu-expandable-panel-item/menu-expandable-panel-item.component';
|
|
10
|
-
|
|
11
|
-
describe('MenuExpandablePanelComponent', () => {
|
|
12
|
-
let component: MenuExpandablePanelComponent;
|
|
13
|
-
let fixture: ComponentFixture<MenuExpandablePanelComponent>;
|
|
14
|
-
let router: any;
|
|
15
|
-
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
router = jasmine.createSpyObj('Router', ['navigate']);
|
|
18
|
-
|
|
19
|
-
await TestBed.configureTestingModule({
|
|
20
|
-
imports: [MenuExpandablePanelComponent,
|
|
21
|
-
MockModule(TranslateModule),
|
|
22
|
-
MockComponent(MenuExpandablePanelItemComponent),
|
|
23
|
-
],
|
|
24
|
-
declarations: [
|
|
25
|
-
MockPipe(TranslatePipe, value => value)
|
|
26
|
-
],
|
|
27
|
-
providers: [
|
|
28
|
-
{ provide: Router, useValue: router }
|
|
29
|
-
]
|
|
30
|
-
})
|
|
31
|
-
.compileComponents();
|
|
32
|
-
|
|
33
|
-
fixture = TestBed.createComponent(MenuExpandablePanelComponent);
|
|
34
|
-
fixture.componentRef.setInput('caption', 'someTitle');
|
|
35
|
-
fixture.componentRef.setInput('menuIcon', 'someIcon');
|
|
36
|
-
component = fixture.componentInstance;
|
|
37
|
-
fixture.detectChanges();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should create', () => {
|
|
41
|
-
expect(component).toBeTruthy();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should show expansion icon when show expansion icon is true', () => {
|
|
45
|
-
const icons = ngMocks.findAll(MatIcon);
|
|
46
|
-
const icon = icons[1];
|
|
47
|
-
|
|
48
|
-
expect(icon).toBeTruthy();
|
|
49
|
-
expect(icon.nativeElement.textContent).toBe('arrow_forward_ios');
|
|
50
|
-
expect(icons.length).toBe(2);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should not show expansion icon when show expansion icon is false', () => {
|
|
54
|
-
fixture.componentRef.setInput('showExpansionIcon', false);
|
|
55
|
-
fixture.detectChanges();
|
|
56
|
-
|
|
57
|
-
const icons = ngMocks.findAll(MatIcon);
|
|
58
|
-
const icon = icons[0];
|
|
59
|
-
|
|
60
|
-
expect(icons.length).toBe(1);
|
|
61
|
-
expect(icon.nativeElement.textContent).not.toBe('arrow_forward_ios');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should show menu icon', () => {
|
|
65
|
-
fixture.componentRef.setInput('showExpansionIcon', false);
|
|
66
|
-
fixture.detectChanges();
|
|
67
|
-
|
|
68
|
-
const icons = ngMocks.findAll(MatIcon);
|
|
69
|
-
const icon = icons[0];
|
|
70
|
-
|
|
71
|
-
expect(icons.length).toBe(1);
|
|
72
|
-
expect(icon.nativeElement.textContent).toBe('someIcon');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should show menu title', () => {
|
|
76
|
-
const someTitle = 'A menu title';
|
|
77
|
-
fixture.componentRef.setInput('caption', someTitle);
|
|
78
|
-
|
|
79
|
-
fixture.detectChanges();
|
|
80
|
-
|
|
81
|
-
expect(fixture.debugElement.query(By.css('.subtitle1')).nativeElement.textContent).toBe(someTitle);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should show menu subtitle', () => {
|
|
85
|
-
const someSubtitle = 'A menu subtitle';
|
|
86
|
-
fixture.componentRef.setInput('subCaption', someSubtitle);
|
|
87
|
-
|
|
88
|
-
fixture.detectChanges();
|
|
89
|
-
|
|
90
|
-
expect(fixture.debugElement.query(By.css('.body2')).nativeElement.textContent).toBe(someSubtitle);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should show not menu subtitle when input is empty', () => {
|
|
94
|
-
fixture.componentRef.setInput('subCaption', '');
|
|
95
|
-
|
|
96
|
-
fixture.detectChanges();
|
|
97
|
-
|
|
98
|
-
expect(fixture.debugElement.query(By.css('.body2'))).toBeFalsy();
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should navigate to route when no menu items are present and menu is clicked', () => {
|
|
102
|
-
const route = ['someRoute', 'route'];
|
|
103
|
-
fixture.componentRef.setInput('route', route);
|
|
104
|
-
const section = fixture.debugElement.query(By.css('section'));
|
|
105
|
-
|
|
106
|
-
section.triggerEventHandler('click', null);
|
|
107
|
-
fixture.detectChanges();
|
|
108
|
-
|
|
109
|
-
expect(router.navigate).toHaveBeenCalledWith(route);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('should not show menu items when menu items are present and menu is not open', () => {
|
|
113
|
-
const items = [
|
|
114
|
-
{ icon: 'icon1', text: 'text1', route: ['route1'] },
|
|
115
|
-
{ icon: 'icon2', text: 'text2', route: ['route2'] }
|
|
116
|
-
];
|
|
117
|
-
fixture.componentRef.setInput('items', items);
|
|
118
|
-
|
|
119
|
-
fixture.detectChanges();
|
|
120
|
-
|
|
121
|
-
expect(ngMocks.findAll(MenuExpandablePanelItemComponent).length).toBe(0);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('should show menu items when menu items are present and there is not route when menu is clicked', () => {
|
|
125
|
-
const items = [
|
|
126
|
-
{ icon: 'icon1', title: 'text1', route: ['route1'] },
|
|
127
|
-
{ icon: 'icon2', title: 'text2', route: ['route2'] }
|
|
128
|
-
];
|
|
129
|
-
fixture.componentRef.setInput('items', items);
|
|
130
|
-
|
|
131
|
-
component.handleClick();
|
|
132
|
-
fixture.detectChanges();
|
|
133
|
-
|
|
134
|
-
const item1 = ngMocks.findAll(MenuExpandablePanelItemComponent)[0];
|
|
135
|
-
const item2 = ngMocks.findAll(MenuExpandablePanelItemComponent)[1];
|
|
136
|
-
expect(ngMocks.findAll(MenuExpandablePanelItemComponent).length).toBe(2);
|
|
137
|
-
expect(item1.componentInstance.icon).toBe('icon1');
|
|
138
|
-
expect(item1.componentInstance.caption).toBe('text1');
|
|
139
|
-
expect(item1.componentInstance.route).toEqual(['route1']);
|
|
140
|
-
expect(item2.componentInstance.icon).toBe('icon2');
|
|
141
|
-
expect(item2.componentInstance.caption).toBe('text2');
|
|
142
|
-
expect(item2.componentInstance.route).toEqual(['route2']);
|
|
143
|
-
});
|
|
144
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Component, HostBinding, inject, input, InputSignal, signal, WritableSignal } from '@angular/core';
|
|
2
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
3
|
-
import { Router } from '@angular/router';
|
|
4
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
5
|
-
import { MenuExpandablePanelItemComponent } from '../menu-expandable-panel-item/menu-expandable-panel-item.component';
|
|
6
|
-
import { NgClass } from '@angular/common';
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'cauca-menu-expandable-panel',
|
|
9
|
-
imports: [MatIconModule, TranslatePipe, MenuExpandablePanelItemComponent, NgClass],
|
|
10
|
-
templateUrl: './menu-expandable-panel.component.html',
|
|
11
|
-
styleUrl: './menu-expandable-panel.component.scss',
|
|
12
|
-
})
|
|
13
|
-
export class MenuExpandablePanelComponent {
|
|
14
|
-
public caption: InputSignal<string> = input();
|
|
15
|
-
public isSubItem: InputSignal<boolean> = input(false);
|
|
16
|
-
public subCaption: InputSignal<string> = input();
|
|
17
|
-
public menuIcon: InputSignal<string> = input();
|
|
18
|
-
public showExpansionIcon: InputSignal<boolean> = input(true);
|
|
19
|
-
public addTopBorderRadius: InputSignal<boolean> = input(false);
|
|
20
|
-
public bottomBorder: InputSignal<boolean> = input(false);
|
|
21
|
-
public addBottomBorderRadius: InputSignal<boolean> = input(false);
|
|
22
|
-
public route: InputSignal<string[]> = input([]);
|
|
23
|
-
public items: InputSignal<{ icon: string, title: string, route?: string[], action?: () => void }[]> = input([]);
|
|
24
|
-
|
|
25
|
-
public opened: WritableSignal<boolean> = signal(false);
|
|
26
|
-
|
|
27
|
-
private readonly router = inject(Router);
|
|
28
|
-
|
|
29
|
-
@HostBinding('style.border-top-left-radius') public get topLeftRadius(): string {
|
|
30
|
-
return this.addTopBorderRadius() ? '12px' : '0px';
|
|
31
|
-
}
|
|
32
|
-
@HostBinding('style.border-top-right-radius') public get topRightRadius(): string {
|
|
33
|
-
return this.addTopBorderRadius() ? '12px' : '0px';
|
|
34
|
-
}
|
|
35
|
-
@HostBinding('style.border-bottom-left-radius') public get bottomLeftRadius(): string {
|
|
36
|
-
return this.addBottomBorderRadius() ? '12px' : '0px';
|
|
37
|
-
}
|
|
38
|
-
@HostBinding('style.border-bottom-right-radius') public get bottomRightRadius(): string {
|
|
39
|
-
return this.addBottomBorderRadius() ? '12px' : '0px';
|
|
40
|
-
}
|
|
41
|
-
@HostBinding('class.bottom-border') public get bottomBorderClass(): boolean {
|
|
42
|
-
return this.bottomBorder();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public handleClick(): void {
|
|
46
|
-
if (this.route().length > 0 && this.items().length === 0) {
|
|
47
|
-
this.router.navigate(this.route());
|
|
48
|
-
} else {
|
|
49
|
-
this.opened.set(!this.opened());
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MenuExpandablePanelItemComponent } from './menu-expandable-panel-item.component';
|
|
4
|
-
import { MockModule, MockPipe, ngMocks } from 'ng-mocks';
|
|
5
|
-
import { MatIcon } from '@angular/material/icon';
|
|
6
|
-
import { By } from '@angular/platform-browser';
|
|
7
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
8
|
-
import { Router } from '@angular/router';
|
|
9
|
-
|
|
10
|
-
describe('MenuExpandablePanelItemComponent', () => {
|
|
11
|
-
let component: MenuExpandablePanelItemComponent;
|
|
12
|
-
let fixture: ComponentFixture<MenuExpandablePanelItemComponent>;
|
|
13
|
-
let router: any;
|
|
14
|
-
|
|
15
|
-
beforeEach(async () => {
|
|
16
|
-
router = jasmine.createSpyObj('Router', ['navigate']);
|
|
17
|
-
|
|
18
|
-
await TestBed.configureTestingModule({
|
|
19
|
-
imports: [MenuExpandablePanelItemComponent,
|
|
20
|
-
MockModule(TranslateModule)
|
|
21
|
-
],
|
|
22
|
-
declarations: [
|
|
23
|
-
MockPipe(TranslatePipe, value => value)
|
|
24
|
-
],
|
|
25
|
-
providers: [
|
|
26
|
-
{ provide: Router, useValue: router }
|
|
27
|
-
]
|
|
28
|
-
})
|
|
29
|
-
.compileComponents();
|
|
30
|
-
|
|
31
|
-
fixture = TestBed.createComponent(MenuExpandablePanelItemComponent);
|
|
32
|
-
component = fixture.componentInstance;
|
|
33
|
-
fixture.detectChanges();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should create', () => {
|
|
37
|
-
expect(component).toBeTruthy();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should show menu icon', () => {
|
|
41
|
-
fixture.componentRef.setInput('icon', 'someIcon');
|
|
42
|
-
fixture.detectChanges();
|
|
43
|
-
|
|
44
|
-
const icons = ngMocks.findAll(MatIcon);
|
|
45
|
-
const icon = icons[0];
|
|
46
|
-
|
|
47
|
-
expect(icons.length).toBe(1);
|
|
48
|
-
expect(icon.nativeElement.textContent).toBe('someIcon');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should show title', () => {
|
|
52
|
-
fixture.componentRef.setInput('caption', 'someTitle');
|
|
53
|
-
fixture.detectChanges();
|
|
54
|
-
|
|
55
|
-
const title = fixture.debugElement.query(By.css('.subtitle1'));
|
|
56
|
-
|
|
57
|
-
expect(title.nativeElement.textContent).toBe('someTitle');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should navigate to route when clicking on item', () => {
|
|
61
|
-
fixture.componentRef.setInput('route', ['someRoute']);
|
|
62
|
-
const item = fixture.debugElement.query(By.css('section'));
|
|
63
|
-
|
|
64
|
-
item.triggerEventHandler('click', null);
|
|
65
|
-
fixture.detectChanges();
|
|
66
|
-
|
|
67
|
-
expect(router.navigate).toHaveBeenCalledWith(['someRoute']);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should run action when one is provided', () => {
|
|
71
|
-
const action = jasmine.createSpy();
|
|
72
|
-
fixture.componentRef.setInput('action', action);
|
|
73
|
-
const item = fixture.debugElement.query(By.css('section'));
|
|
74
|
-
|
|
75
|
-
item.triggerEventHandler('click', null);
|
|
76
|
-
fixture.detectChanges();
|
|
77
|
-
|
|
78
|
-
expect(action).toHaveBeenCalledTimes(1);
|
|
79
|
-
});
|
|
80
|
-
});
|
package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Component, inject, input, InputSignal } from '@angular/core';
|
|
2
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
3
|
-
import { Router } from '@angular/router';
|
|
4
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'cauca-menu-expandable-panel-item',
|
|
8
|
-
imports: [MatIconModule, TranslateModule],
|
|
9
|
-
templateUrl: './menu-expandable-panel-item.component.html',
|
|
10
|
-
styleUrl: './menu-expandable-panel-item.component.scss'
|
|
11
|
-
})
|
|
12
|
-
export class MenuExpandablePanelItemComponent {
|
|
13
|
-
public icon: InputSignal<string> = input();
|
|
14
|
-
public caption: InputSignal<string> = input();
|
|
15
|
-
public route: InputSignal<string[]> = input();
|
|
16
|
-
public isSubItem: InputSignal<boolean> = input(false);
|
|
17
|
-
public action: InputSignal<() => void|null> = input(null);
|
|
18
|
-
|
|
19
|
-
private readonly router = inject(Router);
|
|
20
|
-
|
|
21
|
-
public openRoute(): void {
|
|
22
|
-
if (this.action()) {
|
|
23
|
-
this.action()();
|
|
24
|
-
} else {
|
|
25
|
-
this.router.navigate(this.route());
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<div class="title-section">
|
|
2
|
-
|
|
3
|
-
<h4 class="title-label">{{caption() | translate }}</h4>
|
|
4
|
-
|
|
5
|
-
@if (displayBreadcrumb()) {
|
|
6
|
-
<div class="breadcrumb">
|
|
7
|
-
|
|
8
|
-
@if (baseCrumb()) {
|
|
9
|
-
<div class="basecrumb">{{baseCrumb()|translate}}</div>
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@for(location of breadcrumbLocation(); track location) {
|
|
13
|
-
@if (breadcrumbLocation().length > 0 || currentBreadcrumb()) {
|
|
14
|
-
<span>/</span>
|
|
15
|
-
}
|
|
16
|
-
@if (location.link) {
|
|
17
|
-
<a class="basecrumb" [href]="location.link" [routerLink]="location.link">{{location.title| translate }}</a>
|
|
18
|
-
} @else if (location.action) {
|
|
19
|
-
<span class="basecrumb crumb-link" (click)="location.action()">{{ location.translate ? (location.title | translate) : location.title}}</span>
|
|
20
|
-
} @else {
|
|
21
|
-
<span class="basecrumb">{{location.title}}</span>
|
|
22
|
-
}
|
|
23
|
-
@if (!$last || currentBreadcrumb()) {
|
|
24
|
-
<span>/</span>
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@if (currentBreadcrumb()) {
|
|
29
|
-
<span class="breadcrumb-current">{{ mustTranslateBreadcrumb() ? (currentBreadcrumb() | translate) : currentBreadcrumb() }}</span>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
</div>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
</div>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
.title-section {
|
|
2
|
-
display: flex;
|
|
3
|
-
gap: 8px;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
align-items: flex-start;
|
|
6
|
-
align-self: stretch;
|
|
7
|
-
margin-bottom: 24px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.breadcrumb {
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
gap: 8px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
h4 {
|
|
17
|
-
padding: 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
a {
|
|
21
|
-
text-decoration: none;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
a:visited {
|
|
25
|
-
color: inherit;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.basecrumb {
|
|
29
|
-
color: rgba(18, 16, 20, 0.6);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.crumb-link {
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@media (max-width:500px) {
|
|
37
|
-
.title-section {
|
|
38
|
-
padding: 16px;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { PageTitleComponent } from './page-title.component';
|
|
4
|
-
import { MockModule, MockPipe } from 'ng-mocks';
|
|
5
|
-
import { RouterModule } from '@angular/router';
|
|
6
|
-
import { signal } from '@angular/core';
|
|
7
|
-
import { BreadcrumbService } from '../../../core/breadcrumb.service';
|
|
8
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
describe('PageTitleComponent with service', () => {
|
|
12
|
-
let component: PageTitleComponent;
|
|
13
|
-
let fixture: ComponentFixture<PageTitleComponent>;
|
|
14
|
-
let breadcrumbService: any;
|
|
15
|
-
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
breadcrumbService = jasmine.createSpyObj('BreadcrumbService', ['show']);
|
|
18
|
-
breadcrumbService.showBreadcrumb = signal(true);
|
|
19
|
-
breadcrumbService.breadcrumb = signal('twidelidou');
|
|
20
|
-
breadcrumbService.location = signal([{ title: 'test', link: '/test' }]);
|
|
21
|
-
breadcrumbService.translateBreadcrumb = signal(false);
|
|
22
|
-
|
|
23
|
-
await TestBed.configureTestingModule({
|
|
24
|
-
imports: [PageTitleComponent, MockModule(RouterModule)],
|
|
25
|
-
declarations: [MockPipe(TranslatePipe, value => value),],
|
|
26
|
-
providers: [{ provide: BreadcrumbService, useValue: breadcrumbService }]
|
|
27
|
-
}).compileComponents();
|
|
28
|
-
|
|
29
|
-
fixture = TestBed.createComponent(PageTitleComponent);
|
|
30
|
-
component = fixture.componentInstance;
|
|
31
|
-
fixture.detectChanges();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should create', () => {
|
|
35
|
-
expect(component).toBeTruthy();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('should display the title', () => {
|
|
39
|
-
fixture.componentRef.setInput('caption', 'twidelidou');
|
|
40
|
-
|
|
41
|
-
fixture.detectChanges();
|
|
42
|
-
|
|
43
|
-
expect(fixture.nativeElement.querySelector('.title-label').textContent).toContain(component.caption());
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should display the breadcrump when showBreadcrump is true', () => {
|
|
47
|
-
breadcrumbService.showBreadcrumb.set(true);
|
|
48
|
-
|
|
49
|
-
fixture.detectChanges();
|
|
50
|
-
|
|
51
|
-
expect(fixture.nativeElement.querySelector('.breadcrumb').textContent).toContain(breadcrumbService.breadcrumb());
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should contains an anchor for each of the locations', () => {
|
|
55
|
-
fixture.detectChanges();
|
|
56
|
-
|
|
57
|
-
const anchors = fixture.nativeElement.querySelectorAll('a');
|
|
58
|
-
expect(anchors.length).toBe(breadcrumbService.location().length);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('should display the current location', () => {
|
|
62
|
-
breadcrumbService.location.set([{ title: 'test', link: '/test' }, { title: 'test2', link: '/test2' }]);
|
|
63
|
-
|
|
64
|
-
fixture.detectChanges();
|
|
65
|
-
|
|
66
|
-
const anchors = fixture.nativeElement.querySelectorAll('a');
|
|
67
|
-
expect(anchors[0].textContent).toContain(breadcrumbService.location()[0].title);
|
|
68
|
-
expect(anchors[1].textContent).toContain(breadcrumbService.location()[1].title);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should display the current breadcrumb', () => {
|
|
72
|
-
fixture.detectChanges();
|
|
73
|
-
|
|
74
|
-
expect(fixture.nativeElement.querySelector('.breadcrumb').textContent).toContain(breadcrumbService.breadcrumb());
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('PageTitleComponent without service', () => {
|
|
79
|
-
let component: PageTitleComponent;
|
|
80
|
-
let fixture: ComponentFixture<PageTitleComponent>;
|
|
81
|
-
|
|
82
|
-
beforeEach(async () => {
|
|
83
|
-
await TestBed.configureTestingModule({
|
|
84
|
-
imports: [PageTitleComponent, MockModule(RouterModule)],
|
|
85
|
-
declarations: [MockPipe(TranslatePipe, value => value),],
|
|
86
|
-
}).compileComponents();
|
|
87
|
-
|
|
88
|
-
fixture = TestBed.createComponent(PageTitleComponent);
|
|
89
|
-
component = fixture.componentInstance;
|
|
90
|
-
fixture.detectChanges();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should create when used without service', () => {
|
|
94
|
-
expect(component).toBeTruthy();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should display the title when used without service', () => {
|
|
98
|
-
fixture.componentRef.setInput('caption', 'twidelidou');
|
|
99
|
-
|
|
100
|
-
fixture.detectChanges();
|
|
101
|
-
|
|
102
|
-
expect(fixture.nativeElement.querySelector('.title-label').textContent).toContain('twidelidou');
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('should expose value from inputs when not use with service', () => {
|
|
106
|
-
fixture.componentRef.setInput('showBreadcrumb', true);
|
|
107
|
-
fixture.componentRef.setInput('location', [{ title: 'test', link: '/test' }]);
|
|
108
|
-
fixture.componentRef.setInput('breadcrumb', 'Some breadcrumb');
|
|
109
|
-
|
|
110
|
-
fixture.detectChanges();
|
|
111
|
-
|
|
112
|
-
expect(component.displayBreadcrumb()).toBe(true);
|
|
113
|
-
expect(component.breadcrumbLocation()).toEqual([{ title: 'test', link: '/test' }]);
|
|
114
|
-
expect(component.currentBreadcrumb()).toBe('Some breadcrumb');
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('should display the breadcrump when showBreadcrump is true when used without service', () => {
|
|
118
|
-
fixture.componentRef.setInput('showBreadcrumb', true);
|
|
119
|
-
fixture.componentRef.setInput('location', [{ title: 'test', link: '/test' }]);
|
|
120
|
-
fixture.componentRef.setInput('breadcrumb', 'Some breadcrumb');
|
|
121
|
-
|
|
122
|
-
fixture.detectChanges();
|
|
123
|
-
|
|
124
|
-
expect(fixture.nativeElement.querySelector('.breadcrumb').textContent).toContain('Some breadcrumb');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('should contains an anchor for each of the locations when used without service', () => {
|
|
128
|
-
const fakeLocations = [{ title: 'test', link: '/test' }];
|
|
129
|
-
fixture.componentRef.setInput('showBreadcrumb', true);
|
|
130
|
-
fixture.componentRef.setInput('location', fakeLocations);
|
|
131
|
-
fixture.componentRef.setInput('breadcrumb', 'Some breadcrumb');
|
|
132
|
-
|
|
133
|
-
fixture.detectChanges();
|
|
134
|
-
|
|
135
|
-
const anchors = fixture.nativeElement.querySelectorAll('a');
|
|
136
|
-
expect(anchors.length).toBe(fakeLocations.length);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('should display the current location when used without service', () => {
|
|
140
|
-
const fakeLocations = [{ title: 'test', link: '/test' }, { title: 'test2', link: '/test2' }];
|
|
141
|
-
fixture.componentRef.setInput('showBreadcrumb', true);
|
|
142
|
-
fixture.componentRef.setInput('location', fakeLocations);
|
|
143
|
-
fixture.componentRef.setInput('breadcrumb', 'Some breadcrumb');
|
|
144
|
-
|
|
145
|
-
fixture.detectChanges();
|
|
146
|
-
|
|
147
|
-
const anchors = fixture.nativeElement.querySelectorAll('a');
|
|
148
|
-
expect(anchors[0].textContent).toContain(fakeLocations[0].title);
|
|
149
|
-
expect(anchors[1].textContent).toContain(fakeLocations[1].title);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('should display the current breadcrumb when used without service', () => {
|
|
153
|
-
const fakeLocations = [{ title: 'test', link: '/test' }];
|
|
154
|
-
fixture.componentRef.setInput('showBreadcrumb', true);
|
|
155
|
-
fixture.componentRef.setInput('location', fakeLocations);
|
|
156
|
-
fixture.componentRef.setInput('breadcrumb', 'Some breadcrumb');
|
|
157
|
-
|
|
158
|
-
fixture.detectChanges();
|
|
159
|
-
|
|
160
|
-
expect(fixture.nativeElement.querySelector('.breadcrumb').textContent).toContain('Some breadcrumb');
|
|
161
|
-
});
|
|
162
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Component, computed, inject, input } from '@angular/core';
|
|
3
|
-
import { RouterModule } from '@angular/router';
|
|
4
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
-
import { BreadcrumbService } from '../../../core/breadcrumb.service';
|
|
6
|
-
import { BreadcrumbLocation } from '../../../core/models/breadcrumb-location';
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'cauca-page-title',
|
|
9
|
-
imports: [TranslateModule, RouterModule],
|
|
10
|
-
templateUrl: './page-title.component.html',
|
|
11
|
-
styleUrls: ['./page-title.component.scss']
|
|
12
|
-
})
|
|
13
|
-
export class PageTitleComponent {
|
|
14
|
-
|
|
15
|
-
public caption = input<string>('');
|
|
16
|
-
public showBreadcrumb = input<boolean>(false);
|
|
17
|
-
public location = input<BreadcrumbLocation[]>([]);
|
|
18
|
-
public breadcrumb = input<string>('');
|
|
19
|
-
public baseCrumb = input<string>('');
|
|
20
|
-
public translateBreadcrumb = input<boolean>(true);
|
|
21
|
-
|
|
22
|
-
public displayBreadcrumb = computed(() => this.showBreadcrumb() || this.breadcrumbService?.showBreadcrumb());
|
|
23
|
-
public breadcrumbLocation = computed(() => this.breadcrumbService?.location() || this.location() || []);
|
|
24
|
-
public currentBreadcrumb = computed(() => this.breadcrumbService?.breadcrumb() || this.breadcrumb() || '');
|
|
25
|
-
public mustTranslateBreadcrumb = computed(() => this.breadcrumbService?.translateBreadcrumb() || this.translateBreadcrumb());
|
|
26
|
-
|
|
27
|
-
private readonly breadcrumbService = inject(BreadcrumbService, { optional: true });
|
|
28
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
.section {
|
|
2
|
-
display: flex;
|
|
3
|
-
padding: 24px 16px;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
align-items: flex-start;
|
|
7
|
-
flex: 1 0 0;
|
|
8
|
-
max-width: 1200px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.section-description {
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
align-items: flex-start;
|
|
15
|
-
flex: 1 0 0;
|
|
16
|
-
padding-bottom: 24px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.section-fields {
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: flex-start;
|
|
22
|
-
gap: 8px;
|
|
23
|
-
align-self: stretch;
|
|
24
|
-
& > * {
|
|
25
|
-
flex: 1 0 0;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MainSectionComponent } from './main-section.component';
|
|
4
|
-
import { MockModule, MockPipe } from 'ng-mocks';
|
|
5
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
6
|
-
|
|
7
|
-
describe('MainSectionComponent', () => {
|
|
8
|
-
let component: MainSectionComponent;
|
|
9
|
-
let fixture: ComponentFixture<MainSectionComponent>;
|
|
10
|
-
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
await TestBed.configureTestingModule({
|
|
13
|
-
declarations: [MockPipe(TranslatePipe, value => value)],
|
|
14
|
-
imports: [MainSectionComponent, MockModule(TranslateModule)]
|
|
15
|
-
})
|
|
16
|
-
.compileComponents();
|
|
17
|
-
|
|
18
|
-
fixture = TestBed.createComponent(MainSectionComponent);
|
|
19
|
-
component = fixture.componentInstance;
|
|
20
|
-
fixture.detectChanges();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should create', () => {
|
|
24
|
-
expect(component).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should display the specified translated title', () => {
|
|
28
|
-
const someTitle = 'someTitle';
|
|
29
|
-
|
|
30
|
-
fixture.componentRef.setInput('title', someTitle);
|
|
31
|
-
fixture.detectChanges();
|
|
32
|
-
|
|
33
|
-
expect(fixture.nativeElement.querySelector('.section-description').textContent).toBe(someTitle);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should not display a title if none is provided', () => {
|
|
37
|
-
fixture.componentRef.setInput('title', '');
|
|
38
|
-
fixture.detectChanges();
|
|
39
|
-
|
|
40
|
-
expect(fixture.nativeElement.querySelector('.section-description')).toBeNull();
|
|
41
|
-
});
|
|
42
|
-
});
|