mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
Ensure Consistent Category Colors (#1722)
* feat: add validation to require consistent category color * feat: reflect color requirement in new category form * refactor: move logic inline over shared component * rubocop * tests: fix breaking and add case for new validation * feat: hide color selector when parent category selected * feat: override color with parent color in model * tests: remove case for unnecessary validation --------- Signed-off-by: Julien Bertazzo Lambert <42924425+JLambertazzo@users.noreply.github.com>
This commit is contained in:
parent
ded42a8c33
commit
ad5b0b8b7d
4 changed files with 19 additions and 4 deletions
|
@ -25,7 +25,7 @@ class CategoryTest < ActiveSupport::TestCase
|
|||
category = categories(:subcategory)
|
||||
|
||||
error = assert_raises(ActiveRecord::RecordInvalid) do
|
||||
category.subcategories.create!(name: "Invalid category", color: "#000", family: @family)
|
||||
category.subcategories.create!(name: "Invalid category", family: @family)
|
||||
end
|
||||
|
||||
assert_equal "Validation failed: Parent can't have more than 2 levels of subcategories", error.message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue