-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Keeping the MatCheckboxModule with the MockBuilder #222
Comments
Hi @michael-hein, thank you for the report. A nice finding. I'll fix it soon and release a fix. |
I think if you install 1.5.0 it should work. |
hi @satanTime thanks for your quick reply.
|
Thanks for the update, I found the issue and fixed it. I'll update documentation tomorrow, and in the evening or the following day, release a new version. |
Hi @michael-hein, might you verify that the fix works for your project? Also, might I ask you why you want to keep |
Hi @satanTime, thank you for the fix. Why we want to keep them was just the reason we wanted to test when I'm clicking on a checkbox and afterwards the save button that this save action gets dispatched with the right values. So that the formbinding, disabled states and so on works. One of these errors is when keeping the MatCheckboxModule and the Module has multiple Angular-Material-Modules imported, then the error
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
MatCheckboxModule,
MatFormFieldModule,
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
Thanks for your help :) |
Ah, about the declaration thing - my bad, it is About the test, the scenario sounds more like an integration testing, and here |
About the issue with
The problem here is that I think the right way would be to respect But if my component depends on the imported one and I want to keep my component, then 100% the imported one I want to keep until I mock it explicitly. Please let me know what you think about it. Perhaps you have some other cases / ideas in your head. Thanks. |
Good news, at least for this issue I found a solution and it doesn't throw the error anymore. |
Hi again, @michael-hein, might you check the new fix? ng-mocks.zip Please let me know how it works for you. |
I'm glad to hear that :) At first sight I would see it like you, respect With the new fix the
error is fixed. Sadly when I'm using beforeEach(() =>
MockBuilder(AppComponent, AppModule).keep(MatSlideToggleModule)
); @NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
MatCheckboxModule, // <-- without this one it works
MatSlideToggleModule,
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
|
Thanks for the feedback, the implementation allows to change things inside of mocked / kept parent modules, let's see if it was sufficient. Checking the new case, if you meet any other - just post it here. Looks like we are on a straight road to cover all Mat issues. |
For the current code you can use beforeEach(() =>
MockBuilder(AppComponent, AppModule).keep(MatSlideToggleModule).keep(FocusMonitor)
); checking why |
Here we go again, ng-mocks.zip Looking forward to hearing a new issue from you :) |
Hi @satanTime, with this fix, I couldn't find any new issues :) thank you for your time and your fixes. I really appreciate that 👍 |
Glad to hear. Thanks for the reports and research. Feel free to report more if you find uncovered topics and things for the enhancements. I'll release the fixes today. |
## [10.5.2](v10.5.1...v10.5.2) (2020-11-04) ### Bug Fixes * keeping root providers for kept modules ([dc078af](dc078af)), closes [#222](#222) * providing a root service as it is for kept declarations ([e5486e6](e5486e6)), closes [#222](#222) * respecting mock keep switch in nested modules ([2f185fb](2f185fb)) * support of ngOnChanges from OnChanges interface ([820dc94](820dc94))
10.5.2 has been released and contains a fix for the issue. |
Hi,
I ran into an issue when I wanted to keep the MatCheckboxModule with the MockBuilder.
When I use this
then it fails with
when I use it without keeping the MatCheckboxModule the it works
using without the MockBuilder works too
Is there a way to keep "MatCheckboxModule" with the MockBuilder without failing?
It worked with ng-mocks v10.3.0 and starting to fail with 10.4.0 but the error was different
I also created a repo for this one
https://github.com/michael-hein/ng-mocks-mat-checkbox
Thank you :)
The text was updated successfully, but these errors were encountered: