material2-app
material2-app copied to clipboard
Add Examples for Testing Material UIs
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.
@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