From f370eae41d6327629735ef80b4c8e3abd97b7cf7 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Wed, 22 Nov 2023 16:59:35 +0100 Subject: [PATCH] test: reproduce #422 --- package.json | 20 ++++++------- projects/testing-library/.eslintrc.json | 10 ++++++- .../issue-422-view-already-destroyed.spec.ts | 28 +++++++++++++++++++ 3 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 projects/testing-library/tests/issues/issue-422-view-already-destroyed.spec.ts diff --git a/package.json b/package.json index d8aa9a8..c627ebe 100644 --- a/package.json +++ b/package.json @@ -28,15 +28,15 @@ "prepare": "git config core.hookspath .githooks" }, "dependencies": { - "@angular/animations": "17.0.2", + "@angular/animations": "17.0.3", "@angular/cdk": "17.0.0", - "@angular/common": "17.0.2", - "@angular/compiler": "17.0.2", - "@angular/core": "17.0.2", + "@angular/common": "17.0.3", + "@angular/compiler": "17.0.3", + "@angular/core": "17.0.3", "@angular/material": "17.0.0", - "@angular/platform-browser": "17.0.2", - "@angular/platform-browser-dynamic": "17.0.2", - "@angular/router": "17.0.2", + "@angular/platform-browser": "17.0.3", + "@angular/platform-browser-dynamic": "17.0.3", + "@angular/router": "17.0.3", "@ngrx/store": "17.0.0-rc.0", "@nx/angular": "17.1.1", "@testing-library/dom": "^9.0.0", @@ -54,9 +54,9 @@ "@angular-eslint/schematics": "17.0.1", "@angular-eslint/template-parser": "17.0.1", "@angular/cli": "~17.0.0", - "@angular/compiler-cli": "17.0.2", - "@angular/forms": "17.0.2", - "@angular/language-service": "17.0.2", + "@angular/compiler-cli": "17.0.3", + "@angular/forms": "17.0.3", + "@angular/language-service": "17.0.3", "@nx/eslint-plugin": "17.1.1", "@nx/jest": "17.1.1", "@nx/node": "17.1.1", diff --git a/projects/testing-library/.eslintrc.json b/projects/testing-library/.eslintrc.json index a3f4c7c..5a9d690 100644 --- a/projects/testing-library/.eslintrc.json +++ b/projects/testing-library/.eslintrc.json @@ -5,7 +5,15 @@ { "files": ["*.ts"], "rules": { - "@typescript-eslint/ban-ts-comment": "off" + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" + } + ] } }, { diff --git a/projects/testing-library/tests/issues/issue-422-view-already-destroyed.spec.ts b/projects/testing-library/tests/issues/issue-422-view-already-destroyed.spec.ts new file mode 100644 index 0000000..05e6e11 --- /dev/null +++ b/projects/testing-library/tests/issues/issue-422-view-already-destroyed.spec.ts @@ -0,0 +1,28 @@ +import { Component, ElementRef } from '@angular/core'; +import { NgIf } from '@angular/common'; +import { render } from '../../src/public_api'; + +test('declaration specific dependencies should be available for components', async () => { + @Component({ + selector: 'atl-test', + standalone: true, + template: `<div>Test</div>`, + }) + class TestComponent { + constructor(_elementRef: ElementRef) {} + } + + await expect(async () => await render(TestComponent)).not.toThrow(); +}); + +test('standalone directives imported in standalone components', async () => { + @Component({ + selector: 'atl-test', + standalone: true, + imports: [NgIf], + template: `<div *ngIf="true">Test</div>`, + }) + class TestComponent {} + + await render(TestComponent); +});