Do not show link content section when links fields are not defined.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user