Browse Source

Fix specs and linters

pull/619/head
baarkerlounger 3 years ago
parent
commit
940012d31e
  1. 4
      app/components/primary_navigation_component.rb
  2. 2
      app/views/layouts/application.html.erb
  3. 8
      spec/components/primary_navigation_component_spec.rb

4
app/components/primary_navigation_component.rb

@ -5,4 +5,8 @@ class PrimaryNavigationComponent < ViewComponent::Base
@items = items
super
end
def highlighted_tab?(item, _path)
item[:current]
end
end

2
app/views/layouts/application.html.erb

@ -66,7 +66,7 @@
<% if !current_user.nil? %>
<%= render PrimaryNavigationComponent.new(
items: primary_items(current_user)
items: primary_items(current_user),
) %>
<% end %>

8
spec/components/primary_navigation_component_spec.rb

@ -2,9 +2,11 @@ require "rails_helper"
RSpec.describe PrimaryNavigationComponent, type: :component do
let(:items) do
[{ text: "Organisations", href: "/organisations", current: true },
{ text: "Users", href: "/users", current: false },
{ text: "Logs ", href: "/logs", current: false }]
[
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 tabs" do

Loading…
Cancel
Save