Skip to content

Commit

Permalink
test+style
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVajnagi committed Dec 3, 2024
1 parent 720daf2 commit 54959e9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/assets/stylesheets/components/form.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@
.auth-login-links {
@apply flex items-center justify-center gap-4 text-center border-t border-solid text-gray border-light_gray;
}

/* Input styles */
.color-input {
@apply p-2;
width: 7rem;
height: 3.5rem;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<div class="nested-fields">
<%= f.input :color, as: :color, label: 'Choose a Color for Calculator Page:',
input_html: {
class: 'form-control form-control-color p-2',
style: 'width: 7rem; height: 3.5rem;'
class: 'color-input',
} %>
</div>
6 changes: 6 additions & 0 deletions spec/models/calculator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
it { is_expected.to validate_presence_of(:uk_name) }
it { is_expected.to validate_length_of(:uk_name).is_at_least(3).is_at_most(50) }
it { is_expected.to validate_uniqueness_of(:slug) }
it { is_expected.to allow_value('#123abc').for(:color) }
it { is_expected.to allow_value('#ABCDEF').for(:color) }
it { is_expected.not_to allow_value('123abc').for(:color) }
it { is_expected.not_to allow_value('#12345').for(:color) }
it { is_expected.not_to allow_value('#1234567').for(:color) }
it { is_expected.not_to allow_value('#GHIJKL').for(:color) }
end

describe "associations" do
Expand Down

0 comments on commit 54959e9

Please sign in to comment.