Skip to content

Commit

Permalink
Add test coverage for contrast calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
danidoni committed Aug 6, 2024
1 parent c15c123 commit 5e8fb6f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/api/spec/helpers/webui/color_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
RSpec.describe Webui::ColorHelper do
describe '#contrast_text' do
context 'when passing a light color' do
it 'returns a black text' do
expect(contrast_text('#ffffff')).to eql('black')
end
end

context 'when passing a dark color' do
it 'returns a white text' do
expect(contrast_text('#000000')).to eql('white')
end
end
end
end

0 comments on commit 5e8fb6f

Please sign in to comment.