-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
missing imports from generated spec files #12778
Comments
Please do. I'd happy to review your Pull Request! |
If someone generates components with Angular Material by using our schematics and runs `ng test` afterwards, the tests will fail because: * The needed Material modules are not being imported * No animation module is specified (either `Noop` or `BrowserAnimationsModule`) * `fakeAsync` is used to run `compileComponents`. `async()` should be used to wait for `compileComponents` (see the default CLI component schematic) Fixes angular#12778
Hey @gatimus, just want to let you know that I've submitted a PR to fix the issue. Since we need to have the schematics working as soon as possible, I've went ahead and created the change myself. I hope you didn't start working on a pull request. Thanks for the issue though! |
If someone generates components with Angular Material by using our schematics and runs `ng test` afterwards, the tests will fail because: * The needed Material modules are not being imported * No animation module is specified (either `Noop` or `BrowserAnimationsModule`) * `fakeAsync` is used to run `compileComponents`. `async()` should be used to wait for `compileComponents` (see the default CLI component schematic) Fixes #12778
@devversion thank you, sorry, I got wrapped up in something else before I saw your comment. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
spec files from schematics fail
What is the expected behavior?
ng test
to work out of the box after onlyng generate
commandsWhat is the current behavior?
ng test
has template errorsWhat are the steps to reproduce?
ng new errors-schema
cd .\errors-schema\
ng add @angular/material
ng generate @angular/material:material-dashboard --name my-dashboard
ng generate @angular/material:material-nav --name my-nav
ng generate @angular/material:material-table --name my-table
ng test
for
my-dashboard
I had to add:imports: [ MatGridListModule, MatMenuModule, MatIconModule, MatCardModule ],
for
my-nav
I had to add:imports: [ NoopAnimationsModule, MatSidenavModule, MatToolbarModule, MatListModule, MatIconModule ],
for
my-table
I had to add:imports: [ NoopAnimationsModule, MatTableModule, MatPaginatorModule, MatSortModule ],
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
I can simply make pull request adding the imports to https://github.com/angular/material2/blob/master/src/lib/schematics/dashboard/files/__path__/__name%40dasherize%40if-flat__/__name%40dasherize__.component.spec.ts if desirable.
The text was updated successfully, but these errors were encountered: