govuk_navigation_helpers 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/govuk_navigation_helpers/content_item.rb +1 -1
- data/lib/govuk_navigation_helpers/version.rb +1 -1
- data/spec/taxon_breadcrumbs_spec.rb +34 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 068eb3be3f3916e3e73b4e9f9d20fa57f880b400
|
4
|
+
data.tar.gz: a5161e592acfd1b4a18969eb0340ec63d5d119e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78ff87bc456090a32b844065d1d682e5654f7623556cb79174586fd0ea5a1013f6dde2fa82370d5d7c166685b44ef5c5dec25057c7bc80832e33b3969f3bc088
|
7
|
+
data.tar.gz: 58d2455c36389887901ad9026e9f9338815a0060d5dab7d9a0756587272664c47080f2c0bf0b9b9a6c476b604b69d88c823c5671d982bac7b13de51cf9ef174a
|
data/CHANGELOG.md
CHANGED
@@ -20,7 +20,7 @@ module GovukNavigationHelpers
|
|
20
20
|
def parent_taxon
|
21
21
|
# TODO: Determine what to do when there are multiple taxons/parents. For
|
22
22
|
# now just display the first of each.
|
23
|
-
parent_taxons.first
|
23
|
+
parent_taxons.sort_by(&:title).first
|
24
24
|
end
|
25
25
|
|
26
26
|
def parent_taxons
|
@@ -98,6 +98,40 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
|
|
98
98
|
)
|
99
99
|
end
|
100
100
|
end
|
101
|
+
|
102
|
+
context 'with multiple parents' do
|
103
|
+
it "selects the first parent taxon in alphabetical order by title" do
|
104
|
+
parent_1 = {
|
105
|
+
"content_id" => "30c1b93d-2553-47c9-bc3c-fc5b513ecc32",
|
106
|
+
"locale" => "en",
|
107
|
+
"title" => "Parent A",
|
108
|
+
"base_path" => "/parent-a",
|
109
|
+
"links" => {
|
110
|
+
"parent_taxons" => []
|
111
|
+
}
|
112
|
+
}
|
113
|
+
parent_2 = {
|
114
|
+
"content_id" => "30c1b93d-2553-47c9-bc3c-fc5b513ecc32",
|
115
|
+
"locale" => "en",
|
116
|
+
"title" => "Parent B",
|
117
|
+
"base_path" => "/parent-b",
|
118
|
+
"links" => {
|
119
|
+
"parent_taxons" => []
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
content_item = taxon_with_parent_taxons([parent_2, parent_1])
|
124
|
+
breadcrumbs = breadcrumbs_for(content_item)
|
125
|
+
|
126
|
+
expect(breadcrumbs).to eq(
|
127
|
+
breadcrumbs: [
|
128
|
+
{ title: "Home", url: "/" },
|
129
|
+
{ title: "Parent A", url: "/parent-a" },
|
130
|
+
{ title: "Taxon", is_current_page: true },
|
131
|
+
]
|
132
|
+
)
|
133
|
+
end
|
134
|
+
end
|
101
135
|
end
|
102
136
|
|
103
137
|
def breadcrumbs_for(content_item)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_navigation_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|