Time element throws "is not a known element" in Unit Tests
See original GitHub issue🐞 bug report
Affected Package
It happens with unit testing, not entirely sure what package is responsible.
Is this a regression?
No I think it has always been a bug
Description
When using a HTML Time element <time></time>
during ng test
it gives back a warnning because it doesn’t recognize it as an element.
🔬 Minimal Reproduction
Any time element will do, but for example: <time>19-08-2020</time>
. Run a unit test and it will pop up.
🔥 Exception or Error
WARN: ''time' is not a known element:
1. If 'time' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.'
🌍 Your Environment
Angular Version: 9.1.10 but I think it hasn’t been fixed yet.
Anything else relevant?
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time
Workaround is to not use it, use the no_errors_schema or mock the element as if it was Angular.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Angular 2 Karma Test 'component-name' is not a known ...
In the AppComponent, I'm using the nav component in the HTML code. The UI looks fine. No ...
Read more >Angular logs the "not a known element" error as a warning
In Angular 9 and 10 we can notice that the “my-element is not a known element” error is missing when our tests don't...
Read more >How to fix Template parse errors: <component> is not a known ...
A solution for Angular tests when they fail with "Template parse errors: is not a known element"
Read more >NG8001: Unknown HTML element or component
Use the element name in the error to find the file(s) where the element is being used. Check that the name and selector...
Read more >Testing Components with Spectator - Testing Angular
We have already used small element testing helpers. ... The first expectation throws an error in the null case, but TypeScript does not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thx, @vtsiris!
Based on the reproduction, it seems that Angular does indeed recognize the built-in
<time>
element. Since the issue seems to only be related to PhantomJS, which is not actively developed any more (see ariya/phantomjs#15344) and is not one of the browsers officially supported by Angular (see Browser support), I believe this issue can be closed.@Martinspire, feel free to open a new issue (with a runnable reproduction) in case I’ve missed something and this is indeed an Angular issue.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.