<%= govuk_summary_list do |summary_list| %>
<% @organisation.display_attributes.each do |attr| %>
diff --git a/spec/components/primary_navigation_component_spec.rb b/spec/components/primary_navigation_component_spec.rb
index e37f8320b..0de1c58d1 100644
--- a/spec/components/primary_navigation_component_spec.rb
+++ b/spec/components/primary_navigation_component_spec.rb
@@ -1,6 +1,6 @@
require "rails_helper"
-RSpec.describe NavigationComponent, type: :component do
+RSpec.describe PrimaryNavigationComponent, type: :component do
let(:items) do
[
NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", true),
@@ -9,8 +9,8 @@ RSpec.describe NavigationComponent, type: :component do
]
end
- context "when the item is 'current' in nav tabs" do
- it "then that tab appears as selected" do
+ context "when the item is 'current' in nav items" do
+ it "then that item appears as selected" do
result = render_inline(described_class.new(items:))
expect(result.css('.app-primary-navigation__link[aria-current="page"]').text).to include("Organisations")
@@ -18,17 +18,17 @@ RSpec.describe NavigationComponent, type: :component do
end
context "when the current page is sub-page" do
- it "highlights the correct tab" do
+ it "highlights the correct item" do
navigation_panel = described_class.new(items:)
- expect(navigation_panel).to be_highlighted_tab(items[0], "/something-else")
- expect(navigation_panel).not_to be_highlighted_tab(items[1], "/something-else")
- expect(navigation_panel).not_to be_highlighted_tab(items[2], "/something-else")
+ expect(navigation_panel).to be_highlighted_item(items[0], "/something-else")
+ expect(navigation_panel).not_to be_highlighted_item(items[1], "/something-else")
+ expect(navigation_panel).not_to be_highlighted_item(items[2], "/something-else")
end
end
- context "when rendering tabs" do
- it "all of the nav tabs specified in the items hash are passed to it" do
+ context "when rendering items" do
+ it "all of the nav items specified in the items hash are passed to it" do
result = render_inline(described_class.new(items:))
expect(result.text).to include("Organisations")
diff --git a/spec/components/sub_navigation_component_spec.rb b/spec/components/sub_navigation_component_spec.rb
new file mode 100644
index 000000000..fcfa2d75d
--- /dev/null
+++ b/spec/components/sub_navigation_component_spec.rb
@@ -0,0 +1,39 @@
+require "rails_helper"
+
+RSpec.describe SubNavigationComponent, type: :component do
+ let(:items) do
+ [
+ NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", true),
+ NavigationItemsHelper::NavigationItem.new("Users", "/users", false),
+ NavigationItemsHelper::NavigationItem.new("Logs ", "/logs", false),
+ ]
+ end
+
+ context "when the item is 'current' in nav items" do
+ it "then that tab appears as selected" do
+ result = render_inline(described_class.new(items:))
+
+ expect(result.css('.app-sub-navigation__link[aria-current="page"]').text).to include("Organisations")
+ end
+ end
+
+ context "when the current page is sub-page" do
+ it "highlights the correct tab" do
+ navigation_panel = described_class.new(items:)
+
+ expect(navigation_panel).to be_highlighted_item(items[0], "/something-else")
+ expect(navigation_panel).not_to be_highlighted_item(items[1], "/something-else")
+ expect(navigation_panel).not_to be_highlighted_item(items[2], "/something-else")
+ end
+ end
+
+ context "when rendering items" do
+ it "all of the nav items specified in the items hash are passed to it" do
+ result = render_inline(described_class.new(items:))
+
+ expect(result.text).to include("Organisations")
+ expect(result.text).to include("Users")
+ expect(result.text).to include("Logs")
+ end
+ end
+end