File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ public function ajaxData(array|string $data): static
91
91
$ script = 'function(params) { ' ;
92
92
foreach ($ data as $ key => $ value ) {
93
93
$ value = json_encode ($ value );
94
- $ script .= " params. { $ key} = { $ value} ; " ;
94
+ $ script .= " params. $ key = $ value; " ;
95
95
}
96
96
$ script .= 'return params; } ' ;
97
97
Original file line number Diff line number Diff line change @@ -199,6 +199,18 @@ public function it_can_create_select2_field()
199
199
200
200
$ field ->placeholder ('New Placeholder ' );
201
201
$ this ->assertEquals ('New Placeholder ' , $ field ->opts ['placeholder ' ]['text ' ]);
202
+
203
+ $ field ->ajaxData ('fn ' );
204
+ $ this ->assertEquals ('fn ' , $ field ->opts ['ajax ' ]['data ' ]);
205
+
206
+ $ field ->ajaxData (['foo ' => 'bar ' ]);
207
+ $ this ->assertStringContainsString ('params.foo = "bar" ' , $ field ->opts ['ajax ' ]['data ' ]);;
208
+
209
+ $ field ->ajaxDelay (200 );
210
+ $ this ->assertEquals (200 , $ field ->opts ['ajax ' ]['delay ' ]);;
211
+
212
+ $ field ->ajaxUrl ('/test ' );
213
+ $ this ->assertEquals ('/test ' , $ field ->opts ['ajax ' ]['url ' ]);;
202
214
}
203
215
204
216
/** @test */
You can’t perform that action at this time.
0 commit comments