@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,108 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { RaisedButtonComponent } from './raised-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
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
9
|
-
import { MockPipe } from 'ng-mocks';
|
|
10
|
-
|
|
11
|
-
describe('RaisedButtonComponent', () => {
|
|
12
|
-
let component: RaisedButtonComponent;
|
|
13
|
-
let fixture: ComponentFixture<RaisedButtonComponent>;
|
|
14
|
-
let loader: HarnessLoader;
|
|
15
|
-
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
await TestBed.configureTestingModule({
|
|
18
|
-
imports: [
|
|
19
|
-
RaisedButtonComponent,
|
|
20
|
-
],
|
|
21
|
-
declarations: [MockPipe(TranslatePipe, key => key)]
|
|
22
|
-
})
|
|
23
|
-
.compileComponents();
|
|
24
|
-
|
|
25
|
-
fixture = TestBed.createComponent(RaisedButtonComponent);
|
|
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
|
-
fixture.detectChanges();
|
|
71
|
-
|
|
72
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
73
|
-
const icon = await button.getHarness(MatIconHarness);
|
|
74
|
-
expect(await button.isDisabled()).toBeTrue();
|
|
75
|
-
expect(await icon.getName()).toBe('update');
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('should not show any icon when not set', async () => {
|
|
79
|
-
fixture.componentRef.setInput('icon', null);
|
|
80
|
-
|
|
81
|
-
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
82
|
-
const icon = await button.getHarnessOrNull(MatIconHarness);
|
|
83
|
-
expect(icon).toBe(null);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should emit buttonClick event when clicked', async () => {
|
|
87
|
-
const clickSpy = spyOn(component.buttonClick, 'emit');
|
|
88
|
-
const button = await loader.getHarness(MatButtonHarness);
|
|
89
|
-
|
|
90
|
-
await button.click();
|
|
91
|
-
|
|
92
|
-
expect(clickSpy).toHaveBeenCalled();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('should add small-button class when small is set', () => {
|
|
96
|
-
fixture.componentRef.setInput('small', false);
|
|
97
|
-
|
|
98
|
-
fixture.detectChanges();
|
|
99
|
-
|
|
100
|
-
expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
|
|
101
|
-
|
|
102
|
-
fixture.componentRef.setInput('small', true);
|
|
103
|
-
|
|
104
|
-
fixture.detectChanges();
|
|
105
|
-
|
|
106
|
-
expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
|
|
107
|
-
});
|
|
108
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
-
import { MatButton, } from '@angular/material/button';
|
|
3
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
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-raised-button',
|
|
10
|
-
standalone: true,
|
|
11
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
-
imports: [MatButton, MatIconModule, TranslateModule, NgClass],
|
|
13
|
-
templateUrl: './raised-button.component.html',
|
|
14
|
-
styleUrl: './raised-button.component.scss',
|
|
15
|
-
})
|
|
16
|
-
export class RaisedButtonComponent extends BaseButtonWithLabel {
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<cauca-button class="refresh-button" icon="refresh" type="stroked" color="primary" (buttonClick)="refresh()" [label]="'refresh' | translate" />
|
|
File without changes
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
3
|
-
import { MockComponent, MockPipe, ngMocks } from 'ng-mocks';
|
|
4
|
-
import { RefreshButtonComponent } from './refresh-button.component';
|
|
5
|
-
import { ButtonComponent } from '../../button/button.component';
|
|
6
|
-
|
|
7
|
-
describe('RefreshButtonComponent', () => {
|
|
8
|
-
let component: RefreshButtonComponent;
|
|
9
|
-
let fixture: ComponentFixture<RefreshButtonComponent>;
|
|
10
|
-
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
await TestBed.configureTestingModule({
|
|
13
|
-
imports: [RefreshButtonComponent]
|
|
14
|
-
})
|
|
15
|
-
.overrideComponent(RefreshButtonComponent, {
|
|
16
|
-
remove: { imports: [ButtonComponent, TranslatePipe] },
|
|
17
|
-
add: { imports: [MockComponent(ButtonComponent), MockPipe(TranslatePipe, value => value)] }
|
|
18
|
-
})
|
|
19
|
-
.compileComponents();
|
|
20
|
-
|
|
21
|
-
fixture = TestBed.createComponent(RefreshButtonComponent);
|
|
22
|
-
component = fixture.componentInstance;
|
|
23
|
-
fixture.detectChanges();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should create', () => {
|
|
27
|
-
expect(component).toBeTruthy();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should have correct button properties', () => {
|
|
31
|
-
const buttonDebugElement = ngMocks.find(fixture, 'cauca-button')?.componentInstance;
|
|
32
|
-
|
|
33
|
-
expect(buttonDebugElement).toBeDefined();
|
|
34
|
-
expect(buttonDebugElement.type).toBe('stroked');
|
|
35
|
-
expect(buttonDebugElement.icon).toBe('refresh');
|
|
36
|
-
expect(buttonDebugElement.label).toBe('refresh');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should emit refreshEvent when refresh method is called', () => {
|
|
40
|
-
spyOn(component.refreshEvent, 'emit');
|
|
41
|
-
|
|
42
|
-
component.refresh();
|
|
43
|
-
|
|
44
|
-
expect(component.refreshEvent.emit).toHaveBeenCalledWith();
|
|
45
|
-
expect(component.refreshEvent.emit).toHaveBeenCalledTimes(1);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should call refresh method when button is clicked', () => {
|
|
49
|
-
spyOn(component, 'refresh');
|
|
50
|
-
const buttonElement = ngMocks.find(fixture, ButtonComponent);
|
|
51
|
-
|
|
52
|
-
ngMocks.trigger(buttonElement, 'buttonClick');
|
|
53
|
-
|
|
54
|
-
expect(component.refresh).toHaveBeenCalledWith();
|
|
55
|
-
expect(component.refresh).toHaveBeenCalledTimes(1);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should emit refreshEvent when button is clicked', () => {
|
|
59
|
-
spyOn(component.refreshEvent, 'emit');
|
|
60
|
-
const buttonElement = ngMocks.find(fixture, ButtonComponent);
|
|
61
|
-
|
|
62
|
-
ngMocks.trigger(buttonElement, 'buttonClick');
|
|
63
|
-
|
|
64
|
-
expect(component.refreshEvent.emit).toHaveBeenCalledWith();
|
|
65
|
-
expect(component.refreshEvent.emit).toHaveBeenCalledTimes(1);
|
|
66
|
-
}); it('should render cauca-button with expected template', () => {
|
|
67
|
-
const buttonDebugElement = ngMocks.find(fixture, 'cauca-button');
|
|
68
|
-
|
|
69
|
-
// Check that the button component is rendered
|
|
70
|
-
expect(buttonDebugElement).toBeDefined();
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should have EventEmitter as refreshEvent', () => {
|
|
74
|
-
expect(component.refreshEvent).toBeDefined();
|
|
75
|
-
expect(component.refreshEvent.constructor.name).toContain('EventEmitter');
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('should initialize with default values', () => {
|
|
79
|
-
expect(component.refreshEvent).toBeDefined();
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, EventEmitter, Output, Input } from '@angular/core';
|
|
2
|
-
import { ButtonComponent } from '../../button/button.component';
|
|
3
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'cauca-refresh-button',
|
|
7
|
-
imports: [ButtonComponent, TranslatePipe],
|
|
8
|
-
templateUrl: './refresh-button.component.html',
|
|
9
|
-
styleUrl: './refresh-button.component.scss',
|
|
10
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
11
|
-
})
|
|
12
|
-
export class RefreshButtonComponent {
|
|
13
|
-
@Input() public inProgress: boolean = false;
|
|
14
|
-
@Output() public refreshEvent: EventEmitter<void> = new EventEmitter<void>();
|
|
15
|
-
|
|
16
|
-
public refresh(): void {
|
|
17
|
-
this.refreshEvent.emit();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
button {
|
|
2
|
-
border-radius: 100px;
|
|
3
|
-
background-color: inherit;
|
|
4
|
-
outline: none;
|
|
5
|
-
border-width: 0px;
|
|
6
|
-
height: 40px;
|
|
7
|
-
width: 40px;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
:host {
|
|
12
|
-
display: flex;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.mdc-button.mat-white,
|
|
16
|
-
.mat-stroked-button.mat-white {
|
|
17
|
-
color: white;
|
|
18
|
-
border-color: white;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.mdc-button.mat-white:hover,
|
|
22
|
-
.mat-mdc-outlined-button.mat-white:hover {
|
|
23
|
-
background-color: transparent;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
mat-icon {
|
|
27
|
-
color: #006496;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.mat-mdc-button-disabled {
|
|
31
|
-
.mat-icon {
|
|
32
|
-
color: rgba(18, 16, 20, 0.38);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { RoundButtonComponent } from './round-button.component';
|
|
4
|
-
import { MockModule, MockPipe } from 'ng-mocks';
|
|
5
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
6
|
-
|
|
7
|
-
describe('RoundButtonComponent', () => {
|
|
8
|
-
let component: RoundButtonComponent;
|
|
9
|
-
let fixture: ComponentFixture<RoundButtonComponent>;
|
|
10
|
-
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
await TestBed.configureTestingModule({
|
|
13
|
-
imports: [RoundButtonComponent, MockModule(TranslateModule)],
|
|
14
|
-
declarations: [MockPipe(TranslatePipe, key => key)]
|
|
15
|
-
})
|
|
16
|
-
.compileComponents();
|
|
17
|
-
|
|
18
|
-
fixture = TestBed.createComponent(RoundButtonComponent);
|
|
19
|
-
component = fixture.componentInstance;
|
|
20
|
-
fixture.detectChanges();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should create', () => {
|
|
24
|
-
expect(component).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
-
import { BaseButtonWithLabel } from '../base-button';
|
|
3
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'cauca-round-button',
|
|
7
|
-
standalone: true,
|
|
8
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
-
imports: [TranslateModule],
|
|
10
|
-
templateUrl: './round-button.component.html',
|
|
11
|
-
styleUrl: './round-button.component.scss'
|
|
12
|
-
})
|
|
13
|
-
export class RoundButtonComponent extends BaseButtonWithLabel {
|
|
14
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<button mat-stroked-button [ngClass]="small() ? 'small-button' : ''" [color]="color()" onclick="this.blur()" [disabled]="buttonDisabled()" (click)="buttonClick.emit()" [class.icon-only]="!label()">
|
|
2
|
-
@if(showIcon() && iconAlignment() === 'left') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
3
|
-
@if (label()) { @if (translateLabel()) {{{label()|translate}}} @else {{{label()}}} }
|
|
4
|
-
@if(showIcon() && iconAlignment() === 'right') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
5
|
-
</button>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
.mdc-button.mat-white,
|
|
2
|
-
.mat-stroked-button.mat-white {
|
|
3
|
-
color: white;
|
|
4
|
-
border-color: white;
|
|
5
|
-
}
|
|
6
|
-
.mdc-button.mat-white:hover,
|
|
7
|
-
.mat-mdc-outlined-button.mat-white:hover {
|
|
8
|
-
background-color: transparent;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.icon-only {
|
|
12
|
-
width: 36px;
|
|
13
|
-
height: 36px;
|
|
14
|
-
min-width: 38px;
|
|
15
|
-
padding: 0px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.icon-only mat-icon {
|
|
19
|
-
margin: 0;
|
|
20
|
-
}
|
|
21
|
-
mat-icon {
|
|
22
|
-
color: inherit;
|
|
23
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { StrokedButtonComponent } from './stroked-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
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
9
|
-
import { MockPipe } from 'ng-mocks';
|
|
10
|
-
|
|
11
|
-
describe('StrokedButtonComponent', () => {
|
|
12
|
-
let component: StrokedButtonComponent;
|
|
13
|
-
let fixture: ComponentFixture<StrokedButtonComponent>;
|
|
14
|
-
let loader: HarnessLoader;
|
|
15
|
-
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
await TestBed.configureTestingModule({
|
|
18
|
-
imports: [
|
|
19
|
-
StrokedButtonComponent,
|
|
20
|
-
],
|
|
21
|
-
declarations: [MockPipe(TranslatePipe, key => key)]
|
|
22
|
-
})
|
|
23
|
-
.compileComponents();
|
|
24
|
-
|
|
25
|
-
fixture = TestBed.createComponent(StrokedButtonComponent);
|
|
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 the icon-only class to the button when no label is provided', () => {
|
|
94
|
-
fixture.componentRef.setInput('icon', 'twidelidou');
|
|
95
|
-
|
|
96
|
-
fixture.detectChanges();
|
|
97
|
-
|
|
98
|
-
expect(fixture.nativeElement.querySelector('button')).toHaveClass('icon-only');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should add small-button class when small is set', () => {
|
|
102
|
-
fixture.componentRef.setInput('small', false);
|
|
103
|
-
|
|
104
|
-
fixture.detectChanges();
|
|
105
|
-
|
|
106
|
-
expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
|
|
107
|
-
|
|
108
|
-
fixture.componentRef.setInput('small', true);
|
|
109
|
-
|
|
110
|
-
fixture.detectChanges();
|
|
111
|
-
|
|
112
|
-
expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
|
|
113
|
-
});
|
|
114
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
-
import { MatButton, } from '@angular/material/button';
|
|
3
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
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-stroked-button',
|
|
10
|
-
standalone: true,
|
|
11
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
-
imports: [MatButton, MatIconModule, TranslateModule, NgClass],
|
|
13
|
-
templateUrl: './stroked-button.component.html',
|
|
14
|
-
styleUrl: './stroked-button.component.scss',
|
|
15
|
-
})
|
|
16
|
-
export class StrokedButtonComponent extends BaseButtonWithLabel {
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<mat-form-field [subscriptSizing]="subscriptSizing">
|
|
2
|
-
@if (label) {
|
|
3
|
-
<mat-label>{{ translateLabel ? (label | translate) : label }}{{isRequired ? '*' : ''}}</mat-label>
|
|
4
|
-
}
|
|
5
|
-
<input (focusout)="onTouched()" matInput [value]="stringDate" readonly="readonly">
|
|
6
|
-
<button matSuffix mat-icon-button (click)="showDialog()">
|
|
7
|
-
<mat-icon>calendar_month</mat-icon>
|
|
8
|
-
</button>
|
|
9
|
-
</mat-form-field>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { CaucaDateTimePickerComponent } from './cauca-date-time-picker.component';
|
|
3
|
-
import { MatDialogModule } from '@angular/material/dialog';
|
|
4
|
-
import { DatePipe, registerLocaleData } from '@angular/common';
|
|
5
|
-
import { LOCALE_ID } from '@angular/core';
|
|
6
|
-
import localeFr from '@angular/common/locales/fr';
|
|
7
|
-
import { MockModule, MockPipe } from 'ng-mocks';
|
|
8
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
9
|
-
|
|
10
|
-
describe('CaucaDateTimePickerComponent', () => {
|
|
11
|
-
let component: CaucaDateTimePickerComponent;
|
|
12
|
-
let fixture: ComponentFixture<CaucaDateTimePickerComponent>;
|
|
13
|
-
|
|
14
|
-
beforeEach(async () => {
|
|
15
|
-
await TestBed.configureTestingModule({
|
|
16
|
-
imports: [
|
|
17
|
-
CaucaDateTimePickerComponent,
|
|
18
|
-
MatDialogModule,
|
|
19
|
-
MockModule(TranslateModule),
|
|
20
|
-
MockPipe(TranslatePipe, value => value)
|
|
21
|
-
],
|
|
22
|
-
providers: [
|
|
23
|
-
DatePipe,
|
|
24
|
-
{ provide: LOCALE_ID, useValue: 'fr-CA' },
|
|
25
|
-
],
|
|
26
|
-
})
|
|
27
|
-
.compileComponents();
|
|
28
|
-
|
|
29
|
-
registerLocaleData(localeFr, 'fr');
|
|
30
|
-
fixture = TestBed.createComponent(CaucaDateTimePickerComponent);
|
|
31
|
-
component = fixture.componentInstance;
|
|
32
|
-
fixture.detectChanges();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
afterEach(() => {
|
|
36
|
-
component.showSeconds = false;
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should create', () => {
|
|
40
|
-
expect(component).toBeTruthy();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should execute openDialog when click on button', () => {
|
|
44
|
-
const showDialogSpy = spyOn(component, 'showDialog');
|
|
45
|
-
const button = fixture.nativeElement.querySelector('button');
|
|
46
|
-
|
|
47
|
-
button.click();
|
|
48
|
-
|
|
49
|
-
expect(showDialogSpy).toHaveBeenCalled();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should stringify the date when value is pass', () => {
|
|
53
|
-
const today = new Date();
|
|
54
|
-
const input = fixture.nativeElement.querySelector('input');
|
|
55
|
-
|
|
56
|
-
component.value = today;
|
|
57
|
-
|
|
58
|
-
expect(input.value).not.toBeNull();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('should set empty the date when value is null', () => {
|
|
62
|
-
const input = fixture.nativeElement.querySelector('input');
|
|
63
|
-
|
|
64
|
-
component.value = null;
|
|
65
|
-
|
|
66
|
-
expect(input.value).toBe('');
|
|
67
|
-
});
|
|
68
|
-
});
|