tests fixing ofr modules
This commit is contained in:
@@ -72,13 +72,21 @@ final class HelpdeskSettingsBrowserTest extends DuskTestCase
|
|||||||
|
|
||||||
private function setHelpdeskSettingsSection(Browser $browser, string $section): void
|
private function setHelpdeskSettingsSection(Browser $browser, string $section): void
|
||||||
{
|
{
|
||||||
|
$encodedSection = json_encode($section, JSON_THROW_ON_ERROR);
|
||||||
|
|
||||||
$browser->script(<<<JS
|
$browser->script(<<<JS
|
||||||
const settings = document.querySelector('[dusk="helpdesk-settings-manager"]');
|
const settings = document.querySelector('[dusk="helpdesk-settings-manager"]');
|
||||||
const component = settings?.closest('[wire\\:id]');
|
|
||||||
|
let component = settings;
|
||||||
|
while (component && ! component.hasAttribute('wire:id')) {
|
||||||
|
component = component.parentElement;
|
||||||
|
}
|
||||||
|
|
||||||
if (! component) {
|
if (! component) {
|
||||||
throw new Error('Helpdesk settings Livewire component was not found.');
|
throw new Error('Helpdesk settings Livewire component was not found.');
|
||||||
}
|
}
|
||||||
window.Livewire.find(component.getAttribute('wire:id')).set('section', '{$section}');
|
|
||||||
|
window.Livewire.find(component.getAttribute('wire:id')).set('section', {$encodedSection});
|
||||||
JS);
|
JS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,14 +75,19 @@ final class HelpdeskTicketBrowserTest extends DuskTestCase
|
|||||||
|
|
||||||
$browser->script(<<<JS
|
$browser->script(<<<JS
|
||||||
const form = document.querySelector('.helpdesk-ticket-form');
|
const form = document.querySelector('.helpdesk-ticket-form');
|
||||||
const component = form?.closest('[wire\\:id]');
|
|
||||||
|
let component = form;
|
||||||
|
while (component && ! component.hasAttribute('wire:id')) {
|
||||||
|
component = component.parentElement;
|
||||||
|
}
|
||||||
|
|
||||||
if (! component) {
|
if (! component) {
|
||||||
throw new Error('Helpdesk ticket create Livewire component was not found.');
|
throw new Error('Helpdesk ticket create Livewire component was not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Livewire.find(component.getAttribute('wire:id')).set({$encodedProperty}, {$encodedValue});
|
window.Livewire.find(component.getAttribute('wire:id')).set({$encodedProperty}, {$encodedValue});
|
||||||
JS);
|
JS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setTicketShowProperty(Browser $browser, string $property, mixed $value): void
|
private function setTicketShowProperty(Browser $browser, string $property, mixed $value): void
|
||||||
{
|
{
|
||||||
$encodedProperty = json_encode($property, JSON_THROW_ON_ERROR);
|
$encodedProperty = json_encode($property, JSON_THROW_ON_ERROR);
|
||||||
@@ -90,10 +95,16 @@ JS);
|
|||||||
|
|
||||||
$browser->script(<<<JS
|
$browser->script(<<<JS
|
||||||
const show = document.querySelector('[dusk="helpdesk-ticket-show"]');
|
const show = document.querySelector('[dusk="helpdesk-ticket-show"]');
|
||||||
const component = show?.closest('[wire\\:id]');
|
|
||||||
|
let component = show;
|
||||||
|
while (component && ! component.hasAttribute('wire:id')) {
|
||||||
|
component = component.parentElement;
|
||||||
|
}
|
||||||
|
|
||||||
if (! component) {
|
if (! component) {
|
||||||
throw new Error('Helpdesk ticket show Livewire component was not found.');
|
throw new Error('Helpdesk ticket show Livewire component was not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Livewire.find(component.getAttribute('wire:id')).set({$encodedProperty}, {$encodedValue});
|
window.Livewire.find(component.getAttribute('wire:id')).set({$encodedProperty}, {$encodedValue});
|
||||||
JS);
|
JS);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user