52 lines
2.4 KiB
PHP
52 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Helpdesk\Tests\Feature;
|
|
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* Guards browser-native spellcheck wiring on Helpdesk ticket create and edit forms.
|
|
*/
|
|
final class TicketCreateEditSpellcheckFilesTest extends TestCase
|
|
{
|
|
/**
|
|
* Ensure the create form subject and body editor remain wired for native browser spellcheck.
|
|
*/
|
|
public function test_create_ticket_subject_and_body_keep_native_spellcheck_hints(): 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('id="subject" type="text" spellcheck="true" lang="en-GB" autocorrect="on" autocomplete="on" autocapitalize="sentences" inputmode="text"', $view);
|
|
$this->assertStringContainsString('model="body"', $view);
|
|
$this->assertStringContainsString('editor-dusk="ticket-body-editor"', $view);
|
|
$this->assertStringContainsString('contenteditable="true"', $editor);
|
|
$this->assertStringContainsString('spellcheck="true"', $editor);
|
|
$this->assertStringContainsString('lang="en-GB"', $editor);
|
|
$this->assertStringContainsString('autocorrect="on"', $editor);
|
|
$this->assertStringContainsString('autocomplete="on"', $editor);
|
|
$this->assertStringContainsString('autocapitalize="sentences"', $editor);
|
|
$this->assertStringContainsString('data-helpdesk-spellcheck-mirror="{{ $model }}"', $editor);
|
|
}
|
|
|
|
/**
|
|
* Ensure the edit form subject and body editor use the same spellcheck baseline as create.
|
|
*/
|
|
public function test_edit_ticket_subject_and_body_keep_native_spellcheck_hints(): void
|
|
{
|
|
$view = file_get_contents(base_path('Modules/Helpdesk/Resources/views/livewire/ticket-edit.blade.php'));
|
|
|
|
$this->assertIsString($view);
|
|
|
|
$this->assertStringContainsString('id="subject" type="text" spellcheck="true" lang="en-GB" autocorrect="on" autocomplete="on" autocapitalize="sentences" inputmode="text"', $view);
|
|
$this->assertStringContainsString('model="body"', $view);
|
|
$this->assertStringContainsString('editor-dusk="ticket-edit-body-editor"', $view);
|
|
$this->assertStringNotContainsString('wire:model="body" label="Details *"', $view);
|
|
}
|
|
}
|