question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gkalpakcommented, Oct 15, 2020

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.

0reactions
angular-automatic-lock-bot[bot]commented, Nov 15, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found