@pega/angular-sdk-overrides 0.26.1 → 0.26.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/lib/designSystemExtension/alert/alert.component.html +4 -1
- package/lib/designSystemExtension/alert/alert.component.scss +9 -10
- package/lib/designSystemExtension/alert/alert.component.ts +6 -2
- package/lib/designSystemExtension/field-group/field-group.component.ts +11 -3
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +12 -3
- package/lib/designSystemExtension/operator/operator.component.ts +2 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.html +104 -10
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +141 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +224 -72
- package/lib/field/auto-complete/auto-complete.component.html +46 -5
- package/lib/field/auto-complete/auto-complete.component.scss +92 -0
- package/lib/field/auto-complete/auto-complete.component.ts +349 -22
- package/lib/field/cancel-alert/cancel-alert.component.ts +38 -15
- package/lib/field/check-box/check-box.component.html +3 -1
- package/lib/field/check-box/check-box.component.ts +10 -1
- package/lib/field/currency/currency.component.html +2 -1
- package/lib/field/currency/currency.component.ts +10 -1
- package/lib/field/date/date.component.html +2 -1
- package/lib/field/date/date.component.ts +2 -0
- package/lib/field/date-time/date-time.component.html +2 -1
- package/lib/field/date-time/date-time.component.scss +46 -40
- package/lib/field/date-time/date-time.component.ts +2 -0
- package/lib/field/decimal/decimal.component.html +2 -1
- package/lib/field/decimal/decimal.component.ts +2 -0
- package/lib/field/dropdown/dropdown.component.html +2 -1
- package/lib/field/dropdown/dropdown.component.ts +10 -1
- package/lib/field/email/email.component.html +2 -1
- package/lib/field/email/email.component.ts +2 -2
- package/lib/field/field.base.ts +27 -1
- package/lib/field/group/group.component.html +1 -1
- package/lib/field/group/group.component.ts +1 -3
- package/lib/field/integer/integer.component.html +2 -1
- package/lib/field/integer/integer.component.ts +4 -2
- package/lib/field/location/location.component.html +2 -1
- package/lib/field/location/location.component.ts +3 -1
- package/lib/field/object-reference/object-reference.component.html +1 -1
- package/lib/field/object-reference/object-reference.component.ts +3 -0
- package/lib/field/percentage/percentage.component.html +2 -1
- package/lib/field/percentage/percentage.component.ts +10 -1
- package/lib/field/phone/phone.component.html +2 -1
- package/lib/field/phone/phone.component.ts +2 -1
- package/lib/field/radio-buttons/radio-buttons.component.html +2 -1
- package/lib/field/radio-buttons/radio-buttons.component.ts +10 -1
- package/lib/field/rich-text/rich-text.component.scss +1 -166
- package/lib/field/rich-text/rich-text.component.ts +1 -1
- package/lib/field/semantic-link/semantic-link.component.html +1 -1
- package/lib/field/semantic-link/semantic-link.component.scss +4 -0
- package/lib/field/semantic-link/semantic-link.component.ts +9 -5
- package/lib/field/text-area/text-area.component.html +2 -1
- package/lib/field/text-area/text-area.component.ts +2 -1
- package/lib/field/text-input/text-input.component.html +2 -1
- package/lib/field/text-input/text-input.component.ts +2 -1
- package/lib/field/time/time.component.html +2 -1
- package/lib/field/time/time.component.ts +2 -1
- package/lib/field/url/url.component.html +2 -1
- package/lib/field/url/url.component.ts +2 -1
- package/lib/field/user-reference/user-reference.component.html +4 -2
- package/lib/field/user-reference/user-reference.component.ts +10 -5
- package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
- package/lib/infra/Containers/flow-container/flow-container.component.ts +33 -40
- package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.html +12 -0
- package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.spec.ts +130 -0
- package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.ts +77 -0
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +35 -8
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.spec.ts +24 -11
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +185 -194
- package/lib/infra/Containers/view-container/view-container.component.ts +32 -31
- package/lib/infra/assignment/assignment.component.html +2 -1
- package/lib/infra/assignment/assignment.component.ts +30 -13
- package/lib/infra/defer-load/defer-load.component.ts +6 -3
- package/lib/infra/multi-step/multi-step.component.html +25 -33
- package/lib/infra/multi-step/multi-step.component.scss +48 -0
- package/lib/infra/multi-step/multi-step.component.ts +11 -0
- package/lib/infra/navbar/navbar.component.ts +33 -35
- package/lib/infra/root-container/root-container.component.ts +33 -38
- package/lib/infra/view/view.component.ts +17 -39
- package/lib/template/app-shell/app-shell.component.ts +12 -11
- package/lib/template/base/details-template-base.ts +35 -53
- package/lib/template/case-summary/case-summary.component.ts +15 -1
- package/lib/template/case-view/case-view.component.html +13 -1
- package/lib/template/case-view/case-view.component.spec.ts +119 -10
- package/lib/template/case-view/case-view.component.ts +52 -3
- package/lib/template/data-reference/data-reference.component.ts +27 -18
- package/lib/template/data-reference/search-form/search-form.component.html +1 -1
- package/lib/template/data-reference/search-form/search-form.component.ts +2 -0
- package/lib/template/default-form/default-form.component.html +19 -3
- package/lib/template/default-form/default-form.component.ts +13 -3
- package/lib/template/details/details.component.html +23 -3
- package/lib/template/details/details.component.scss +9 -2
- package/lib/template/details/details.component.ts +3 -32
- package/lib/template/details-narrow-wide/details-narrow-wide.component.html +21 -2
- package/lib/template/details-narrow-wide/details-narrow-wide.component.scss +8 -1
- package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +3 -37
- package/lib/template/details-one-column/details-one-column.component.html +23 -1
- package/lib/template/details-one-column/details-one-column.component.scss +14 -0
- package/lib/template/details-one-column/details-one-column.component.ts +3 -38
- package/lib/template/details-three-column/details-three-column.component.html +21 -2
- package/lib/template/details-three-column/details-three-column.component.scss +8 -1
- package/lib/template/details-three-column/details-three-column.component.ts +3 -46
- package/lib/template/details-two-column/details-two-column.component.html +21 -2
- package/lib/template/details-two-column/details-two-column.component.scss +8 -1
- package/lib/template/details-two-column/details-two-column.component.ts +3 -44
- package/lib/template/details-wide-narrow/details-wide-narrow.component.html +21 -2
- package/lib/template/details-wide-narrow/details-wide-narrow.component.scss +8 -1
- package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +3 -41
- package/lib/template/field-value-list/field-value-list.component.scss +17 -0
- package/lib/template/list-view/list-view.component.ts +39 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.html +13 -1
- package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +96 -11
- package/lib/template/self-service-case-view/self-service-case-view.component.ts +52 -3
- package/lib/template/simple-table-manual/helpers.ts +30 -9
- package/lib/template/simple-table-manual/simple-table-manual.component.html +30 -14
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +4 -0
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +118 -29
- package/lib/template/single-reference-readonly/single-reference-readonly.component.html +1 -1
- package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +2 -2
- package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +4 -4
- package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +18 -20
- package/lib/widget/attachment/AttachmentUtils.ts +18 -10
- package/lib/widget/attachment/attachment.component.html +16 -6
- package/lib/widget/attachment/attachment.component.ts +12 -2
- package/lib/widget/case-history/case-history.component.ts +6 -2
- package/lib/widget/file-utility/file-utility.component.ts +25 -29
- package/lib/widget/todo/todo.component.ts +7 -2
- package/package.json +1 -1
- package/lib/designSystemExtension/material-details/material-details.component.html +0 -40
- package/lib/designSystemExtension/material-details/material-details.component.scss +0 -116
- package/lib/designSystemExtension/material-details/material-details.component.spec.ts +0 -24
- package/lib/designSystemExtension/material-details/material-details.component.ts +0 -31
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +0 -41
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +0 -34
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.spec.ts +0 -22
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +0 -61
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { provideZonelessChangeDetection } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
|
|
4
|
+
import { DataViewActionButtonsComponent } from './data-view-action-buttons.component';
|
|
5
|
+
|
|
6
|
+
const RESOURCE_STATUS = { CREATE: 'CREATE', UPDATE: 'UPDATE', OPEN_FLOW_ACTION: 'OPEN_FLOW_ACTION' };
|
|
7
|
+
const DATA_EVENTS = { DATA_OBJECT_CREATED: 'DataObjectCreated', DATA_OBJECT_UPDATED: 'DataObjectUpdated' };
|
|
8
|
+
|
|
9
|
+
describe('DataViewActionButtonsComponent', () => {
|
|
10
|
+
let component: DataViewActionButtonsComponent;
|
|
11
|
+
let fixture: ComponentFixture<DataViewActionButtonsComponent>;
|
|
12
|
+
let actionsApi: {
|
|
13
|
+
createDataObject: jasmine.Spy;
|
|
14
|
+
updateDataObject: jasmine.Spy;
|
|
15
|
+
submitDataObjectAction: jasmine.Spy;
|
|
16
|
+
cancelDataObject: jasmine.Spy;
|
|
17
|
+
};
|
|
18
|
+
let publishSpy: jasmine.Spy;
|
|
19
|
+
|
|
20
|
+
beforeEach(async () => {
|
|
21
|
+
publishSpy = jasmine.createSpy('publish');
|
|
22
|
+
// PCore is read in a field initializer, so it must exist before the component is created.
|
|
23
|
+
(globalThis as any).PCore = {
|
|
24
|
+
getLocaleUtils: () => ({ getLocaleValue: (value: string) => value }),
|
|
25
|
+
getConstants: () => ({ RESOURCE_STATUS, PUB_SUB_EVENTS: { DATA_EVENTS } }),
|
|
26
|
+
getPubSubUtils: () => ({ publish: publishSpy })
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
await TestBed.configureTestingModule({
|
|
30
|
+
imports: [DataViewActionButtonsComponent],
|
|
31
|
+
providers: [provideZonelessChangeDetection()]
|
|
32
|
+
}).compileComponents();
|
|
33
|
+
|
|
34
|
+
fixture = TestBed.createComponent(DataViewActionButtonsComponent);
|
|
35
|
+
component = fixture.componentInstance;
|
|
36
|
+
|
|
37
|
+
actionsApi = {
|
|
38
|
+
createDataObject: jasmine.createSpy('createDataObject').and.returnValue(Promise.resolve()),
|
|
39
|
+
updateDataObject: jasmine.createSpy('updateDataObject').and.returnValue(Promise.resolve()),
|
|
40
|
+
submitDataObjectAction: jasmine.createSpy('submitDataObjectAction').and.returnValue(Promise.resolve()),
|
|
41
|
+
cancelDataObject: jasmine.createSpy('cancelDataObject').and.returnValue({})
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
component.pConn$ = { getActionsApi: () => actionsApi } as any;
|
|
45
|
+
component.context$ = 'app/modal_1';
|
|
46
|
+
component.dataRecordKeys$ = '{"pyGUID":"abc-123"}';
|
|
47
|
+
component.classID$ = 'My-Data-Class';
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should create', () => {
|
|
51
|
+
expect(component).toBeTruthy();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('labels the primary button "Update" when editing an existing record', () => {
|
|
55
|
+
component.dataObjectAction$ = RESOURCE_STATUS.UPDATE;
|
|
56
|
+
expect(component.primaryLabel$).toBe('Update');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('labels the primary button "Submit" when creating a record', () => {
|
|
60
|
+
component.dataObjectAction$ = RESOURCE_STATUS.CREATE;
|
|
61
|
+
expect(component.primaryLabel$).toBe('Submit');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('labels the primary button "Submit" for a record action', () => {
|
|
65
|
+
component.dataObjectAction$ = RESOURCE_STATUS.OPEN_FLOW_ACTION;
|
|
66
|
+
expect(component.primaryLabel$).toBe('Submit');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('creates the record and publishes the created event', async () => {
|
|
70
|
+
component.dataObjectAction$ = RESOURCE_STATUS.CREATE;
|
|
71
|
+
|
|
72
|
+
component.onSubmit();
|
|
73
|
+
await fixture.whenStable();
|
|
74
|
+
|
|
75
|
+
expect(actionsApi.createDataObject).toHaveBeenCalledWith('app/modal_1');
|
|
76
|
+
expect(publishSpy).toHaveBeenCalledWith(DATA_EVENTS.DATA_OBJECT_CREATED, { classId: 'My-Data-Class', data: undefined });
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('parses the serialised record keys before updating', async () => {
|
|
80
|
+
component.dataObjectAction$ = RESOURCE_STATUS.UPDATE;
|
|
81
|
+
|
|
82
|
+
component.onSubmit();
|
|
83
|
+
await fixture.whenStable();
|
|
84
|
+
|
|
85
|
+
expect(actionsApi.updateDataObject).toHaveBeenCalledWith('app/modal_1', { pyGUID: 'abc-123' });
|
|
86
|
+
expect(publishSpy).toHaveBeenCalledWith(DATA_EVENTS.DATA_OBJECT_UPDATED, { classId: 'My-Data-Class' });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('submits a record action with its parsed keys and action ID', async () => {
|
|
90
|
+
component.dataObjectAction$ = RESOURCE_STATUS.OPEN_FLOW_ACTION;
|
|
91
|
+
component.actionID$ = 'updateCVV';
|
|
92
|
+
|
|
93
|
+
component.onSubmit();
|
|
94
|
+
await fixture.whenStable();
|
|
95
|
+
|
|
96
|
+
expect(actionsApi.submitDataObjectAction).toHaveBeenCalledWith('app/modal_1', { pyGUID: 'abc-123' }, 'updateCVV');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('disables both buttons while a save is in flight', () => {
|
|
100
|
+
let resolveSave: () => void = () => {};
|
|
101
|
+
actionsApi.createDataObject.and.returnValue(
|
|
102
|
+
new Promise<void>(resolve => {
|
|
103
|
+
resolveSave = resolve;
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
component.dataObjectAction$ = RESOURCE_STATUS.CREATE;
|
|
107
|
+
|
|
108
|
+
component.onSubmit();
|
|
109
|
+
|
|
110
|
+
expect(component.bDisabled$).toBeTrue();
|
|
111
|
+
resolveSave();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('re-enables the buttons and publishes nothing when the save is rejected', async () => {
|
|
115
|
+
actionsApi.createDataObject.and.returnValue(Promise.reject(new Error('rejected')));
|
|
116
|
+
component.dataObjectAction$ = RESOURCE_STATUS.CREATE;
|
|
117
|
+
|
|
118
|
+
component.onSubmit();
|
|
119
|
+
await fixture.whenStable();
|
|
120
|
+
|
|
121
|
+
expect(publishSpy).not.toHaveBeenCalled();
|
|
122
|
+
expect(component.bDisabled$).toBeFalse();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('discards the edit through the engine on cancel', () => {
|
|
126
|
+
component.onCancel();
|
|
127
|
+
|
|
128
|
+
expect(actionsApi.cancelDataObject).toHaveBeenCalledWith('app/modal_1');
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { ChangeDetectorRef, Component, Input } from '@angular/core';
|
|
3
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
4
|
+
import { MatGridListModule } from '@angular/material/grid-list';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-data-view-action-buttons',
|
|
8
|
+
templateUrl: './data-view-action-buttons.component.html',
|
|
9
|
+
imports: [CommonModule, MatGridListModule, MatButtonModule]
|
|
10
|
+
})
|
|
11
|
+
export class DataViewActionButtonsComponent {
|
|
12
|
+
@Input() pConn$: typeof PConnect;
|
|
13
|
+
@Input() context$: string;
|
|
14
|
+
@Input() dataObjectAction$: string;
|
|
15
|
+
@Input() actionID$ = '';
|
|
16
|
+
// The container item publishes the record keys JSON-serialised.
|
|
17
|
+
@Input() dataRecordKeys$ = '';
|
|
18
|
+
@Input() classID$ = '';
|
|
19
|
+
|
|
20
|
+
localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
21
|
+
localeCategory = 'Data Object';
|
|
22
|
+
bDisabled$ = false;
|
|
23
|
+
|
|
24
|
+
constructor(private cdRef: ChangeDetectorRef) {}
|
|
25
|
+
|
|
26
|
+
get primaryLabel$(): string {
|
|
27
|
+
return this.dataObjectAction$ === PCore.getConstants().RESOURCE_STATUS.UPDATE ? 'Update' : 'Submit';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
onCancel() {
|
|
31
|
+
// The engine drops the container item, which collapses the modal.
|
|
32
|
+
this.pConn$.getActionsApi().cancelDataObject(this.context$);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onSubmit() {
|
|
36
|
+
const { RESOURCE_STATUS, PUB_SUB_EVENTS } = PCore.getConstants();
|
|
37
|
+
const { DATA_OBJECT_CREATED, DATA_OBJECT_UPDATED } = PUB_SUB_EVENTS.DATA_EVENTS;
|
|
38
|
+
const actionsApi = this.pConn$.getActionsApi();
|
|
39
|
+
const { publish } = PCore.getPubSubUtils();
|
|
40
|
+
|
|
41
|
+
let submitAction: Promise<any>;
|
|
42
|
+
let publishCompleted: (data?: any) => void;
|
|
43
|
+
|
|
44
|
+
switch (this.dataObjectAction$) {
|
|
45
|
+
case RESOURCE_STATUS.UPDATE:
|
|
46
|
+
submitAction = actionsApi.updateDataObject(this.context$, this.getRecordKeys());
|
|
47
|
+
publishCompleted = () => publish(DATA_OBJECT_UPDATED, { classId: this.classID$ });
|
|
48
|
+
break;
|
|
49
|
+
case RESOURCE_STATUS.OPEN_FLOW_ACTION:
|
|
50
|
+
submitAction = actionsApi.submitDataObjectAction(this.context$, this.getRecordKeys(), this.actionID$);
|
|
51
|
+
publishCompleted = () => publish(DATA_OBJECT_UPDATED, { classId: this.classID$, actionID: this.actionID$ });
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
submitAction = actionsApi.createDataObject(this.context$);
|
|
55
|
+
publishCompleted = data => publish(DATA_OBJECT_CREATED, { classId: this.classID$, data });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.bDisabled$ = true;
|
|
59
|
+
|
|
60
|
+
submitAction
|
|
61
|
+
.then(data => {
|
|
62
|
+
publishCompleted(data);
|
|
63
|
+
})
|
|
64
|
+
.catch(() => {
|
|
65
|
+
// Keep the modal open so the server error banner is visible and the edit can be corrected.
|
|
66
|
+
})
|
|
67
|
+
.finally(() => {
|
|
68
|
+
this.bDisabled$ = false;
|
|
69
|
+
// Change detection is zoneless, so this async reset needs to be flagged explicitly.
|
|
70
|
+
this.cdRef.markForCheck();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private getRecordKeys(): Record<string, any> {
|
|
75
|
+
return this.dataRecordKeys$ ? JSON.parse(this.dataRecordKeys$) : {};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -1,15 +1,36 @@
|
|
|
1
|
-
<div
|
|
2
|
-
<div class="psdk-modal-view-container-top" id="{{
|
|
3
|
-
<h3 *ngIf="title
|
|
1
|
+
<div *ngFor="let modal of modalStack; trackBy: trackByModalKey" id="dialog" class="psdk-dialog-background">
|
|
2
|
+
<div class="psdk-modal-view-container-top" id="{{ modal.key }}">
|
|
3
|
+
<h3 *ngIf="modal.title != ''">{{ modal.title }}</h3>
|
|
4
4
|
<component-mapper
|
|
5
5
|
name="Assignment"
|
|
6
|
-
[props]="{
|
|
6
|
+
[props]="{
|
|
7
|
+
pConn$: modal.createdViewPConn$,
|
|
8
|
+
formGroup$,
|
|
9
|
+
arChildren$: modal.arChildren$,
|
|
10
|
+
itemKey$: modal.key,
|
|
11
|
+
isCreateStage$: true,
|
|
12
|
+
updateToken$: modal.updateToken,
|
|
13
|
+
isInModal$: true
|
|
14
|
+
}"
|
|
7
15
|
></component-mapper>
|
|
8
|
-
<div *ngIf="
|
|
16
|
+
<div *ngIf="modal.isMultiRecordData">
|
|
9
17
|
<component-mapper
|
|
10
18
|
name="ListViewActionButtons"
|
|
11
|
-
[props]="{ pConn$: createdViewPConn$, context
|
|
12
|
-
[outputEvents]="{ closeActionsDialog:
|
|
19
|
+
[props]="{ pConn$: modal.createdViewPConn$, context$: modal.context }"
|
|
20
|
+
[outputEvents]="{ closeActionsDialog: closeModalFor(modal.key) }"
|
|
21
|
+
></component-mapper>
|
|
22
|
+
</div>
|
|
23
|
+
<div *ngIf="modal.isDataObjectModal">
|
|
24
|
+
<component-mapper
|
|
25
|
+
name="DataViewActionButtons"
|
|
26
|
+
[props]="{
|
|
27
|
+
pConn$: modal.createdViewPConn$,
|
|
28
|
+
context$: modal.context,
|
|
29
|
+
classID$: modal.dataObjectClassId,
|
|
30
|
+
dataObjectAction$: modal.dataObjectAction,
|
|
31
|
+
dataRecordKeys$: modal.dataRecordKeys,
|
|
32
|
+
actionID$: modal.dataObjectActionID
|
|
33
|
+
}"
|
|
13
34
|
></component-mapper>
|
|
14
35
|
</div>
|
|
15
36
|
</div>
|
|
@@ -18,7 +39,13 @@
|
|
|
18
39
|
<div *ngIf="bShowCancelAlert$">
|
|
19
40
|
<component-mapper
|
|
20
41
|
name="CancelAlert"
|
|
21
|
-
[props]="{
|
|
42
|
+
[props]="{
|
|
43
|
+
bShowAlert$: bShowCancelAlert$,
|
|
44
|
+
pConn$: cancelPConn$,
|
|
45
|
+
hideDelete: cancelHideDelete$,
|
|
46
|
+
isDataObject: cancelIsDataObject$,
|
|
47
|
+
skipReleaseLockRequest: cancelSkipReleaseLockRequest$
|
|
48
|
+
}"
|
|
22
49
|
[parent]="this"
|
|
23
50
|
[outputEvents]="{ onAlertState$: onAlertState }"
|
|
24
51
|
></component-mapper>
|
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { FormBuilder } from '@angular/forms';
|
|
2
3
|
|
|
3
4
|
import { ModalViewContainerComponent } from './modal-view-container.component';
|
|
5
|
+
import { BannerService } from '@pega/angular-sdk-components';
|
|
4
6
|
|
|
5
7
|
describe('ModalViewContainerComponent', () => {
|
|
6
8
|
let component: ModalViewContainerComponent;
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
beforeEach(waitForAsync(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ModalViewContainerComponent]
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
}));
|
|
9
|
+
let markForCheckSpy: jasmine.Spy;
|
|
10
|
+
let clearBannersSpy: jasmine.Spy;
|
|
14
11
|
|
|
15
12
|
beforeEach(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
(globalThis as any).PCore = {
|
|
14
|
+
getConstants: () => ({ PAGE: 'PAGE' })
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
markForCheckSpy = jasmine.createSpy('markForCheck');
|
|
18
|
+
const cdRef = { markForCheck: markForCheckSpy } as unknown as ChangeDetectorRef;
|
|
19
|
+
clearBannersSpy = jasmine.createSpy('clearBanners');
|
|
20
|
+
const bannerService = { clearBanners: clearBannersSpy } as unknown as BannerService;
|
|
21
|
+
|
|
22
|
+
component = new ModalViewContainerComponent({} as any, cdRef, {} as any, new FormBuilder(), bannerService);
|
|
23
|
+
component.pConn$ = { getStateProps: () => ({}) } as any;
|
|
24
|
+
component.stateProps$ = {};
|
|
19
25
|
});
|
|
20
26
|
|
|
21
27
|
it('should create', () => {
|
|
22
28
|
expect(component).toBeTruthy();
|
|
23
29
|
});
|
|
30
|
+
|
|
31
|
+
it('clears banners for the closed modal', () => {
|
|
32
|
+
component.closeActionsDialog('app/modal_1');
|
|
33
|
+
|
|
34
|
+
expect(clearBannersSpy).toHaveBeenCalledWith('app/modal_1');
|
|
35
|
+
expect(markForCheckSpy).toHaveBeenCalled();
|
|
36
|
+
});
|
|
24
37
|
});
|