-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update devolved nations component to accept type property #2337
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -47,41 +47,41 @@ def component_name | |
assert_select ".gem-c-devolved-nations > h2", text: "Applies to England, Scotland and Wales" | ||
end | ||
|
||
it "renders a devolved nations component, which applies to one nation, with individual guidance available, correctly" do | ||
it "renders a devolved nations component, which applies to one nation, with individual publication available, correctly" do | ||
render_component( | ||
national_applicability: { | ||
england: { | ||
applicable: true, | ||
}, | ||
northern_ireland: { | ||
applicable: false, | ||
alternative_url: "/guidance-northern-ireland", | ||
alternative_url: "/publication-northern-ireland", | ||
}, | ||
scotland: { | ||
applicable: false, | ||
alternative_url: "/guidance-scotland", | ||
alternative_url: "/publication-scotland", | ||
}, | ||
wales: { | ||
applicable: false, | ||
alternative_url: "/guidance-wales", | ||
alternative_url: "/publication-wales", | ||
}, | ||
}, | ||
) | ||
assert_select ".gem-c-devolved-nations > h2", text: "Applies to England" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(1) > [href='/guidance-northern-ireland']", text: "Guidance for Northern Ireland" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(2) > [href='/guidance-scotland']", text: "Guidance for Scotland" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(3) > [href='/guidance-wales']", text: "Guidance for Wales" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(1) > [href='/publication-northern-ireland']", text: "Publication for Northern Ireland" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(2) > [href='/publication-scotland']", text: "Publication for Scotland" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(3) > [href='/publication-wales']", text: "Publication for Wales" | ||
end | ||
|
||
it "renders a devolved nations component, which applies to three nations, with individual guidance available, correctly" do | ||
it "renders a devolved nations component, which applies to three nations, with individual publication available, correctly" do | ||
render_component( | ||
national_applicability: { | ||
england: { | ||
applicable: true, | ||
}, | ||
northern_ireland: { | ||
applicable: false, | ||
alternative_url: "/guidance-northern-ireland", | ||
alternative_url: "/publication-northern-ireland", | ||
}, | ||
scotland: { | ||
applicable: true, | ||
|
@@ -92,9 +92,60 @@ def component_name | |
}, | ||
) | ||
assert_select ".gem-c-devolved-nations > h2", text: "Applies to England, Scotland and Wales" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(1) > [href='/publication-northern-ireland']", text: "Publication for Northern Ireland" | ||
end | ||
|
||
it "renders a devolved nations component, which applies to one nation, with individual consultation available, correctly" do | ||
render_component( | ||
national_applicability: { | ||
england: { | ||
applicable: true, | ||
}, | ||
northern_ireland: { | ||
applicable: false, | ||
alternative_url: "/consultation-northern-ireland", | ||
}, | ||
}, | ||
type: "consultation", | ||
) | ||
assert_select ".gem-c-devolved-nations > h2", text: "Applies to England" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(1) > [href='/consultation-northern-ireland']", text: "Consultation for Northern Ireland" | ||
end | ||
|
||
it "renders a devolved nations component, which applies to one nation, with individual guidance available, correctly" do | ||
render_component( | ||
national_applicability: { | ||
england: { | ||
applicable: true, | ||
}, | ||
northern_ireland: { | ||
applicable: false, | ||
alternative_url: "/guidance-northern-ireland", | ||
}, | ||
}, | ||
type: "detailed_guide", | ||
) | ||
assert_select ".gem-c-devolved-nations > h2", text: "Applies to England" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(1) > [href='/guidance-northern-ireland']", text: "Guidance for Northern Ireland" | ||
end | ||
|
||
it "renders a devolved nations component, which applies to one nation, with individual pubilcation available, when invalid type provided, correctly" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🆒 |
||
render_component( | ||
national_applicability: { | ||
england: { | ||
applicable: true, | ||
}, | ||
northern_ireland: { | ||
applicable: false, | ||
alternative_url: "/publication-northern-ireland", | ||
}, | ||
}, | ||
type: "invalid_type", | ||
) | ||
assert_select ".gem-c-devolved-nations > h2", text: "Applies to England" | ||
assert_select ".gem-c-devolved-nations > ul > li:nth-child(1) > [href='/publication-northern-ireland']", text: "Publication for Northern Ireland" | ||
end | ||
|
||
it "renders a devolved nations component with different heading levels" do | ||
render_component( | ||
heading_level: 3, | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice safety check!