Some checks failed
Deploy Application / deploy (push) Has been cancelled
57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature\Framework\LiveComponents\E2E;
|
|
|
|
use Tests\Feature\Framework\LiveComponents\TestHarness\LiveComponentTestCase;
|
|
|
|
/**
|
|
* E2E Tests for Partial Rendering
|
|
*
|
|
* Tests fragment-based partial updates end-to-end.
|
|
*/
|
|
class PartialRenderingE2ETest extends LiveComponentTestCase
|
|
{
|
|
public function test_updates_single_fragment_via_action(): void
|
|
{
|
|
$this->mount('counter:test', ['count' => 0]);
|
|
|
|
// Call action with fragment request
|
|
$this->call('increment', ['amount' => 5], ['counter-display']);
|
|
|
|
// Should return fragments instead of full HTML
|
|
$html = $this->getHtml();
|
|
$this->assertIsArray($html);
|
|
$this->assertArrayHasKey('counter-display', $html);
|
|
$this->assertStringContainsString('5', $html['counter-display']);
|
|
|
|
// State should be updated
|
|
$this->seeStateKey('count', 5);
|
|
}
|
|
|
|
public function test_updates_multiple_fragments_simultaneously(): void
|
|
{
|
|
// This would require a component with multiple fragments
|
|
$this->markTestSkipped('Requires component with multiple fragments');
|
|
}
|
|
|
|
public function test_falls_back_to_full_render_when_fragments_not_found(): void
|
|
{
|
|
$this->mount('counter:test', ['count' => 0]);
|
|
|
|
// Request non-existent fragment
|
|
$this->call('increment', ['amount' => 5], ['non-existent-fragment']);
|
|
|
|
// Should fall back to full HTML
|
|
$html = $this->getHtml();
|
|
$this->assertIsString($html);
|
|
$this->assertStringContainsString('5', $html);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|