Skip to content

Commit

Permalink
Display special characters in breadcrumb menu (decidim#11514)
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi authored Aug 24, 2023
1 parent 295c7a1 commit 37358ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% breadcrumb_items.each_with_index do |item, i| %>
<% item_label = decidim_html_escape(translated_attribute(item[:label])) %>
<% item_label = translated_attribute(item[:label]) %>
<span>/</span>
<% if item[:dropdown_cell].present? %>
<div class="relative">
Expand All @@ -22,9 +22,9 @@
</div>
</div>
<% else %>
<%= link_to_if(item[:url].present? && !is_active_link?(item[:url], :exclusive), item_label, item[:url], class:"menu-bar__breadcrumb-desktop__dropdown-wrapper menu-bar__breadcrumb-desktop__dropdown-trigger", "aria-current": (item[:active] ? "page" : nil)) do %>
<%= link_to_if(item[:url].present? && !is_active_link?(item[:url], :exclusive), item_label, item[:url], class: "menu-bar__breadcrumb-desktop__dropdown-wrapper menu-bar__breadcrumb-desktop__dropdown-trigger", "aria-current": (item[:active] ? "page" : nil)) do %>
<%# alternative template %>
<%= content_tag :span, item_label, class:"menu-bar__breadcrumb-desktop__dropdown-trigger no-interactive", tabindex: "0", "aria-current": "page" if item[:active] %>
<%= content_tag :span, item_label, class: "menu-bar__breadcrumb-desktop__dropdown-trigger no-interactive", tabindex: "0", "aria-current": "page" if item[:active] %>
<% end %>
<% end %>
<% end %>
16 changes: 16 additions & 0 deletions decidim-core/spec/system/menu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,20 @@
end
end
end

context "when rendering a component with special characters" do
let(:component_name) { "Collaborative Drafts & Amendments" }
let(:participatory_space) { create(:participatory_process, organization:) }
let(:proposal_component) { create(:proposal_component, name: { en: component_name }, participatory_space:) }
let(:proposal) { create(:proposal, component: proposal_component) }
let(:proposal_path) { Decidim::ResourceLocatorPresenter.new(proposal).path }

before do
visit proposal_path
end

it "renders the component name correctly" do
expect(page).to have_selector(".menu-bar__breadcrumb-desktop__dropdown-wrapper", text: component_name)
end
end
end

0 comments on commit 37358ca

Please sign in to comment.