Merge pull request #77 from trypostit/fix/workspace-name-only-update
Fix workspace name-only update rejected by required brand fields
This commit is contained in:
commit
7b4553fdbb
2 changed files with 23 additions and 2 deletions
|
|
@ -29,8 +29,8 @@ public function rules(): array
|
|||
'brand_color' => $hex,
|
||||
'background_color' => $hex,
|
||||
'text_color' => $hex,
|
||||
'brand_font' => ['required', 'string', Rule::in(BrandFont::values())],
|
||||
'image_style' => ['required', 'string', Rule::in(ImageStyle::values())],
|
||||
'brand_font' => ['sometimes', 'required', 'string', Rule::in(BrandFont::values())],
|
||||
'image_style' => ['sometimes', 'required', 'string', Rule::in(ImageStyle::values())],
|
||||
'content_language' => ['sometimes', 'string', 'in:en,pt-BR,es'],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,6 +232,27 @@
|
|||
expect($this->workspace->refresh()->image_style->value)->toBe('minimalist');
|
||||
});
|
||||
|
||||
test('update workspace settings updates the name when only the name is submitted', function () {
|
||||
$this->actingAs($this->user)
|
||||
->from(route('app.workspace.settings'))
|
||||
->put(route('app.workspace.settings.update'), [
|
||||
'name' => 'Name Only Update',
|
||||
])
|
||||
->assertRedirect(route('app.workspace.settings'))
|
||||
->assertSessionHasNoErrors();
|
||||
|
||||
expect($this->workspace->refresh()->name)->toBe('Name Only Update');
|
||||
});
|
||||
|
||||
test('update workspace settings still requires brand_font and image_style when submitted empty', function () {
|
||||
$this->actingAs($this->user)
|
||||
->put(route('app.workspace.settings.update'), [
|
||||
'name' => $this->workspace->name,
|
||||
'brand_font' => '',
|
||||
'image_style' => '',
|
||||
])->assertSessionHasErrors(['brand_font', 'image_style']);
|
||||
});
|
||||
|
||||
test('update workspace settings rejects unknown image_style values', function () {
|
||||
$this->actingAs($this->user)
|
||||
->put(route('app.workspace.settings.update'), [
|
||||
|
|
|
|||
Loading…
Reference in a new issue