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
9191 $ script = 'function(params) { ' ;
9292 foreach ($ data as $ key => $ value ) {
9393 $ value = json_encode ($ value );
94- $ script .= " params. { $ key} = { $ value} ; " ;
94+ $ script .= " params. $ key = $ value; " ;
9595 }
9696 $ script .= 'return params; } ' ;
9797
Original file line number Diff line number Diff line change @@ -199,6 +199,18 @@ public function it_can_create_select2_field()
199199
200200 $ field ->placeholder ('New Placeholder ' );
201201 $ 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 ' ]);;
202214 }
203215
204216 /** @test */
You can’t perform that action at this time.
0 commit comments