-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Issue with MatTable using MatSort #568
Comments
Hi @Dji75, thanks for the report. I would assume that in Do you know which property is I would suggest to use it('asadfsadf', () => {
MockInstance(MatSort, 'streamPropWeNeedToStub$', EMPTY);
const fixture = MockRender(CompoenntWithMatSort);
}); or in ngMocks.defaultMock(MatSort, () => ({
streamPropWeNeedToStub: EMPTY,
})); |
It was ngMocks.defaultMock(MatSort, () => ({
initialized: EMPTY,
})); |
It seems all material components which implements |
Right, this is the biggest downside of mocks in my option. Even more, it is not always possible to detect all the properties a js class has. Thanks God, that a class prototype has all methods at least. That's why Maybe we can do a kind of preset for well known libraries and their declarations so |
I think for now I could extend ngMocks.defaultMock([MatSort, MatResort, MatCurort], () => ({
initialized: EMPTY,
})); Would it help? what are you thoughts on that? |
It's always a good idea to mutualize code wherever it make sense, and this is the case here. Looks good for me ! 👍 |
Hi @Dji75, thanks for the feedback. I'm releasing these changes, they will be published the next hour. The next step for me is to solve the issue you mentioned in another ticket, regarding store. Would be nice if you could find time to provide an example there. Thank you in advance and happy coding! |
v12.0.1 has been released and contains a fix for the issue. Feel free to reopen the issue or to submit a new one if you meet any problems. |
I have a problem with ngMocks, MatTableModule and MatSortModule.
If I have the mat-table sort initialization in the
ngOnInit
(orngAfterViewInit
, like Angular Material documents), I've got the following error:Component's code:
If I move the sort initialization in the constructor, it works.
I can use my init in the constructor but on my point of view, it would also work if initialization is present in ngOnInit, right ?
The text was updated successfully, but these errors were encountered: