mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 19:21:36 +00:00
feat: add environment variable autocomplete component
Adds a new EnvVarInput component that provides autocomplete suggestions for shared environment variables from team, project, and environment scopes. Users can reference variables using {{ syntax.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
67
tests/Unit/EnvVarInputComponentTest.php
Normal file
67
tests/Unit/EnvVarInputComponentTest.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
use App\View\Components\Forms\EnvVarInput;
|
||||
|
||||
it('renders with default properties', function () {
|
||||
$component = new EnvVarInput;
|
||||
|
||||
expect($component->required)->toBeFalse()
|
||||
->and($component->disabled)->toBeFalse()
|
||||
->and($component->readonly)->toBeFalse()
|
||||
->and($component->defaultClass)->toBe('input')
|
||||
->and($component->availableVars)->toBe([]);
|
||||
});
|
||||
|
||||
it('uses provided id', function () {
|
||||
$component = new EnvVarInput(id: 'env-key');
|
||||
|
||||
expect($component->id)->toBe('env-key');
|
||||
});
|
||||
|
||||
it('accepts available vars', function () {
|
||||
$vars = [
|
||||
'team' => ['DATABASE_URL', 'API_KEY'],
|
||||
'project' => ['STRIPE_KEY'],
|
||||
'environment' => ['DEBUG'],
|
||||
];
|
||||
|
||||
$component = new EnvVarInput(availableVars: $vars);
|
||||
|
||||
expect($component->availableVars)->toBe($vars);
|
||||
});
|
||||
|
||||
it('accepts required parameter', function () {
|
||||
$component = new EnvVarInput(required: true);
|
||||
|
||||
expect($component->required)->toBeTrue();
|
||||
});
|
||||
|
||||
it('accepts disabled state', function () {
|
||||
$component = new EnvVarInput(disabled: true);
|
||||
|
||||
expect($component->disabled)->toBeTrue();
|
||||
});
|
||||
|
||||
it('accepts readonly state', function () {
|
||||
$component = new EnvVarInput(readonly: true);
|
||||
|
||||
expect($component->readonly)->toBeTrue();
|
||||
});
|
||||
|
||||
it('accepts autofocus parameter', function () {
|
||||
$component = new EnvVarInput(autofocus: true);
|
||||
|
||||
expect($component->autofocus)->toBeTrue();
|
||||
});
|
||||
|
||||
it('accepts authorization properties', function () {
|
||||
$component = new EnvVarInput(
|
||||
canGate: 'update',
|
||||
canResource: 'resource',
|
||||
autoDisable: false
|
||||
);
|
||||
|
||||
expect($component->canGate)->toBe('update')
|
||||
->and($component->canResource)->toBe('resource')
|
||||
->and($component->autoDisable)->toBeFalse();
|
||||
});
|
||||
Reference in New Issue
Block a user