-
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.
- prevent as many test failures due to the previous changes as possible.
- Loading branch information
1 parent
b920db5
commit 4158f25
Showing
4 changed files
with
48 additions
and
12 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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require "rails_helper" | ||
|
||
describe "CovidCta", type: :view do | ||
def component_name | ||
"contextual_sidebar/covid_cta" | ||
end | ||
|
||
before(:each) do | ||
I18n.locale = :en | ||
end | ||
|
||
let(:content_item) do | ||
{ | ||
"base_path" => "/any-page", | ||
"content_id" => SecureRandom.uuid, | ||
} | ||
end | ||
|
||
let(:welsh_content_item) { content_item.merge("locale" => "cy") } | ||
|
||
def assert_link_with_text_in(selector, link, text) | ||
assert_select "#{selector} a[href=\"#{link}\"]", text: text | ||
end | ||
|
||
it "shows standard covid call to action" do | ||
render_component({ content_item: content_item }) | ||
assert_select ".gem-c-contextual-sidebar__heading", text: "Covid" | ||
assert_link_with_text_in(".gem-c-contextual-sidebar__text", "/covid", "Check what you need to do") | ||
end | ||
|
||
it "shows standard covid call to action for Welsh pages" do | ||
I18n.with_locale(:cy) { render_component({ content_item: welsh_content_item }) } | ||
assert_select ".gem-c-contextual-sidebar__heading", text: "Covid" | ||
assert_link_with_text_in(".gem-c-contextual-sidebar__text", "/covid.cy", "Gwiriwch beth mae angen i chi wneud") | ||
end | ||
end |
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