@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
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { ConfirmDialogComponent } from './confirm-dialog.component';
|
|
4
|
-
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
5
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
-
import { MockComponents, MockModule, MockPipe, ngMocks } from 'ng-mocks';
|
|
7
|
-
import { ConfirmationOptions, ConfirmationResult } from '../services/dialog.service';
|
|
8
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
9
|
-
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';
|
|
10
|
-
import { of } from 'rxjs';
|
|
11
|
-
import { StrokedButtonComponent } from '../../buttons/stroked-button/stroked-button.component';
|
|
12
|
-
import { IconButtonComponent } from '../../buttons/icon-button/icon-button.component';
|
|
13
|
-
import { RaisedButtonComponent } from '../../buttons/raised-button/raised-button.component';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
describe('ConfirmDialogComponent', () => {
|
|
17
|
-
let component: ConfirmDialogComponent;
|
|
18
|
-
let fixture: ComponentFixture<ConfirmDialogComponent>;
|
|
19
|
-
let mockMatDialog: any;
|
|
20
|
-
let breakpointObserverMock: jasmine.SpyObj<BreakpointObserver>;
|
|
21
|
-
|
|
22
|
-
const defaultConfirmationOptions: ConfirmationOptions = {
|
|
23
|
-
noText: 'no',
|
|
24
|
-
noColor: undefined,
|
|
25
|
-
yesText: 'yes',
|
|
26
|
-
yesColor: 'primary',
|
|
27
|
-
messageArgs: null,
|
|
28
|
-
titleArgs: null,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
beforeEach(async () => {
|
|
32
|
-
breakpointObserverMock = jasmine.createSpyObj('BreakpointObserver', ['observe']);
|
|
33
|
-
breakpointObserverMock.observe.and.returnValue(of({ matches: true, breakpoints: {} }));
|
|
34
|
-
|
|
35
|
-
mockMatDialog = jasmine.createSpyObj('MatDialogRef', ['close', 'addPanelClass', 'updateSize']);
|
|
36
|
-
await TestBed.configureTestingModule({
|
|
37
|
-
declarations: [
|
|
38
|
-
ConfirmDialogComponent,
|
|
39
|
-
...MockComponents(StrokedButtonComponent, IconButtonComponent, RaisedButtonComponent),
|
|
40
|
-
MockPipe(TranslatePipe, value => value),
|
|
41
|
-
],
|
|
42
|
-
providers: [
|
|
43
|
-
{ provide: MatDialogRef<ConfirmDialogComponent>, useValue: mockMatDialog },
|
|
44
|
-
{ provide: MAT_DIALOG_DATA, useValue: { title: 'title', message: 'message', options: defaultConfirmationOptions } },
|
|
45
|
-
{ provide: BreakpointObserver, useValue: breakpointObserverMock },
|
|
46
|
-
],
|
|
47
|
-
imports: [
|
|
48
|
-
MockModule(TranslateModule),
|
|
49
|
-
MatIconModule,
|
|
50
|
-
]
|
|
51
|
-
})
|
|
52
|
-
.compileComponents();
|
|
53
|
-
|
|
54
|
-
fixture = TestBed.createComponent(ConfirmDialogComponent);
|
|
55
|
-
component = fixture.componentInstance;
|
|
56
|
-
fixture.detectChanges();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
afterEach(() => {
|
|
60
|
-
mockMatDialog.close.calls.reset();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('should create', () => {
|
|
64
|
-
expect(component).toBeTruthy();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should initially add a global style class', () => {
|
|
68
|
-
expect(mockMatDialog.addPanelClass).toHaveBeenCalledWith('dialog-global-style');
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should update dialog size when breakpoint matches', fakeAsync(() => {
|
|
72
|
-
mockMatDialog.updateSize.calls.reset();
|
|
73
|
-
const breakpointState: BreakpointState = { matches: true, breakpoints: {} };
|
|
74
|
-
breakpointObserverMock.observe.and.returnValue(of(breakpointState));
|
|
75
|
-
TestBed.createComponent(ConfirmDialogComponent);
|
|
76
|
-
|
|
77
|
-
fixture.detectChanges();
|
|
78
|
-
|
|
79
|
-
expect(mockMatDialog.updateSize).toHaveBeenCalledWith('100vw');
|
|
80
|
-
}));
|
|
81
|
-
|
|
82
|
-
it('should update dialog size when breakpoint does not match', fakeAsync(() => {
|
|
83
|
-
mockMatDialog.updateSize.calls.reset();
|
|
84
|
-
const breakpointState: BreakpointState = { matches: false, breakpoints: {} };
|
|
85
|
-
breakpointObserverMock.observe.and.returnValue(of(breakpointState));
|
|
86
|
-
TestBed.createComponent(ConfirmDialogComponent);
|
|
87
|
-
|
|
88
|
-
fixture.detectChanges();
|
|
89
|
-
|
|
90
|
-
expect(mockMatDialog.updateSize).toHaveBeenCalledWith('auto');
|
|
91
|
-
}));
|
|
92
|
-
|
|
93
|
-
it('should display the provided title and message', () => {
|
|
94
|
-
expect(fixture.nativeElement.querySelector('.title').textContent).toBe('title');
|
|
95
|
-
expect(fixture.nativeElement.querySelector('.message').textContent).toBe('message');
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('should render the yes button according to specification', () => {
|
|
99
|
-
const button = ngMocks.find<RaisedButtonComponent>('.yes-button').componentInstance;
|
|
100
|
-
|
|
101
|
-
expect(button.label).toBe(defaultConfirmationOptions.yesText);
|
|
102
|
-
expect(button.color).toBe(defaultConfirmationOptions.yesColor);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('should render the no button according to specification', () => {
|
|
106
|
-
const button = ngMocks.find<StrokedButtonComponent>('.no-button').componentInstance;
|
|
107
|
-
|
|
108
|
-
expect(button.label).toBe(defaultConfirmationOptions.noText);
|
|
109
|
-
expect(button.color).toBe(defaultConfirmationOptions.noColor);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('should close dialog with true when pressing ok', async () => {
|
|
113
|
-
const button = ngMocks.find<RaisedButtonComponent>('.yes-button').componentInstance;
|
|
114
|
-
|
|
115
|
-
button.buttonClick.emit();
|
|
116
|
-
fixture.detectChanges();
|
|
117
|
-
|
|
118
|
-
expect(mockMatDialog.close).toHaveBeenCalledOnceWith(ConfirmationResult.Yes);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('should close dialog without true when pressing close', async () => {
|
|
122
|
-
const button = ngMocks.find<IconButtonComponent>('#close-button').componentInstance;
|
|
123
|
-
|
|
124
|
-
button.buttonClick.emit();
|
|
125
|
-
|
|
126
|
-
expect(mockMatDialog.close).toHaveBeenCalledOnceWith(ConfirmationResult.Cancel);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should close dialog without true when pressing no', async () => {
|
|
130
|
-
const button = ngMocks.find<StrokedButtonComponent>('.no-button').componentInstance;
|
|
131
|
-
|
|
132
|
-
button.buttonClick.emit();
|
|
133
|
-
fixture.detectChanges();
|
|
134
|
-
|
|
135
|
-
expect(mockMatDialog.close).toHaveBeenCalledOnceWith(ConfirmationResult.No);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Component, Inject } from '@angular/core';
|
|
2
|
-
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
3
|
-
import { AlertDialogData } from '../alert-dialog/alert-dialog.component';
|
|
4
|
-
import { ConfirmationOptions, ConfirmationResult } from '../services/dialog.service';
|
|
5
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
6
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
|
-
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
8
|
-
import { RaisedButtonComponent } from '../../buttons/raised-button/raised-button.component';
|
|
9
|
-
import { StrokedButtonComponent } from '../../buttons/stroked-button/stroked-button.component';
|
|
10
|
-
import { IconButtonComponent } from '../../buttons/icon-button/icon-button.component';
|
|
11
|
-
|
|
12
|
-
@Component({
|
|
13
|
-
selector: 'cauca-confirm-dialog',
|
|
14
|
-
templateUrl: './confirm-dialog.component.html',
|
|
15
|
-
styleUrls: ['./confirm-dialog.component.scss'],
|
|
16
|
-
standalone: true,
|
|
17
|
-
imports: [TranslateModule, MatDialogModule, RaisedButtonComponent, StrokedButtonComponent, IconButtonComponent]
|
|
18
|
-
})
|
|
19
|
-
export class ConfirmDialogComponent {
|
|
20
|
-
|
|
21
|
-
public title: string = '';
|
|
22
|
-
public message: string = '';
|
|
23
|
-
public options: ConfirmationOptions;
|
|
24
|
-
|
|
25
|
-
public constructor(
|
|
26
|
-
public dialogRef: MatDialogRef<ConfirmDialogComponent>,
|
|
27
|
-
@Inject(MAT_DIALOG_DATA) public data: AlertDialogData,
|
|
28
|
-
breakdownObserver: BreakpointObserver) {
|
|
29
|
-
this.title = data.title;
|
|
30
|
-
this.message = data.message;
|
|
31
|
-
this.options = data.options;
|
|
32
|
-
dialogRef.addPanelClass("dialog-global-style");
|
|
33
|
-
breakdownObserver.observe('(max-width: 500px)').pipe(takeUntilDestroyed()).subscribe(result => dialogRef.updateSize(result.matches ? '100vw' : 'auto'));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public noClick(): void {
|
|
37
|
-
this.dialogRef.close(ConfirmationResult.No);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public yesClick(): void {
|
|
41
|
-
this.dialogRef.close(ConfirmationResult.Yes);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public cancelClick(): void {
|
|
45
|
-
this.dialogRef.close(ConfirmationResult.Cancel);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<div mat-dialog-title>
|
|
2
|
-
@if (itemGenderIsFemale)
|
|
3
|
-
{
|
|
4
|
-
<div class="h6 title">{{ ('deleteDialog.titleFemale' | translate:{itemType}) }}</div>
|
|
5
|
-
} @else
|
|
6
|
-
{
|
|
7
|
-
<div class="h6 title">{{ ('deleteDialog.titleMale' | translate:{itemType}) }}</div>
|
|
8
|
-
}
|
|
9
|
-
<cauca-icon-button id="closeButton" (buttonClick)="closeClick()" icon="close" />
|
|
10
|
-
</div>
|
|
11
|
-
<div mat-dialog-content>
|
|
12
|
-
<p>{{('deleteDialog.message' | translate:{itemName})}}</p>
|
|
13
|
-
</div>
|
|
14
|
-
<mat-dialog-actions align="end">
|
|
15
|
-
<cauca-stroked-button id="cancelButton" label="cancel" color="primary" (buttonClick)="closeClick()"/>
|
|
16
|
-
<cauca-raised-button id="deleteButton" label="delete" color="warn" (buttonClick)="deleteClick()" />
|
|
17
|
-
</mat-dialog-actions>
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { DeleteDialogComponent } from './delete-dialog.component';
|
|
4
|
-
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
5
|
-
import { MockComponents, MockModule, MockPipe, ngMocks } from 'ng-mocks';
|
|
6
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
7
|
-
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';
|
|
8
|
-
import { of } from 'rxjs';
|
|
9
|
-
import { RaisedButtonComponent } from '../../buttons/raised-button/raised-button.component';
|
|
10
|
-
import { StrokedButtonComponent } from '../../buttons/stroked-button/stroked-button.component';
|
|
11
|
-
import { IconButtonComponent } from '../../buttons/icon-button/icon-button.component';
|
|
12
|
-
|
|
13
|
-
describe('DeleteDialogComponent', () => {
|
|
14
|
-
let component: DeleteDialogComponent;
|
|
15
|
-
let fixture: ComponentFixture<DeleteDialogComponent>;
|
|
16
|
-
let mockMatDialog: jasmine.SpyObj<MatDialogRef<DeleteDialogComponent>>;
|
|
17
|
-
let breakpointObserverMock: jasmine.SpyObj<BreakpointObserver>;
|
|
18
|
-
|
|
19
|
-
beforeEach(async () => {
|
|
20
|
-
breakpointObserverMock = jasmine.createSpyObj('BreakpointObserver', ['observe']);
|
|
21
|
-
breakpointObserverMock.observe.and.returnValue(of({ matches: true, breakpoints: {} }));
|
|
22
|
-
|
|
23
|
-
mockMatDialog = jasmine.createSpyObj('MatDialogRef', ['close', 'addPanelClass', 'updateSize']);
|
|
24
|
-
await TestBed.configureTestingModule({
|
|
25
|
-
imports: [DeleteDialogComponent, MockModule(TranslateModule)],
|
|
26
|
-
declarations: [
|
|
27
|
-
...MockComponents(StrokedButtonComponent, RaisedButtonComponent, IconButtonComponent),
|
|
28
|
-
MockPipe(TranslatePipe, value => value),
|
|
29
|
-
],
|
|
30
|
-
providers: [
|
|
31
|
-
{ provide: MatDialogRef, useValue: mockMatDialog },
|
|
32
|
-
{ provide: MAT_DIALOG_DATA, useValue: [] },
|
|
33
|
-
{ provide: BreakpointObserver, useValue: breakpointObserverMock },
|
|
34
|
-
]
|
|
35
|
-
})
|
|
36
|
-
.compileComponents();
|
|
37
|
-
|
|
38
|
-
fixture = TestBed.createComponent(DeleteDialogComponent);
|
|
39
|
-
component = fixture.componentInstance;
|
|
40
|
-
fixture.detectChanges();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should create', () => {
|
|
44
|
-
expect(component).toBeTruthy();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should initially add a global style class', () => {
|
|
48
|
-
expect(mockMatDialog.addPanelClass).toHaveBeenCalledWith('dialog-global-style');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should update dialog size when breakpoint matches', fakeAsync(() => {
|
|
52
|
-
mockMatDialog.updateSize.calls.reset();
|
|
53
|
-
const breakpointState: BreakpointState = { matches: true, breakpoints: {} };
|
|
54
|
-
breakpointObserverMock.observe.and.returnValue(of(breakpointState));
|
|
55
|
-
TestBed.createComponent(DeleteDialogComponent);
|
|
56
|
-
|
|
57
|
-
fixture.detectChanges();
|
|
58
|
-
|
|
59
|
-
expect(mockMatDialog.updateSize).toHaveBeenCalledWith('100vw');
|
|
60
|
-
}));
|
|
61
|
-
|
|
62
|
-
it('should update dialog size when breakpoint does not match', fakeAsync(() => {
|
|
63
|
-
mockMatDialog.updateSize.calls.reset();
|
|
64
|
-
const breakpointState: BreakpointState = { matches: false, breakpoints: {} };
|
|
65
|
-
breakpointObserverMock.observe.and.returnValue(of(breakpointState));
|
|
66
|
-
TestBed.createComponent(DeleteDialogComponent);
|
|
67
|
-
|
|
68
|
-
fixture.detectChanges();
|
|
69
|
-
|
|
70
|
-
expect(mockMatDialog.updateSize).toHaveBeenCalledWith('auto');
|
|
71
|
-
}));
|
|
72
|
-
|
|
73
|
-
it('should close dialog with true when pressing delete', async () => {
|
|
74
|
-
const deleteButton = ngMocks.find<StrokedButtonComponent>('#deleteButton', null)?.componentInstance;
|
|
75
|
-
|
|
76
|
-
deleteButton.buttonClick.emit();
|
|
77
|
-
|
|
78
|
-
expect(mockMatDialog.close).toHaveBeenCalledWith(true);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('should close dialog without true when pressing close', async () => {
|
|
82
|
-
const closeButton = ngMocks.find<IconButtonComponent>('#closeButton', null)?.componentInstance;
|
|
83
|
-
|
|
84
|
-
closeButton.buttonClick.emit();
|
|
85
|
-
|
|
86
|
-
expect(mockMatDialog.close).not.toHaveBeenCalledWith(true);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('should close dialog without true when pressing cancel', async () => {
|
|
90
|
-
const cancelButton = ngMocks.find<RaisedButtonComponent>('#cancelButton', null)?.componentInstance;
|
|
91
|
-
|
|
92
|
-
cancelButton.buttonClick.emit();
|
|
93
|
-
|
|
94
|
-
expect(mockMatDialog.close).not.toHaveBeenCalledWith(true);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Component, Inject } from '@angular/core';
|
|
2
|
-
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
|
3
|
-
import { DeleteDialogData } from './models/delete-dialog-data';
|
|
4
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
-
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
6
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
|
-
import { RaisedButtonComponent } from '../../buttons/raised-button/raised-button.component';
|
|
8
|
-
import { StrokedButtonComponent } from '../../buttons/stroked-button/stroked-button.component';
|
|
9
|
-
import { IconButtonComponent } from '../../buttons/icon-button/icon-button.component';
|
|
10
|
-
|
|
11
|
-
@Component({
|
|
12
|
-
selector: 'cauca-delete-dialog',
|
|
13
|
-
templateUrl: './delete-dialog.component.html',
|
|
14
|
-
styleUrls: ['./delete-dialog.component.scss'],
|
|
15
|
-
standalone: true,
|
|
16
|
-
imports: [MatDialogModule, TranslateModule, StrokedButtonComponent, IconButtonComponent, RaisedButtonComponent]
|
|
17
|
-
})
|
|
18
|
-
export class DeleteDialogComponent {
|
|
19
|
-
public itemGenderIsFemale: boolean = false;
|
|
20
|
-
public itemName: string = '';
|
|
21
|
-
public itemType: string = '';
|
|
22
|
-
|
|
23
|
-
public constructor(public dialogRef: MatDialogRef<DeleteDialogComponent>,
|
|
24
|
-
@Inject(MAT_DIALOG_DATA) public data: DeleteDialogData,
|
|
25
|
-
breakdownObserver: BreakpointObserver) {
|
|
26
|
-
this.itemGenderIsFemale = data.female;
|
|
27
|
-
this.itemName = data.name ? data.name : '';
|
|
28
|
-
this.itemType = data.type ? data.type.toLowerCase() : '';
|
|
29
|
-
dialogRef.addPanelClass("dialog-global-style");
|
|
30
|
-
breakdownObserver.observe('(max-width: 500px)').pipe(takeUntilDestroyed()).subscribe(result => dialogRef.updateSize(result.matches ? '100vw' : 'auto'));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public deleteClick(): void {
|
|
34
|
-
this.dialogRef.close(true);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public closeClick(): void {
|
|
38
|
-
this.dialogRef.close(false);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<div mat-dialog-title>
|
|
2
|
-
<div class="h6">{{('errorDialog.titleError' | translate)}}</div>
|
|
3
|
-
<cauca-icon-button id="closeButton" (buttonClick)="closeClick()" icon="close"/>
|
|
4
|
-
</div>
|
|
5
|
-
<div mat-dialog-content>
|
|
6
|
-
<p>{{('errorDialog.messageError' | translate:{itemName})}}</p>
|
|
7
|
-
</div>
|
|
8
|
-
<mat-dialog-actions align="end">
|
|
9
|
-
<cauca-raised-button id="okButton" label="ok" color="warn" (buttonClick)="closeClick()"/>
|
|
10
|
-
</mat-dialog-actions>
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { ErrorDialogComponent } from './error-dialog.component';
|
|
4
|
-
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
5
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
6
|
-
import { MockComponents, MockModule, MockPipe, ngMocks } from 'ng-mocks';
|
|
7
|
-
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';
|
|
8
|
-
import { of } from 'rxjs';
|
|
9
|
-
import { RaisedButtonComponent } from '../../buttons/raised-button/raised-button.component';
|
|
10
|
-
import { IconButtonComponent } from '../../buttons/icon-button/icon-button.component';
|
|
11
|
-
|
|
12
|
-
describe('ErrorDialogComponent', () => {
|
|
13
|
-
let component: ErrorDialogComponent;
|
|
14
|
-
let fixture: ComponentFixture<ErrorDialogComponent>;
|
|
15
|
-
let mockMatDialog: jasmine.SpyObj<MatDialogRef<any>>;
|
|
16
|
-
let breakpointObserverMock: jasmine.SpyObj<BreakpointObserver>;
|
|
17
|
-
|
|
18
|
-
beforeEach(async () => {
|
|
19
|
-
breakpointObserverMock = jasmine.createSpyObj('BreakpointObserver', ['observe']);
|
|
20
|
-
breakpointObserverMock.observe.and.returnValue(of({ matches: true, breakpoints: {} }));
|
|
21
|
-
|
|
22
|
-
mockMatDialog = jasmine.createSpyObj('MatDialogRef', ['close', 'addPanelClass', 'updateSize']);
|
|
23
|
-
await TestBed.configureTestingModule({
|
|
24
|
-
declarations: [
|
|
25
|
-
...MockComponents(IconButtonComponent, RaisedButtonComponent),
|
|
26
|
-
MockPipe(TranslatePipe, value => value),
|
|
27
|
-
],
|
|
28
|
-
imports: [
|
|
29
|
-
ErrorDialogComponent,
|
|
30
|
-
MockModule(TranslateModule)
|
|
31
|
-
],
|
|
32
|
-
providers: [
|
|
33
|
-
{ provide: MatDialogRef, useValue: mockMatDialog },
|
|
34
|
-
{ provide: MAT_DIALOG_DATA, useValue: [] },
|
|
35
|
-
{ provide: BreakpointObserver, useValue: breakpointObserverMock },
|
|
36
|
-
]
|
|
37
|
-
})
|
|
38
|
-
.compileComponents();
|
|
39
|
-
|
|
40
|
-
fixture = TestBed.createComponent(ErrorDialogComponent);
|
|
41
|
-
component = fixture.componentInstance;
|
|
42
|
-
fixture.detectChanges();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should create', () => {
|
|
46
|
-
expect(component).toBeTruthy();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should initially add a global style class', () => {
|
|
50
|
-
expect(mockMatDialog.addPanelClass).toHaveBeenCalledWith('dialog-global-style');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should update dialog size when breakpoint matches', fakeAsync(() => {
|
|
54
|
-
mockMatDialog.updateSize.calls.reset();
|
|
55
|
-
const breakpointState: BreakpointState = { matches: true, breakpoints: {} };
|
|
56
|
-
breakpointObserverMock.observe.and.returnValue(of(breakpointState));
|
|
57
|
-
TestBed.createComponent(ErrorDialogComponent);
|
|
58
|
-
|
|
59
|
-
fixture.detectChanges();
|
|
60
|
-
|
|
61
|
-
expect(mockMatDialog.updateSize).toHaveBeenCalledWith('100vw');
|
|
62
|
-
}));
|
|
63
|
-
|
|
64
|
-
it('should update dialog size when breakpoint does not match', fakeAsync(() => {
|
|
65
|
-
mockMatDialog.updateSize.calls.reset();
|
|
66
|
-
const breakpointState: BreakpointState = { matches: false, breakpoints: {} };
|
|
67
|
-
breakpointObserverMock.observe.and.returnValue(of(breakpointState));
|
|
68
|
-
TestBed.createComponent(ErrorDialogComponent);
|
|
69
|
-
|
|
70
|
-
fixture.detectChanges();
|
|
71
|
-
|
|
72
|
-
expect(mockMatDialog.updateSize).toHaveBeenCalledWith('auto');
|
|
73
|
-
}));
|
|
74
|
-
|
|
75
|
-
it('should close dialog when pressing close', async () => {
|
|
76
|
-
const closeButton = ngMocks.find<IconButtonComponent>('#closeButton', null)?.componentInstance;
|
|
77
|
-
|
|
78
|
-
closeButton.buttonClick.emit();
|
|
79
|
-
|
|
80
|
-
expect(mockMatDialog.close).toHaveBeenCalled();
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should close dialog when pressing ok', async () => {
|
|
84
|
-
const cancelButton = ngMocks.find<RaisedButtonComponent>('#okButton', null)?.componentInstance;
|
|
85
|
-
|
|
86
|
-
cancelButton.buttonClick.emit();
|
|
87
|
-
|
|
88
|
-
expect(mockMatDialog.close).toHaveBeenCalled();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Component, Inject } from '@angular/core';
|
|
2
|
-
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
|
3
|
-
import { DeleteDialogData } from '../delete-dialog/models/delete-dialog-data';
|
|
4
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
-
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
6
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
|
-
import { RaisedButtonComponent } from '../../buttons/raised-button/raised-button.component';
|
|
8
|
-
import { IconButtonComponent } from '../../buttons/icon-button/icon-button.component';
|
|
9
|
-
|
|
10
|
-
@Component({
|
|
11
|
-
selector: 'cauca-error-dialog',
|
|
12
|
-
templateUrl: './error-dialog.component.html',
|
|
13
|
-
styleUrls: ['./error-dialog.component.scss'],
|
|
14
|
-
standalone: true,
|
|
15
|
-
imports: [MatDialogModule, TranslateModule, RaisedButtonComponent, IconButtonComponent]
|
|
16
|
-
})
|
|
17
|
-
export class ErrorDialogComponent {
|
|
18
|
-
public itemName: string = '';
|
|
19
|
-
|
|
20
|
-
public constructor(
|
|
21
|
-
public dialogRef: MatDialogRef<ErrorDialogComponent>,
|
|
22
|
-
@Inject(MAT_DIALOG_DATA) public data: DeleteDialogData,
|
|
23
|
-
breakdownObserver: BreakpointObserver) {
|
|
24
|
-
this.itemName = data.name ? data.name : '';
|
|
25
|
-
dialogRef.addPanelClass("dialog-global-style");
|
|
26
|
-
breakdownObserver.observe('(max-width: 500px)').pipe(takeUntilDestroyed()).subscribe(result => dialogRef.updateSize(result.matches ? '100vw' : 'auto'));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public closeClick(): void {
|
|
30
|
-
this.dialogRef.close();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { ConfirmationResult, DialogService } from './dialog.service';
|
|
4
|
-
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
|
5
|
-
import { AlertDialogComponent } from '../alert-dialog/alert-dialog.component';
|
|
6
|
-
import { of } from 'rxjs';
|
|
7
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
8
|
-
|
|
9
|
-
describe('DialogService', () => {
|
|
10
|
-
let service: DialogService;
|
|
11
|
-
let mockMatDialog: any;
|
|
12
|
-
let mockMatDialogRef: any;
|
|
13
|
-
let translateService: jasmine.SpyObj<any>;
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
mockMatDialog = jasmine.createSpyObj('MatDialog', ['open']);
|
|
17
|
-
mockMatDialogRef = jasmine.createSpyObj('MatDialogRef', ['afterClosed']);
|
|
18
|
-
translateService = jasmine.createSpyObj('TranslateService', ['instant']);
|
|
19
|
-
translateService.instant.and.callFake((key: string) => key);
|
|
20
|
-
|
|
21
|
-
TestBed.configureTestingModule({
|
|
22
|
-
providers: [DialogService,
|
|
23
|
-
{ provide: MatDialog, useValue: mockMatDialog },
|
|
24
|
-
{ provide: TranslateService, useValue: translateService }
|
|
25
|
-
],
|
|
26
|
-
imports: [
|
|
27
|
-
MatDialogModule,
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
service = TestBed.inject(DialogService);
|
|
31
|
-
mockMatDialog.open.and.returnValue(mockMatDialogRef);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
afterEach(() => {
|
|
35
|
-
mockMatDialog.open.calls.reset();
|
|
36
|
-
mockMatDialogRef.afterClosed.calls.reset();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should be created', () => {
|
|
40
|
-
expect(service).toBeTruthy();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should have config with data when showCustomDialog without options', async () => {
|
|
44
|
-
const myData = 'myData';
|
|
45
|
-
mockMatDialogRef.afterClosed.and.returnValue(of({}));
|
|
46
|
-
|
|
47
|
-
await service.showCustomDialog(AlertDialogComponent, myData );
|
|
48
|
-
|
|
49
|
-
expect(mockMatDialog.open).toHaveBeenCalledWith(
|
|
50
|
-
AlertDialogComponent,
|
|
51
|
-
jasmine.objectContaining({ data: myData })
|
|
52
|
-
);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should have config with width and height when showCustomDialog ', async () => {
|
|
56
|
-
const myData = 'myData';
|
|
57
|
-
mockMatDialogRef.afterClosed.and.returnValue(of({}));
|
|
58
|
-
|
|
59
|
-
await service.showCustomDialog(AlertDialogComponent, myData, {width: 10, height:20} );
|
|
60
|
-
|
|
61
|
-
expect(mockMatDialog.open).toHaveBeenCalledWith(
|
|
62
|
-
AlertDialogComponent,
|
|
63
|
-
jasmine.objectContaining({ data: myData, width: 10 , height: 20})
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should should ask user for confirmation', async () => {
|
|
68
|
-
mockMatDialogRef.afterClosed.and.returnValue(of(ConfirmationResult.Yes));
|
|
69
|
-
|
|
70
|
-
await service.askForConfirmation('title', 'message');
|
|
71
|
-
|
|
72
|
-
expect(mockMatDialog.open).toHaveBeenCalledTimes(1);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should returns user answer after confirmation', async () => {
|
|
76
|
-
mockMatDialogRef.afterClosed.and.returnValue(of(ConfirmationResult.Yes));
|
|
77
|
-
|
|
78
|
-
const result = await service.askForConfirmation('title', 'message');
|
|
79
|
-
|
|
80
|
-
expect(result).toBe(ConfirmationResult.Yes);
|
|
81
|
-
});
|
|
82
|
-
});
|