Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Examples for Testing Material UIs #32

Open
danapsimer opened this issue Jan 8, 2017 · 1 comment
Open

Add Examples for Testing Material UIs #32

danapsimer opened this issue Jan 8, 2017 · 1 comment

Comments

@danapsimer
Copy link

After adding material elements to my projects, all my tests that test components that utilize material directives failed with "is not a known element" error. Adding an import for "MaterialModule" and adding "MaterialModule" to the test module's "imports" fixes the problem but not for all tests. The app.component.spec.ts fails even with these imports with a DI error looking for something called "Overlay".

Also this fix seems wrong since these are supposed to be unit tests. Shouldn't we have a way to mock it out? I can't seem to find info on mocking the directives defined by the material.

Examples of how to do this properly would be greatly appreciated.

@edemirkan
Copy link

@danapsimer have you checked angular.io documentation about this? https://angular.io/docs/ts/latest/guide/testing.html

Here's a quikck test to verify contents of a html tag...

https://github.com/demirk4n/angular-material-demo/blob/master/src/app/app.component.spec.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants