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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bca4bbd91b37c781017835bd3cccfb30aadeb3b
4
- data.tar.gz: 182b5d616808d6266e5ce797979d13f1815243b9
3
+ metadata.gz: 068eb3be3f3916e3e73b4e9f9d20fa57f880b400
4
+ data.tar.gz: a5161e592acfd1b4a18969eb0340ec63d5d119e3
5
5
  SHA512:
6
- metadata.gz: 7432a58845c27e69c93c09969a0108cf97e46a90bf4a4eec446d45a59bd9a6d0963bb406ac4a7b4a8050799d8b70de084520f8a58a3b3468d7524e8c4db58d62
7
- data.tar.gz: ef9422f682a57739f806a660cff8d6a60adc29adc43f5eb75b01c4ba62874a5e2597dd48bb8782673a3cc6499655c51561dbf8824a7b32c7ea861ea857df8f21
6
+ metadata.gz: 78ff87bc456090a32b844065d1d682e5654f7623556cb79174586fd0ea5a1013f6dde2fa82370d5d7c166685b44ef5c5dec25057c7bc80832e33b3969f3bc088
7
+ data.tar.gz: 58d2455c36389887901ad9026e9f9338815a0060d5dab7d9a0756587272664c47080f2c0bf0b9b9a6c476b604b69d88c823c5671d982bac7b13de51cf9ef174a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 3.0.2
2
+
3
+ * Sort parent taxons by title before picking the first one for the breadcrumbs.
4
+
1
5
  ## 3.0.1
2
6
 
3
7
  * Return only 3 related items for the taxonomy sidebar.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module GovukNavigationHelpers
2
- VERSION = "3.0.1".freeze
2
+ VERSION = "3.0.2".freeze
3
3
  end
@@ -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.1
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-02 00:00:00.000000000 Z
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