You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
joonashak
changed the title
Bug(scope):
Bug(transloco): Unknown components wrapped within Transloco structural directive do not throw in unit tests
Sep 26, 2023
Is there an existing issue for this?
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:
<child>
)within a parent that uses Transloco's structural directive (I used<ng-container *transloco="let t">
.{ errorOnUnknownElements: true }
option.Error: NG0304: 'child' is not a known element (used in the 'Test1Component' component template)
.t
function anywhere.You can also reproduce the bug by cloning the linked example repo, running
npm ci
, and thennpm run test1
to run a test that fails correctly, ornpm run test2
to run a test where Transloco causes it to pass when it should fail like the first one. Note that themain
branch uses Angular 15 because we originally discovered the bug with that version. There is alsong16
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
Browser
No response
Additional context
No response
I would like to make a pull request for this bug
No
The text was updated successfully, but these errors were encountered: