[ACA-4503] Fix close all dialogs (#7142)

* [ACA-4503] Fix close all dialogs

* [ci:force] clean unit test file
This commit is contained in:
Pablo Martinez Garcia
2021-07-05 15:18:59 +02:00
committed by GitHub
parent cc8a9f3ca0
commit dab75c51ee
4 changed files with 14 additions and 9 deletions

View File

@@ -195,7 +195,7 @@ describe('ContentNodeDialogService', () => {
beforeEach(() => {
spyOnDialogOpen.and.callFake((_: any, config: any) => {
testContentNodeSelectorComponentData = config.data;
return { componentInstance: {} };
return { componentInstance: {}, afterClosed: () => of(null) };
});
service.openCopyMoveDialog(NodeAction.CHOOSE, fakeNode, '!update');
});

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { MatDialog } from '@angular/material/dialog';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { EventEmitter, Injectable, Output } from '@angular/core';
import { ContentService, ThumbnailService, SitesService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core';
import { Subject, Observable, throwError } from 'rxjs';
@@ -156,7 +156,8 @@ export class ContentNodeDialogService {
select: select
};
this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
const dialogRef = this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
dialogRef.afterClosed().subscribe({ next: () => select.complete() });
return select;
} else {
@@ -195,7 +196,9 @@ export class ContentNodeDialogService {
select: select
};
this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
const dialogRef = this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
dialogRef.afterClosed().subscribe({ next: () => select.complete() });
return select;
}
@@ -220,12 +223,14 @@ export class ContentNodeDialogService {
showFilesInResult
};
this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
const dialogRef = this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
dialogRef.afterClosed().subscribe({ next: () => select.complete() });
return select;
}
private openContentNodeDialog(data: ContentNodeSelectorComponentData, panelClass: string, width: string) {
this.dialog.open(ContentNodeSelectorComponent, {
private openContentNodeDialog(data: ContentNodeSelectorComponentData, panelClass: string, width: string): MatDialogRef<ContentNodeSelectorComponent> {
return this.dialog.open(ContentNodeSelectorComponent, {
data,
panelClass,
width,

View File

@@ -65,7 +65,8 @@ describe('ContentNodeSelectorComponent', () => {
useValue: {
keydownEvents: () => of(null),
backdropClick: () => of(null),
close: jasmine.createSpy('close')
close: jasmine.createSpy('close'),
afterClosed: () => of(null)
}
}
],

View File

@@ -76,7 +76,6 @@ export class ContentNodeSelectorComponent implements OnInit {
}
close() {
this.data.select.complete();
this.dialog.close();
}