@@ -2,15 +2,14 @@ import { Component, Type, NgZone, SimpleChange, OnChanges, SimpleChanges } from
2
2
import { ComponentFixture , TestBed } from '@angular/core/testing' ;
3
3
import { By } from '@angular/platform-browser' ;
4
4
import { BrowserAnimationsModule , NoopAnimationsModule } from '@angular/platform-browser/animations' ;
5
- import { Router } from '@angular/router' ;
5
+ import { NavigationExtras , Router } from '@angular/router' ;
6
6
import { RouterTestingModule } from '@angular/router/testing' ;
7
7
import {
8
8
getQueriesForElement as dtlGetQueriesForElement ,
9
9
prettyDOM as dtlPrettyDOM ,
10
10
waitFor as dtlWaitFor ,
11
11
waitForElementToBeRemoved as dtlWaitForElementToBeRemoved ,
12
12
screen as dtlScreen ,
13
- queries as dtlQueries ,
14
13
waitForOptions as dtlWaitForOptions ,
15
14
configure as dtlConfigure ,
16
15
} from '@testing-library/dom' ;
@@ -134,15 +133,19 @@ export async function render<SutType, WrapperType = SutType>(
134
133
const queryParams = params
135
134
? params . split ( '&' ) . reduce ( ( qp , q ) => {
136
135
const [ key , value ] = q . split ( '=' ) ;
136
+ // TODO(Breaking): group same keys qp[key] ? [...qp[key], value] : value
137
137
qp [ key ] = value ;
138
138
return qp ;
139
139
} , { } )
140
140
: undefined ;
141
141
142
- const doNavigate = ( ) =>
143
- router . navigate ( [ path ] , {
144
- queryParams,
145
- } ) ;
142
+ const navigateOptions : NavigationExtras = queryParams
143
+ ? {
144
+ queryParams,
145
+ }
146
+ : undefined ;
147
+
148
+ const doNavigate = ( ) => ( navigateOptions ? router . navigate ( [ path ] , navigateOptions ) : router . navigate ( [ path ] ) ) ;
146
149
147
150
let result ;
148
151
0 commit comments