From 8053cc5e1cde13e08c75536774a95d4178d8cd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 15 Oct 2023 17:38:19 +0200 Subject: [PATCH] Open footer description links in the same window This is a funny one, because we were accidentally opening them in the same window without intending to do so since commit 928312e21, since the `sanitize` method removes the `target` attribute. So the test we're adding already passed without these changes. --- app/components/layout/footer_component.rb | 6 ++---- spec/components/layout/footer_component_spec.rb | 13 +++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 spec/components/layout/footer_component_spec.rb diff --git a/app/components/layout/footer_component.rb b/app/components/layout/footer_component.rb index 17dce63f0..c81d102ac 100644 --- a/app/components/layout/footer_component.rb +++ b/app/components/layout/footer_component.rb @@ -8,12 +8,10 @@ class Layout::FooterComponent < ApplicationComponent private def open_source_link - link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), target: "_blank", - rel: "nofollow") + link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), rel: "nofollow") end def repository_link - link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), target: "_blank", - rel: "nofollow") + link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), rel: "nofollow") end end diff --git a/spec/components/layout/footer_component_spec.rb b/spec/components/layout/footer_component_spec.rb new file mode 100644 index 000000000..83b509506 --- /dev/null +++ b/spec/components/layout/footer_component_spec.rb @@ -0,0 +1,13 @@ +require "rails_helper" + +describe Layout::FooterComponent do + describe "description links" do + it "generates links that open in the same tab" do + render_inline Layout::FooterComponent.new + + page.find(".info") do |info| + expect(info).not_to have_css "a[target]" + end + end + end +end