File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ <x-test-layout >
2+ <x-slot name = " icon" >
3+ <x-icon name = " ph:eye" class = " size-5" />
4+ </x-slot >
5+ Test
6+ </x-test-layout >
Original file line number Diff line number Diff line change 1414use Tempest \View \IconConfig ;
1515use Tests \Tempest \Integration \FrameworkIntegrationTestCase ;
1616
17+ use function Tempest \view ;
18+
1719final class IconComponentTest extends FrameworkIntegrationTestCase
1820{
1921 protected function setUp (): void
@@ -183,4 +185,26 @@ public function test_with_dynamic_data(): void
183185 $ rendered ,
184186 );
185187 }
188+
189+ public function test_icon_renders_inside_named_slot_in_a_layout (): void
190+ {
191+ $ this ->registerViewComponent ('x-test-layout ' , '<x-index><div><x-slot name="icon" /></div><x-slot /></x-index> ' );
192+
193+ $ mockHttpClient = $ this ->createMock (HttpClient::class);
194+ $ mockHttpClient
195+ ->expects ($ this ->exactly (1 ))
196+ ->method ('get ' )
197+ ->with ('https://api.iconify.design/ph/eye.svg ' )
198+ ->willReturn (new GenericResponse (status: Status::OK , body: '<svg></svg> ' ));
199+
200+ $ this ->container ->register (HttpClient::class, fn () => $ mockHttpClient );
201+
202+ $ view = view (__DIR__ . '/../../Fixtures/Views/view-with-icon-inside-named-slot.view.php ' );
203+ $ html = $ this ->render ($ view );
204+
205+ $ this ->assertSame (
206+ '<html lang="en"><head><title></title></head><body><div><svg class="size-5"></svg></div>Test</body></html> ' ,
207+ $ html ,
208+ );
209+ }
186210}
You can’t perform that action at this time.
0 commit comments