Skip to content

Commit

Permalink
🐛 Add tests for all defined color methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyf committed Jan 8, 2024
1 parent c7bbda6 commit 747601f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
23 changes: 12 additions & 11 deletions app/forms/hyrax/forms/admin/appearance_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,24 @@ module AppearanceDecorator
# @!attribute default_colors
# @return [Hash<String, String>]
class_attribute :default_colors, default: {
'header_and_footer_background_color' => '#3c3c3c',
'active_tabs_background_color' => '#337ab7',
'default_button_background_color' => '#ffffff',
'default_button_border_color' => '#cccccc',
'default_button_text_color' => '#333333',
'facet_panel_background_color' => '#f5f5f5',
'facet_panel_text_color' => '#333333',
'footer_link_color' => '#ffebcd',
'footer_link_hover_color' => '#ffffff',
'header_and_footer_text_color' => '#dcdcdc',
'link_color' => '#2e74b2',
'link_hover_color' => '#215480',
'navbar_background_color' => '#000000',
'navbar_link_background_color' => '#375f8c',
'navbar_link_background_hover_color' => '#ffffff',
'navbar_link_text_color' => '#eeeeee',
'navbar_link_text_hover_color' => '#eeeeee',
'link_color' => '#2e74b2',
'link_hover_color' => '#215480',
'footer_link_color' => '#ffebcd',
'footer_link_hover_color' => '#ffffff',
'primary_button_hover_color' => '#286090',
'default_button_background_color' => '#ffffff',
'default_button_border_color' => '#cccccc',
'default_button_text_color' => '#333333',
# 'active_tabs_background_color' => '#337ab7',
'facet_panel_background_color' => '#f5f5f5',
'facet_panel_text_color' => '#333333'
'header_and_footer_background_color' => '#3c3c3c'
}
# @!endgroup Class Attributes
end
Expand Down
11 changes: 10 additions & 1 deletion spec/forms/hyrax/forms/admin/appearance_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'spec_helper'

RSpec.describe Hyrax::Forms::Admin::Appearance, type: :decorator do
let(:instance) { described_class.new }
describe '.default_fonts' do
subject { described_class.default_fonts }

Expand All @@ -26,8 +27,16 @@
end

describe '#banner_image' do
subject { described_class.new.banner_image }
subject { instance.banner_image }

it { is_expected.to be_a(Hyrax::AvatarUploader) }
end

described_class.instance_methods.grep(/_color$/).each do |color_method_name|
describe "##{color_method_name}" do
subject { instance.send(color_method_name) }

it { is_expected.to match(/^#[0-9A-F]{6}/i) }
end
end
end

0 comments on commit 747601f

Please sign in to comment.