-
-
Notifications
You must be signed in to change notification settings - Fork 205
Description
Is there an existing issue for this?
- I have searched the existing issues
Which Transloco package(s) are the source of the bug?
Transloco
Is this a regression?
No
Current behavior
Unit testing does not fail on unknown components if a parent component includes the *transloco="let t"
structural directive.
Steps to reproduce:
- Create a component that wraps an unknown component (I used
<child>
)within a parent that uses Transloco's structural directive (I used<ng-container *transloco="let t">
. - Unit test the component, using the
{ errorOnUnknownElements: true }
option. - The unit test should fail with
Error: NG0304: 'child' is not a known element (used in the 'Test1Component' component template)
. - To see the test fail, remove the structural directive. Note that there is no need to actually use the
t
function anywhere.
You can also reproduce the bug by cloning the linked example repo, running npm ci
, and then npm run test1
to run a test that fails correctly, or npm run test2
to run a test where Transloco causes it to pass when it should fail like the first one. Note that the main
branch uses Angular 15 because we originally discovered the bug with that version. There is also ng16
branch that implements the same example with Angular 16 and Transloco 6.
Expected behavior
Using errorOnUnknownElements
should throw NG0304 even when wrapped in the Transloco structural directive.
Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.
https://github.com/funidata/ng-unit-test-debug
Transloco Config
No response
Please provide the environment you discovered this bug in
Transloco: 4.2.6 || 6.0.0
Angular: 15.2.9 || 16.2.6
Node: 18.18
Package Manager: npm@9.8.1
OS: macOS 13.5.2
Browser
No response
Additional context
No response
I would like to make a pull request for this bug
No