@@ -49,14 +49,14 @@ describe('LiveController query string binding', () => {
49
49
// String
50
50
51
51
// Set value
52
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : 'foo' } ) ;
52
+ test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : 'foo' } ) . willReturnLiveUrl ( '?prop1=foo&prop2=' ) ;
53
53
54
54
await test . component . set ( 'prop1' , 'foo' , true ) ;
55
55
56
56
expectCurrentSearch ( ) . toEqual ( '?prop1=foo&prop2=' ) ;
57
57
58
58
// Remove value
59
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : '' } ) ;
59
+ test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : '' } ) . willReturnLiveUrl ( '?prop1=&prop2=' ) ;
60
60
61
61
await test . component . set ( 'prop1' , '' , true ) ;
62
62
@@ -65,14 +65,14 @@ describe('LiveController query string binding', () => {
65
65
// Number
66
66
67
67
// Set value
68
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop2 : 42 } ) ;
68
+ test . expectsAjaxCall ( ) . expectUpdatedData ( { prop2 : 42 } ) . willReturnLiveUrl ( '?prop1=&prop2=42' ) ;
69
69
70
70
await test . component . set ( 'prop2' , 42 , true ) ;
71
71
72
72
expectCurrentSearch ( ) . toEqual ( '?prop1=&prop2=42' ) ;
73
73
74
74
// Remove value
75
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop2 : null } ) ;
75
+ test . expectsAjaxCall ( ) . expectUpdatedData ( { prop2 : null } ) . willReturnLiveUrl ( '?prop1=&prop2=' ) ;
76
76
77
77
await test . component . set ( 'prop2' , null , true ) ;
78
78
@@ -88,21 +88,25 @@ describe('LiveController query string binding', () => {
88
88
) ;
89
89
90
90
// Set value
91
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : [ 'foo' , 'bar' ] } ) ;
91
+ test . expectsAjaxCall ( )
92
+ . expectUpdatedData ( { prop : [ 'foo' , 'bar' ] } )
93
+ . willReturnLiveUrl ( '?prop[0]=foo&prop[1]=bar' ) ;
92
94
93
95
await test . component . set ( 'prop' , [ 'foo' , 'bar' ] , true ) ;
94
96
95
97
expectCurrentSearch ( ) . toEqual ( '?prop[0]=foo&prop[1]=bar' ) ;
96
98
97
99
// Remove one value
98
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : [ 'foo' ] } ) ;
100
+ test . expectsAjaxCall ( )
101
+ . expectUpdatedData ( { prop : [ 'foo' ] } )
102
+ . willReturnLiveUrl ( '?prop[0]=foo' ) ;
99
103
100
104
await test . component . set ( 'prop' , [ 'foo' ] , true ) ;
101
105
102
106
expectCurrentSearch ( ) . toEqual ( '?prop[0]=foo' ) ;
103
107
104
108
// Remove all remaining values
105
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : [ ] } ) ;
109
+ test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : [ ] } ) . willReturnLiveUrl ( '?prop=' ) ;
106
110
107
111
await test . component . set ( 'prop' , [ ] , true ) ;
108
112
@@ -118,28 +122,34 @@ describe('LiveController query string binding', () => {
118
122
) ;
119
123
120
124
// Set single nested prop
121
- test . expectsAjaxCall ( ) . expectUpdatedData ( { 'prop.foo' : 'dummy' } ) ;
125
+ test . expectsAjaxCall ( ) . expectUpdatedData ( { 'prop.foo' : 'dummy' } ) . willReturnLiveUrl ( '?prop[foo]=dummy' ) ;
122
126
123
127
await test . component . set ( 'prop.foo' , 'dummy' , true ) ;
124
128
125
129
expectCurrentSearch ( ) . toEqual ( '?prop[foo]=dummy' ) ;
126
130
127
131
// Set multiple values
128
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : { foo : 'other' , bar : 42 } } ) ;
132
+ test . expectsAjaxCall ( )
133
+ . expectUpdatedData ( { prop : { foo : 'other' , bar : 42 } } )
134
+ . willReturnLiveUrl ( '?prop[foo]=other&prop[bar]=42' ) ;
129
135
130
136
await test . component . set ( 'prop' , { foo : 'other' , bar : 42 } , true ) ;
131
137
132
138
expectCurrentSearch ( ) . toEqual ( '?prop[foo]=other&prop[bar]=42' ) ;
133
139
134
140
// Remove one value
135
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : { foo : 'other' , bar : null } } ) ;
141
+ test . expectsAjaxCall ( )
142
+ . expectUpdatedData ( { prop : { foo : 'other' , bar : null } } )
143
+ . willReturnLiveUrl ( '?prop[foo]=other' ) ;
136
144
137
145
await test . component . set ( 'prop' , { foo : 'other' , bar : null } , true ) ;
138
146
139
147
expectCurrentSearch ( ) . toEqual ( '?prop[foo]=other' ) ;
140
148
141
149
// Remove all values
142
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop : { foo : null , bar : null } } ) ;
150
+ test . expectsAjaxCall ( )
151
+ . expectUpdatedData ( { prop : { foo : null , bar : null } } )
152
+ . willReturnLiveUrl ( '?prop=' ) ;
143
153
144
154
await test . component . set ( 'prop' , { foo : null , bar : null } , true ) ;
145
155
@@ -161,7 +171,8 @@ describe('LiveController query string binding', () => {
161
171
. expectActionCalled ( 'changeProp' )
162
172
. serverWillChangeProps ( ( data : any ) => {
163
173
data . prop = 'foo' ;
164
- } ) ;
174
+ } )
175
+ . willReturnLiveUrl ( '?prop=foo' ) ;
165
176
166
177
getByText ( test . element , 'Change prop' ) . click ( ) ;
167
178
@@ -179,14 +190,14 @@ describe('LiveController query string binding', () => {
179
190
) ;
180
191
181
192
// Set value
182
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : 'foo' } ) ;
193
+ test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : 'foo' } ) . willReturnLiveUrl ( '?alias1=foo' ) ;
183
194
184
195
await test . component . set ( 'prop1' , 'foo' , true ) ;
185
196
186
197
expectCurrentSearch ( ) . toEqual ( '?alias1=foo' ) ;
187
198
188
199
// Remove value
189
- test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : '' } ) ;
200
+ test . expectsAjaxCall ( ) . expectUpdatedData ( { prop1 : '' } ) . willReturnLiveUrl ( '?alias1=' ) ;
190
201
191
202
await test . component . set ( 'prop1' , '' , true ) ;
192
203
0 commit comments