mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-4422] Resolved - Edit Aspects Dialog should close when pressing ESC (#7022)
* [ACA-4422] Resolved - Edit Aspects Dialog should close when pressing ESC * [ACA-4422] Fixed unit test failure * [ACA-4422] Resolved unit test errors
This commit is contained in:
@@ -94,6 +94,10 @@ describe('AspectListDialogComponent', () => {
|
|||||||
let aspectListService: AspectListService;
|
let aspectListService: AspectListService;
|
||||||
let nodeService: NodesApiService;
|
let nodeService: NodesApiService;
|
||||||
let data: AspectListDialogComponentData;
|
let data: AspectListDialogComponentData;
|
||||||
|
const event = new KeyboardEvent('keydown', {
|
||||||
|
bubbles: true,
|
||||||
|
keyCode: 27
|
||||||
|
} as KeyboardEventInit );
|
||||||
|
|
||||||
describe('Without passing node id', () => {
|
describe('Without passing node id', () => {
|
||||||
|
|
||||||
@@ -116,7 +120,7 @@ describe('AspectListDialogComponent', () => {
|
|||||||
{
|
{
|
||||||
provide: MatDialogRef,
|
provide: MatDialogRef,
|
||||||
useValue: {
|
useValue: {
|
||||||
keydownEvents: () => of(null),
|
keydownEvents: () => of(event),
|
||||||
backdropClick: () => of(null),
|
backdropClick: () => of(null),
|
||||||
close: jasmine.createSpy('close')
|
close: jasmine.createSpy('close')
|
||||||
}
|
}
|
||||||
@@ -255,7 +259,7 @@ describe('AspectListDialogComponent', () => {
|
|||||||
provide: MatDialogRef,
|
provide: MatDialogRef,
|
||||||
useValue: {
|
useValue: {
|
||||||
close: jasmine.createSpy('close'),
|
close: jasmine.createSpy('close'),
|
||||||
keydownEvents: () => of(null),
|
keydownEvents: () => of(event),
|
||||||
backdropClick: () => of(null)
|
backdropClick: () => of(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,6 +45,14 @@ export class AspectListDialogComponent implements OnInit {
|
|||||||
this.dialog.backdropClick().subscribe(() => {
|
this.dialog.backdropClick().subscribe(() => {
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
|
this.dialog.keydownEvents().subscribe(event => {
|
||||||
|
// Esc
|
||||||
|
if (event.keyCode === 27) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onValueChanged(aspectList: string[]) {
|
onValueChanged(aspectList: string[]) {
|
||||||
|
Reference in New Issue
Block a user