Add more images to admin site customization
This commit is contained in:
@@ -11,11 +11,26 @@ describe Budgets::InvestmentComponent do
|
||||
expect(page).to have_css "img[alt='#{investment.image.title}']"
|
||||
end
|
||||
|
||||
it "shows the default image when investment has not an image defined" do
|
||||
investment = create(:budget_investment)
|
||||
render_inline Budgets::InvestmentComponent.new(investment)
|
||||
context "investment without an image" do
|
||||
let(:component) { Budgets::InvestmentComponent.new(create(:budget_investment)) }
|
||||
|
||||
expect(page).to have_css "img[src*='budget_investment_no_image']"
|
||||
it "shows the default image" do
|
||||
render_inline component
|
||||
|
||||
expect(page).to have_css "img[src*='budget_investment_no_image']"
|
||||
end
|
||||
|
||||
it "shows a custom default image when available" do
|
||||
stub_const("#{SiteCustomization::Image}::VALID_IMAGES", { "budget_investment_no_image" => [260, 80] })
|
||||
create(:site_customization_image,
|
||||
name: "budget_investment_no_image",
|
||||
image: fixture_file_upload("logo_header-260x80.png"))
|
||||
|
||||
render_inline component
|
||||
|
||||
expect(page).to have_css "img[src$='logo_header-260x80.png']"
|
||||
expect(page).not_to have_css "img[src*='budget_investment_no_image']"
|
||||
end
|
||||
end
|
||||
|
||||
it "shows supports count when budget is valuating" do
|
||||
|
||||
@@ -20,4 +20,24 @@ describe Widget::Feeds::ProcessComponent do
|
||||
|
||||
expect(page).to have_css("img[alt='1. No Poverty']")
|
||||
end
|
||||
|
||||
describe "image" do
|
||||
it "shows the default image" do
|
||||
render_inline component
|
||||
|
||||
expect(page).to have_css "img[src*='welcome_process']"
|
||||
end
|
||||
|
||||
it "shows a custom default image when available" do
|
||||
stub_const("#{SiteCustomization::Image}::VALID_IMAGES", { "welcome_process" => [260, 80] })
|
||||
create(:site_customization_image,
|
||||
name: "welcome_process",
|
||||
image: fixture_file_upload("logo_header-260x80.png"))
|
||||
|
||||
render_inline component
|
||||
|
||||
expect(page).to have_css "img[src$='logo_header-260x80.png']"
|
||||
expect(page).not_to have_css "img[src*='welcome_process']"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
BIN
spec/fixtures/files/favicon_custom.ico
vendored
Normal file
BIN
spec/fixtures/files/favicon_custom.ico
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
23
spec/system/site_customization/images_spec.rb
Normal file
23
spec/system/site_customization/images_spec.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Site customization images" do
|
||||
scenario "Custom favicon" do
|
||||
create(:site_customization_image, name: "favicon", image: fixture_file_upload("favicon_custom.ico"))
|
||||
|
||||
visit root_path
|
||||
|
||||
expect(page).to have_css("link[rel='shortcut icon'][href$='favicon_custom.ico']", visible: :hidden)
|
||||
end
|
||||
|
||||
scenario "Custom auth background" do
|
||||
stub_const("#{SiteCustomization::Image}::VALID_IMAGES", { "auth_bg" => [260, 80] })
|
||||
create(:site_customization_image,
|
||||
name: "auth_bg",
|
||||
image: fixture_file_upload("logo_header-260x80.png"))
|
||||
|
||||
visit new_user_session_path
|
||||
|
||||
expect(page).to have_css "[style*='background-image:'][style*='logo_header-260x80.png']"
|
||||
expect(page).not_to have_css "[style*='auth_bg']"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user