-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert Government navigation component
- Loading branch information
Showing
3 changed files
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
18 changes: 12 additions & 6 deletions
18
.../components/government_navigation_test.rb → .../components/government_navigation_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
require 'govuk_component_test_helper' | ||
require 'rails_helper' | ||
|
||
class GovernmentNavigationTestCase < ComponentTestCase | ||
describe "Government navigation", type: :view do | ||
def component_name | ||
"government_navigation" | ||
end | ||
|
||
test "renders a list of government links" do | ||
it "renders a list of government links" do | ||
render_component({}) | ||
|
||
assert_select "\#proposition-links li a", text: "Departments" | ||
assert_link_with_text("/government/organisations", "Departments") | ||
assert_link_with_text("/government/announcements", "Announcements") | ||
# etc. | ||
end | ||
|
||
test "no links are active by default" do | ||
it "has no active links by default" do | ||
render_component({}) | ||
|
||
assert_select "a.active", false | ||
end | ||
|
||
test "can mark a link as active" do | ||
it "can mark a link as active" do | ||
render_component(active: 'departments') | ||
|
||
assert_select "a.active", text: "Departments" | ||
end | ||
|
||
def assert_link_with_text(link, text) | ||
assert_select "a[href=\"#{link}\"]", text: text | ||
end | ||
end |