diff --git a/resources/views/components/tabs.blade.php b/resources/views/components/tabs.blade.php index f65c92ff..c14ae8ff 100644 --- a/resources/views/components/tabs.blade.php +++ b/resources/views/components/tabs.blade.php @@ -42,7 +42,7 @@
toMatch('/id="[^"]+-people-panel"(?![^>]*style="display: none")/'); }); +it('tells the server at once only when the caller asked with wire:model.live', function () { + Livewire::component('tabs-deferred-probe', new class extends Component + { + public string $tab = 'files'; + + public function render(): string + { + return '
'; + } + }); + + Livewire::component('tabs-live-probe', new class extends Component + { + public string $tab = 'files'; + + public function render(): string + { + return '
'; + } + }); + + // @entangle appends `.live` itself for `wire:model.live`; the view adds nothing of its own, so a + // deferred `wire:model` stays deferred. + $live = Livewire::test('tabs-live-probe')->html(); + + expect(Livewire::test('tabs-deferred-probe')->html())->toContain(".entangle('tab')")->not->toContain(".entangle('tab').live") + ->and(substr_count($live, ".entangle('tab').live"))->toBe(1) + ->and($live)->not->toContain('.live.live'); +}); + it('keeps the tab bar on M3\'s offsets, indicator inset and focus ring', function () { $css = ComponentStylesheet::read('tabs');