Do not show link content section when links fields are not defined.

This commit is contained in:
taitus
2021-06-25 13:15:11 +02:00
parent 108de86da5
commit db23d536dd
2 changed files with 34 additions and 4 deletions

View File

@@ -174,4 +174,30 @@ describe "Home" do
expect(page).not_to have_css(".title", text: "Featured")
end
describe "Header Card" do
scenario "if there is header card with link, the link content is rendered" do
create(:widget_card, :header, link_text: "Link text", link_url: "consul.dev")
visit root_path
expect(page).to have_link "Link text", href: "consul.dev"
end
scenario "if there is header card without link, the link content is not rendered" do
create(:widget_card, :header, link_text: nil, link_url: nil)
visit root_path
within(".header-card") { expect(page).not_to have_link }
end
scenario "if there is header card without link and with text, the link content is not rendered" do
create(:widget_card, :header, link_text: "", link_url: "", link_text_es: "Link ES", title_es: "ES")
visit root_path(locale: :es)
within(".header-card") { expect(page).not_to have_link }
end
end
end