[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(() => { beforeEach(() => {
spyOnDialogOpen.and.callFake((_: any, config: any) => { spyOnDialogOpen.and.callFake((_: any, config: any) => {
testContentNodeSelectorComponentData = config.data; testContentNodeSelectorComponentData = config.data;
return { componentInstance: {} }; return { componentInstance: {}, afterClosed: () => of(null) };
}); });
service.openCopyMoveDialog(NodeAction.CHOOSE, fakeNode, '!update'); service.openCopyMoveDialog(NodeAction.CHOOSE, fakeNode, '!update');
}); });

View File

@@ -15,7 +15,7 @@
* limitations under the License. * 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 { EventEmitter, Injectable, Output } from '@angular/core';
import { ContentService, ThumbnailService, SitesService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core'; import { ContentService, ThumbnailService, SitesService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core';
import { Subject, Observable, throwError } from 'rxjs'; import { Subject, Observable, throwError } from 'rxjs';
@@ -156,7 +156,8 @@ export class ContentNodeDialogService {
select: select 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; return select;
} else { } else {
@@ -195,7 +196,9 @@ export class ContentNodeDialogService {
select: select 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; return select;
} }
@@ -220,12 +223,14 @@ export class ContentNodeDialogService {
showFilesInResult 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; return select;
} }
private openContentNodeDialog(data: ContentNodeSelectorComponentData, panelClass: string, width: string) { private openContentNodeDialog(data: ContentNodeSelectorComponentData, panelClass: string, width: string): MatDialogRef<ContentNodeSelectorComponent> {
this.dialog.open(ContentNodeSelectorComponent, { return this.dialog.open(ContentNodeSelectorComponent, {
data, data,
panelClass, panelClass,
width, width,

View File

@@ -65,7 +65,8 @@ describe('ContentNodeSelectorComponent', () => {
useValue: { useValue: {
keydownEvents: () => of(null), keydownEvents: () => of(null),
backdropClick: () => 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() { close() {
this.data.select.complete();
this.dialog.close(); this.dialog.close();
} }