Skip to content

Commit

Permalink
Fix problem of stack horizontal without image (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi authored Nov 10, 2023
1 parent 92db8dd commit 1221cce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<% 1.upto(3) do |item_number| %>
<div class="stack-item">
<div class="stack-image">
<%= image_tag image(item_number) %>
<%= image_tag image(item_number) if image(item_number).present? %>
</div>
<div class="stack-body">
<div>
Expand Down
2 changes: 1 addition & 1 deletion spec/shared/system_homepage_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# /rails/active_storage/representation/redirect/same-hash--different-token/same-file-name
# That's why we are splitting by "--" and comparing the first
img_path = content_block.images_container.attached_uploader("image_#{item_number}".to_sym).path(variant: :landscape)
[img_path.split("--").first, img_path.split("/").last].each do |regex|
img_path && [img_path.split("--").first, img_path.split("/").last].each do |regex|
expect(page.find("img")[:src]).to match(/#{regex}/)
end
end
Expand Down
10 changes: 10 additions & 0 deletions spec/system/homepage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
describe "stack blocks" do
it_behaves_like "render all stack block elements", "stack-horizontal"
it_behaves_like "render all stack block elements", "stack-vertical"

context "without images" do
before do
stack_horizontal_block.attachments.destroy_all
stack_vertical_block.attachments.destroy_all
end

it_behaves_like "render all stack block elements", "stack-horizontal"
it_behaves_like "render all stack block elements", "stack-vertical"
end
end

describe "tiles block" do
Expand Down

0 comments on commit 1221cce

Please sign in to comment.