how to test components that use import (dinamic import) inside component ?
AlonsoK28 opened this issue · comments
C Alonso C Ortega commented
you can provide to make the test for components using import
inside a component
? (no router module)
example:
async loadImportXlsx(){
// avoid user throttling
if (this.isLoadingImportXlsx) return;
this.isLoadingImportXlsx = true;
const config: MatDialogConfig = {
width: '85%',
height: '95%',
disableClose: true,
data: {
currentDomain: this.selectedDomain
}
};
// how test this line?
const lazyComponent = await import('@pages/import/import.component');
const dialogRef = this.dialog.open(lazyComponent.ImportComponent, config);
dialogRef
.beforeClosed()
.subscribe(data => this.title.setTitle(this.dashboardTitle));
setTimeout(() => {
this.isLoadingImportXlsx = false;
}, 1300);
}
this code gets a ngModule
using lazy load (with import
) and then open it inside a new Material Dialog