fix(env): keep preview variable order when sorting is disabled

Closes #9876
This commit is contained in:
Andras Bacsai
2026-10-29 11:18:02 +01:00
parent 6f8cf50402
commit 623d367a2a
2 changed files with 13 additions and 9 deletions
@@ -144,3 +144,15 @@ it('names the preview text area in a directive error', function () {
->call('submit')
->assertDispatched('error', 'Preview deployments: Line 2: a "# coolify:" line must be directly above a KEY=value line.');
});
it('keeps the saved order of preview variables when alphabetical sorting is disabled', function () {
$component = ($this->devView)()
->assertSet('showPreview', true)
->assertSet('is_env_sorting_enabled', false)
->set('variablesPreview', "ZEBRA=1\nALPHA=2\nMIDDLE=3")
->call('submit')
->assertNotDispatched('error');
expect($component->get('variablesPreview'))->toBe("ZEBRA=1\nALPHA=2\nMIDDLE=3")
->and($component->instance()->environmentVariablesPreview->pluck('key')->all())->toBe(['ZEBRA', 'ALPHA', 'MIDDLE']);
});