-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use nested hash data attributes in build_data_attributes method (#530)
Uses the nested hash method of declaring data attributes in build_data_attributes, as this is what `deep_merge_html_attributes` expects. Fixes #529
- Loading branch information
Showing
2 changed files
with
13 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,10 +181,10 @@ def url_for(path) | |
end | ||
|
||
context "when there are custom attributes" do | ||
let(:kwargs) { { lang: "en-GB", dir: "ltr" } } | ||
let(:kwargs) { { lang: "en-GB", dir: "ltr", data: { module: "custom-module" } } } | ||
|
||
specify "the custom attributes are present on the link" do | ||
expect(subject).to have_tag("a", text: "hello", with: { href: "/world", class: "govuk-link", lang: "en-GB", dir: "ltr" }) | ||
expect(subject).to have_tag("a", text: "hello", with: { href: "/world", class: "govuk-link", lang: "en-GB", dir: "ltr", "data-module": "custom-module" }) | ||
end | ||
end | ||
|
||
|
@@ -314,10 +314,10 @@ def url_for(path) | |
end | ||
|
||
context "when there are custom attributes" do | ||
let(:kwargs) { { lang: "en-GB", dir: "ltr" } } | ||
let(:kwargs) { { lang: "en-GB", dir: "ltr", data: { module: "custom-module" } } } | ||
|
||
specify "the custom attributes are present on the link" do | ||
expect(subject).to have_tag("a", text: "hello", with: { href: "mailto:[email protected]", class: "govuk-link", lang: "en-GB", dir: "ltr" }) | ||
expect(subject).to have_tag("a", text: "hello", with: { href: "mailto:[email protected]", class: "govuk-link", lang: "en-GB", dir: "ltr", "data-module": "custom-module" }) | ||
end | ||
end | ||
end | ||
|
@@ -502,10 +502,10 @@ def url_for(path) | |
end | ||
|
||
context "when there are custom attributes" do | ||
let(:kwargs) { { lang: "en-GB", dir: "ltr" } } | ||
let(:kwargs) { { lang: "en-GB", dir: "ltr", data: { module: "custom-module" } } } | ||
|
||
specify "the custom attributes are present on the link" do | ||
expect(subject).to have_tag("a", text: "hello", with: { href: "/world", class: "govuk-button", lang: "en-GB", dir: "ltr" }) | ||
expect(subject).to have_tag("a", text: "hello", with: { href: "/world", class: "govuk-button", lang: "en-GB", dir: "ltr", "data-module": "custom-module" }) | ||
end | ||
end | ||
end | ||
|
@@ -661,7 +661,7 @@ def url_for(path) | |
end | ||
|
||
context "when there are custom attributes" do | ||
let(:kwargs) { { lang: "en-GB", dir: "ltr" } } | ||
let(:kwargs) { { lang: "en-GB", dir: "ltr", data: { module: "custom-module" } } } | ||
|
||
specify "the custom attributes are present on the button" do | ||
expect(subject).to have_tag("form", with: { method: "post", action: "/world" }) do | ||
|
@@ -672,6 +672,7 @@ def url_for(path) | |
class: %w[govuk-button], | ||
dir: "ltr", | ||
lang: "en-GB", | ||
"data-module": "custom-module" | ||
} | ||
) | ||
end | ||
|