-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theming): log a warning if core theme isn't loaded (#3781)
* feat(theming): log a warning if core theme isn't loaded * Checks the user's loaded stylesheets and logs a warning if the Material core theme isn't loaded. * Fixes a wrong `typeof` check when determining the doctype. Fixes #2828. Note: I originally went with looping through the `document.styleSheets` to check whether the selector is defined, however I had to switch back to `getComputedStyle`, because browsers don't expose the `document.styleSheets`, if the CSS file is being loaded from another domain. This would've caused the warning to be logged if the user loads over a CDN. * refactor: address feedback
- Loading branch information
1 parent
c4ec662
commit 4282917
Showing
2 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4282917
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started getting this new warning in my tests (using latest material2-builds.git). I have custom theme that imports
@import '~@angular/material/theming';
and it works when I build/serve app, but it messes up my tests. They restart when this warning appears.Update 1
I installed previous version:
and tests are working normally again.
Update 2
I looked into this issue further, turns out there was unique interaction with one of my tests that was causing page reload. After fixing that, tests are interrupted once, then executed normally (with latest material2-builds.git)
4282917
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am seeing this error as well. This is what my karma.conf.js looks like:
And I still get this error, even though when the Chrome browser loads the theme is clearly being applied. I believe there is some sort of timing error going on where the CSS isn't applied in time for this logic to detect the issue.