File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -176,4 +176,32 @@ function ($row) {
176176 $ this ->assertSame ('#008000 ' , $ column ->getColor ($ rows ->slice (2 , 1 )->first ()));
177177
178178 }
179+
180+ public function test_can_get_column_get_contents_from_color (): void
181+ {
182+ $ column = ColorColumn::make ('Species Color ' )->color (
183+ function ($ row ) {
184+ if ($ row ->species_id == 1 ) {
185+ return '#ff0000 ' ;
186+ } elseif ($ row ->species_id == 2 ) {
187+ return '#008000 ' ;
188+ } else {
189+ return '#ffa500 ' ;
190+ }
191+
192+ }
193+ );
194+ $ rows = $ this ->basicTable ->setAdditionalSelects (['pets.species_id as species_id ' ])->getRows ();
195+
196+ $ contents1 = $ column ->getContents ($ rows ->first ());
197+ $ this ->assertSame ($ contents1 ['color ' ], '#ff0000 ' );
198+ $ this ->assertSame ($ contents1 ['isTailwind ' ], true );
199+ $ this ->assertSame ($ contents1 ['isBootstrap ' ], false );
200+
201+ $ contents2 = $ column ->getContents ($ rows ->last ());
202+ $ this ->assertSame ($ contents2 ['color ' ], '#ffa500 ' );
203+ $ this ->assertSame ($ contents2 ['isTailwind ' ], true );
204+ $ this ->assertSame ($ contents2 ['isBootstrap ' ], false );
205+
206+ }
179207}
You can’t perform that action at this time.
0 commit comments