@@ -49,14 +49,18 @@ describe('LiveController query string binding', () => {
4949 // String
5050
5151 // Set value
52- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : 'foo' } ) ;
52+ test . expectsAjaxCall ( )
53+ . expectUpdatedData ( { prop1 : 'foo' } )
54+ . willReturnLiveUrl ( '?prop1=foo&prop2=' ) ;
5355
5456 await test . component . set ( 'prop1' , 'foo' , true ) ;
5557
5658 expectCurrentSearch ( ) . toEqual ( '?prop1=foo&prop2=' ) ;
5759
5860 // Remove value
59- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : '' } ) ;
61+ test . expectsAjaxCall ( )
62+ . expectUpdatedData ( { prop1 : '' } )
63+ . willReturnLiveUrl ( '?prop1=&prop2=' ) ;
6064
6165 await test . component . set ( 'prop1' , '' , true ) ;
6266
@@ -65,14 +69,18 @@ describe('LiveController query string binding', () => {
6569 // Number
6670
6771 // Set value
68- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop2 : 42 } ) ;
72+ test . expectsAjaxCall ( )
73+ . expectUpdatedData ( { prop2 : 42 } )
74+ . willReturnLiveUrl ( '?prop1=&prop2=42' ) ;
6975
7076 await test . component . set ( 'prop2' , 42 , true ) ;
7177
7278 expectCurrentSearch ( ) . toEqual ( '?prop1=&prop2=42' ) ;
7379
7480 // Remove value
75- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop2 : null } ) ;
81+ test . expectsAjaxCall ( )
82+ . expectUpdatedData ( { prop2 : null } )
83+ . willReturnLiveUrl ( '?prop1=&prop2=' ) ;
7684
7785 await test . component . set ( 'prop2' , null , true ) ;
7886
@@ -88,21 +96,27 @@ describe('LiveController query string binding', () => {
8896 ) ;
8997
9098 // Set value
91- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : [ 'foo' , 'bar' ] } ) ;
99+ test . expectsAjaxCall ( )
100+ . expectUpdatedData ( { prop : [ 'foo' , 'bar' ] } )
101+ . willReturnLiveUrl ( '?prop[0]=foo&prop[1]=bar' ) ;
92102
93103 await test . component . set ( 'prop' , [ 'foo' , 'bar' ] , true ) ;
94104
95105 expectCurrentSearch ( ) . toEqual ( '?prop[0]=foo&prop[1]=bar' ) ;
96106
97107 // Remove one value
98- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : [ 'foo' ] } ) ;
108+ test . expectsAjaxCall ( )
109+ . expectUpdatedData ( { prop : [ 'foo' ] } )
110+ . willReturnLiveUrl ( '?prop[0]=foo' ) ;
99111
100112 await test . component . set ( 'prop' , [ 'foo' ] , true ) ;
101113
102114 expectCurrentSearch ( ) . toEqual ( '?prop[0]=foo' ) ;
103115
104116 // Remove all remaining values
105- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : [ ] } ) ;
117+ test . expectsAjaxCall ( )
118+ . expectUpdatedData ( { prop : [ ] } )
119+ . willReturnLiveUrl ( '?prop=' ) ;
106120
107121 await test . component . set ( 'prop' , [ ] , true ) ;
108122
@@ -118,28 +132,36 @@ describe('LiveController query string binding', () => {
118132 ) ;
119133
120134 // Set single nested prop
121- test . expectsAjaxCall ( ) . expectUpdatedData ( { 'prop.foo' : 'dummy' } ) ;
135+ test . expectsAjaxCall ( )
136+ . expectUpdatedData ( { 'prop.foo' : 'dummy' } )
137+ . willReturnLiveUrl ( '?prop[foo]=dummy' ) ;
122138
123139 await test . component . set ( 'prop.foo' , 'dummy' , true ) ;
124140
125141 expectCurrentSearch ( ) . toEqual ( '?prop[foo]=dummy' ) ;
126142
127143 // Set multiple values
128- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : { foo : 'other' , bar : 42 } } ) ;
144+ test . expectsAjaxCall ( )
145+ . expectUpdatedData ( { prop : { foo : 'other' , bar : 42 } } )
146+ . willReturnLiveUrl ( '?prop[foo]=other&prop[bar]=42' ) ;
129147
130148 await test . component . set ( 'prop' , { foo : 'other' , bar : 42 } , true ) ;
131149
132150 expectCurrentSearch ( ) . toEqual ( '?prop[foo]=other&prop[bar]=42' ) ;
133151
134152 // Remove one value
135- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : { foo : 'other' , bar : null } } ) ;
153+ test . expectsAjaxCall ( )
154+ . expectUpdatedData ( { prop : { foo : 'other' , bar : null } } )
155+ . willReturnLiveUrl ( '?prop[foo]=other' ) ;
136156
137157 await test . component . set ( 'prop' , { foo : 'other' , bar : null } , true ) ;
138158
139159 expectCurrentSearch ( ) . toEqual ( '?prop[foo]=other' ) ;
140160
141161 // Remove all values
142- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : { foo : null , bar : null } } ) ;
162+ test . expectsAjaxCall ( )
163+ . expectUpdatedData ( { prop : { foo : null , bar : null } } )
164+ . willReturnLiveUrl ( '?prop=' ) ;
143165
144166 await test . component . set ( 'prop' , { foo : null , bar : null } , true ) ;
145167
@@ -161,7 +183,8 @@ describe('LiveController query string binding', () => {
161183 . expectActionCalled ( 'changeProp' )
162184 . serverWillChangeProps ( ( data : any ) => {
163185 data . prop = 'foo' ;
164- } ) ;
186+ } )
187+ . willReturnLiveUrl ( '?prop=foo' ) ;
165188
166189 getByText ( test . element , 'Change prop' ) . click ( ) ;
167190
@@ -179,14 +202,18 @@ describe('LiveController query string binding', () => {
179202 ) ;
180203
181204 // Set value
182- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : 'foo' } ) ;
205+ test . expectsAjaxCall ( )
206+ . expectUpdatedData ( { prop1 : 'foo' } )
207+ . willReturnLiveUrl ( '?alias1=foo' ) ;
183208
184209 await test . component . set ( 'prop1' , 'foo' , true ) ;
185210
186211 expectCurrentSearch ( ) . toEqual ( '?alias1=foo' ) ;
187212
188213 // Remove value
189- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : '' } ) ;
214+ test . expectsAjaxCall ( )
215+ . expectUpdatedData ( { prop1 : '' } )
216+ . willReturnLiveUrl ( '?alias1=' ) ;
190217
191218 await test . component . set ( 'prop1' , '' , true ) ;
192219
0 commit comments