Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to test components that use import (dinamic import) inside component ? #41

Open
AlonsoK28 opened this issue Nov 14, 2022 · 0 comments

Comments

@AlonsoK28
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant