"Can't bind to 'queryParams' since it isn't a known property of 'a'" despite using createRoutingFactory #486
-
Hi ! I've been using spectator to add tests to one of our existing project and I'm currently stumbling on an error related to <article class="wrapper">
<header>
<nav>
<ul>
<li mat-ripple routerLinkActive="active">
<a routerLink="." [queryParams]="{ pipeline: 'todo' }">
To do
</a>
</li>
<li mat-ripple routerLinkActive="active">
<a routerLink="." [queryParams]="{ pipeline: 'under-review' }">
Under Review
</a>
</li>
<li mat-ripple routerLinkActive="active">
<a routerLink="." [queryParams]="{ pipeline: 'reviewed' }">
Reviewed
</a>
</li>
</ul>
</nav>
</header>
</article> In my tests I am creating it using let spectator: Spectator<ViewComponent>;
const createComponent = createRoutingFactory({
component: ViewComponent,
queryParams: {
pipeline: 'todo',
},
});
beforeEach(() => (spectator = createComponent()));
it('should create', () => {
expect(spectator.component).toBeTruthy();
}); Here is the output I am getting:
So at this point I'm stumped on how to fix those errors, I though about importing "routerTestingModule" as well, but that gave me another error: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I think I found the cause of the issue: queryParams, however, is one of those inputs so this might be need to be turned into an issue ? |
Beta Was this translation helpful? Give feedback.
-
Sure, it'll be great if you can create a PR that adds the missing inputs. |
Beta Was this translation helpful? Give feedback.
I think I found the cause of the issue:
The routerLinkDirective stub doesn't have all the inputs from the official component
https://github.com/ngneat/spectator/blob/master/projects/spectator/src/lib/spectator-routing/router-link-stub.ts
queryParams, however, is one of those inputs
https://github.com/angular/angular/blob/master/packages/router/src/directives/router_link.ts#L19-L243
so this might be need to be turned into an issue ?