mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-03-14 20:33:40 +00:00
fix: update password field binding in config modal and add test for saving password values
This commit is contained in:
parent
ffd1cf0d7e
commit
f42dc03247
2 changed files with 28 additions and 1 deletions
|
|
@ -240,7 +240,7 @@ new class extends Component
|
|||
<flux:description>{!! $safeDescription !!}</flux:description>
|
||||
<flux:input
|
||||
type="password"
|
||||
wire:model="local_configuration.{{ $fieldKey }}"
|
||||
wire:model="configuration.{{ $fieldKey }}"
|
||||
value="{{ $currentValue }}"
|
||||
viewable
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -121,3 +121,30 @@ test('config modal dispatches update event for parent warning refresh', function
|
|||
->call('saveConfiguration')
|
||||
->assertDispatched('config-updated');
|
||||
});
|
||||
|
||||
test('config modal saves password field values correctly', function (): void {
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
$plugin = Plugin::create([
|
||||
'uuid' => Str::uuid(),
|
||||
'user_id' => $user->id,
|
||||
'name' => 'Test Plugin',
|
||||
'data_strategy' => 'static',
|
||||
'configuration_template' => [
|
||||
'custom_fields' => [[
|
||||
'keyname' => 'api_key',
|
||||
'field_type' => 'password',
|
||||
'name' => 'API Key',
|
||||
]],
|
||||
],
|
||||
'configuration' => [],
|
||||
]);
|
||||
|
||||
Livewire::test('plugins.config-modal', ['plugin' => $plugin])
|
||||
->set('configuration.api_key', 'my-secret-password-123')
|
||||
->call('saveConfiguration')
|
||||
->assertHasNoErrors();
|
||||
|
||||
expect($plugin->fresh()->configuration['api_key'])->toBe('my-secret-password-123');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue