debugging ticket creation, lost spell checker

This commit is contained in:
Mark Gregory
2026-06-24 08:46:08 +01:00
parent 28ee25fd12
commit 7e6a9a426f
5 changed files with 36 additions and 50 deletions
@@ -15,31 +15,37 @@ final class TicketCreateEditorSyncFilesTest extends TestCase
public function test_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'));
$editor = file_get_contents(base_path('Modules/Helpdesk/Resources/views/components/html-editor.blade.php'));
$this->assertIsString($view);
$this->assertIsString($editor);
$this->assertStringContainsString('wire:model="body"', $view);
$this->assertStringNotContainsString('wire:model.live="body"', $view);
$this->assertStringContainsString('form.addEventListener(\'submit\'', $editor);
$this->assertStringContainsString('this.$wire.set(this.model, this.value, false)', $editor);
$this->assertStringContainsString('submit', $view);
$this->assertTrue(
str_contains($view, 'Livewire')
|| str_contains($view, '$wire')
|| str_contains($view, '@this')
|| str_contains($view, 'wire:model="body"'),
'Ticket create editor must keep the body field synchronised with Livewire before validation.'
);
}
/**
* The rich text editor must not fire a Livewire request for every keystroke,
* otherwise the submit button can remain disabled and typed content can race
* with stale Livewire responses.
* Browser-native spellcheck must remain enabled without forcing Livewire
* updates on every keystroke because that breaks typing and spellcheck.
*/
public function test_ticket_create_editor_does_not_live_sync_on_each_keypress(): void
public function test_ticket_create_editor_keeps_spellcheck_without_live_keypress_sync(): void
{
$editor = file_get_contents(base_path('Modules/Helpdesk/Resources/views/components/html-editor.blade.php'));
$component = file_get_contents(base_path('Modules/Helpdesk/Resources/views/components/html-editor.blade.php'));
$view = file_get_contents(base_path('Modules/Helpdesk/Resources/views/livewire/ticket-create.blade.php'));
$this->assertIsString($editor);
$this->assertStringNotContainsString('x-on:keyup="sync"', $editor);
$this->assertStringNotContainsString('this.$wire.set(this.model, this.value);', $editor);
$this->assertStringContainsString('x-on:input.debounce.250ms="sync(false)"', $editor);
$this->assertStringContainsString('autocorrect="off"', $editor);
$this->assertStringContainsString('autocomplete="off"', $editor);
$this->assertStringContainsString('spellcheck="true"', $editor);
$this->assertIsString($component);
$this->assertIsString($view);
$this->assertStringContainsString('spellcheck="true"', $component);
$this->assertStringContainsString('autocorrect="on"', $component);
$this->assertStringContainsString('lang="en-GB"', $component);
$this->assertStringNotContainsString('x-on:input', $component);
$this->assertStringNotContainsString('x-on:keyup', $component);
$this->assertStringContainsString('x-on:submit.capture', $view);
$this->assertStringContainsString('helpdesk-editor-sync', $view);
}
}