Skip to content
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

Change breadcrumb class name #435

Merged
merged 1 commit into from
Jul 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

## Unreleased

* Change breadcrumb class name (PR #435)
* Add admin component for select (PR #434)

## 9.5.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}

@include media-down(mobile) {
&.gem-c-breadcrumbs--collapse-on-mobile .gem-c-breadcrumbs--item {
&.gem-c-breadcrumbs--collapse-on-mobile .gem-c-breadcrumbs__item {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing this class will mean all of these other repos will require a change aswell

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eeek. Thanks, good spot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a few apps - most of them look like prototypes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually looks like just collections. I'll raise a PR there to change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DilwoarH have raised a PR in collections (alphagov/collections#796) - are you happy to approve this PR?

display: none;

&.gem-c-breadcrumbs--parent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
css_class = invert_class.concat(crumb[:is_current_page] ? ' gem-c-breadcrumbs--current ' : '')
%>

<li class='gem-c-breadcrumbs--item <%= "gem-c-breadcrumbs--parent" if crumb[:is_page_parent] %>'>
<li class='gem-c-breadcrumbs__item <%= "gem-c-breadcrumbs--parent" if crumb[:is_page_parent] %>'>
<% if is_link %>
<%= link_to(
crumb[:title],
Expand Down
24 changes: 12 additions & 12 deletions spec/components/breadcrumbs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def assert_link_with_text_in(selector, link, text)
it "renders a single breadcrumb" do
render_component(breadcrumbs: [{ title: 'Section', url: '/section' }])

assert_link_with_text_in('.gem-c-breadcrumbs--item:first-child', '/section', 'Section')
assert_link_with_text_in('.gem-c-breadcrumbs__item:first-child', '/section', 'Section')
end

it "renders schema data" do
Expand Down Expand Up @@ -49,10 +49,10 @@ def assert_link_with_text_in(selector, link, text)
}

assert_select '.gem-c-breadcrumbs[data-module="track-click"]', 1
assert_select '.gem-c-breadcrumbs--item:first-child a[data-track-action="1"]', 1
assert_select '.gem-c-breadcrumbs--item:first-child a[data-track-label="/section"]', 1
assert_select '.gem-c-breadcrumbs--item:first-child a[data-track-category="breadcrumbClicked"]', 1
assert_select ".gem-c-breadcrumbs--item:first-child a[data-track-options='#{expected_tracking_options.to_json}']", 1
assert_select '.gem-c-breadcrumbs__item:first-child a[data-track-action="1"]', 1
assert_select '.gem-c-breadcrumbs__item:first-child a[data-track-label="/section"]', 1
assert_select '.gem-c-breadcrumbs__item:first-child a[data-track-category="breadcrumbClicked"]', 1
assert_select ".gem-c-breadcrumbs__item:first-child a[data-track-options='#{expected_tracking_options.to_json}']", 1
end

it "tracks the total breadcrumb count on each breadcrumb" do
Expand All @@ -69,9 +69,9 @@ def assert_link_with_text_in(selector, link, text)
{ dimension28: "3", dimension29: "Section 3" },
]

assert_select ".gem-c-breadcrumbs--item:nth-child(1) a[data-track-options='#{expected_tracking_options[0].to_json}']", 1
assert_select ".gem-c-breadcrumbs--item:nth-child(2) a[data-track-options='#{expected_tracking_options[1].to_json}']", 1
assert_select ".gem-c-breadcrumbs--item:nth-child(3) a[data-track-options='#{expected_tracking_options[2].to_json}']", 1
assert_select ".gem-c-breadcrumbs__item:nth-child(1) a[data-track-options='#{expected_tracking_options[0].to_json}']", 1
assert_select ".gem-c-breadcrumbs__item:nth-child(2) a[data-track-options='#{expected_tracking_options[1].to_json}']", 1
assert_select ".gem-c-breadcrumbs__item:nth-child(3) a[data-track-options='#{expected_tracking_options[2].to_json}']", 1
end

it "renders a list of breadcrumbs" do
Expand All @@ -81,9 +81,9 @@ def assert_link_with_text_in(selector, link, text)
{ title: 'Sub-section', url: '/sub-section' },
])

assert_link_with_text_in('.gem-c-breadcrumbs--item:first-child', '/', 'Home')
assert_link_with_text_in('.gem-c-breadcrumbs--item:first-child + li', '/section', 'Section')
assert_link_with_text_in('.gem-c-breadcrumbs--item:last-child', '/sub-section', 'Sub-section')
assert_link_with_text_in('.gem-c-breadcrumbs__item:first-child', '/', 'Home')
assert_link_with_text_in('.gem-c-breadcrumbs__item:first-child + li', '/section', 'Section')
assert_link_with_text_in('.gem-c-breadcrumbs__item:last-child', '/sub-section', 'Sub-section')
end

it "renders inverted breadcrumbs when passed a flag" do
Expand All @@ -102,6 +102,6 @@ def assert_link_with_text_in(selector, link, text)
{ title: 'Current Page' },
]
)
assert_select('.gem-c-breadcrumbs--item:last-child', 'Current Page')
assert_select('.gem-c-breadcrumbs__item:last-child', 'Current Page')
end
end