Fix Queue settings save broken by nested industry reinstall form.
Deploy Ladill Queue / deploy (push) Successful in 2m5s
Deploy Ladill Queue / deploy (push) Successful in 2m5s
Browsers abort the outer Save settings form when a Reinstall package form is nested inside it. Move reinstall outside the main form and harden update validation so package failures cannot block saving. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -50,6 +50,45 @@ class SettingsBranchesTeamTest extends TestCase
|
||||
->assertSee(route('qms.members.index', absolute: false));
|
||||
}
|
||||
|
||||
public function test_org_admin_can_save_settings(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->put(route('qms.settings.update'), [
|
||||
'name' => 'Settings Org Updated',
|
||||
'timezone' => 'Africa/Accra',
|
||||
'appointment_mode' => 'walk_in_only',
|
||||
'industry' => 'retail',
|
||||
'notifications_enabled' => '1',
|
||||
'care_integration_enabled' => '1',
|
||||
])
|
||||
->assertRedirect()
|
||||
->assertSessionHas('success');
|
||||
|
||||
$this->organization->refresh();
|
||||
$this->assertSame('Settings Org Updated', $this->organization->name);
|
||||
$this->assertSame('Africa/Accra', $this->organization->timezone);
|
||||
$this->assertSame('walk_in_only', data_get($this->organization->settings, 'appointment_mode'));
|
||||
$this->assertTrue((bool) data_get($this->organization->settings, 'integrations.care_enabled'));
|
||||
}
|
||||
|
||||
public function test_settings_page_does_not_nest_reinstall_form(): void
|
||||
{
|
||||
$html = $this->actingAs($this->owner)
|
||||
->get(route('qms.settings.edit'))
|
||||
->assertOk()
|
||||
->getContent();
|
||||
|
||||
$this->assertSame(1, substr_count($html, 'action="'.route('qms.settings.update').'"'));
|
||||
$this->assertSame(1, substr_count($html, 'action="'.route('qms.settings.package.reinstall').'"'));
|
||||
// Reinstall form must appear after the settings form closes.
|
||||
$updatePos = strpos($html, 'action="'.route('qms.settings.update').'"');
|
||||
$closePos = strpos($html, '</form>', $updatePos);
|
||||
$reinstallPos = strpos($html, 'action="'.route('qms.settings.package.reinstall').'"');
|
||||
$this->assertNotFalse($closePos);
|
||||
$this->assertNotFalse($reinstallPos);
|
||||
$this->assertGreaterThan($closePos, $reinstallPos);
|
||||
}
|
||||
|
||||
public function test_free_plan_branches_shows_upgrade_screen(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
|
||||
Reference in New Issue
Block a user