Files
WMS/Modules/Helpdesk/Tests/Feature/TicketCreateEditorSyncFilesTest.php
T
Mark Gregory 4ee0b8e604 Validation now runs only when Create Ticket is clicked.
* Removed the live body binding causing premature $commit.
* Details editor still syncs before submit.
* Added duplicate-submit guard.
* Should no longer need clicking Save/Create twice.
* Append-only changelog.
* module.json version 1.9.42.
2026-06-23 11:13:54 +01:00

26 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Modules\Helpdesk\tests\Feature;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
final class TicketCreateEditorSyncFilesTest extends TestCase
{
#[Test]
public function ticket_create_editor_pushes_details_body_to_livewire_before_validation(): void
{
$view = file_get_contents(base_path('Modules/Helpdesk/Resources/views/livewire/ticket-create.blade.php'));
$this->assertIsString($view);
$this->assertStringContainsString('wire:model="body"', $view);
$this->assertStringContainsString("window.Livewire.find(livewireId).set('body', value, false)", $view);
$this->assertStringContainsString("form.addEventListener('submit', syncBody, { capture: true })", $view);
$this->assertStringNotContainsString('wire:model.live="body"', $view);
$this->assertStringContainsString("document.addEventListener('livewire:navigated', initialiseTicketCreateEditor)", $view);
$this->assertStringContainsString("editor.addEventListener('paste', () => window.setTimeout(syncBody, 0))", $view);
}
}