slimmer 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # 3.1.0
2
2
 
3
- * 'Breadcrumb' trail is now populated from the artefact data. It adds the section.
4
- subsection, and title.
3
+ * 'Breadcrumb' trail is now populated from the artefact data. It adds the section and subsection.
5
4
 
6
5
  # 3.0.0
7
6
 
@@ -10,7 +10,6 @@ module Slimmer::Processors
10
10
  append_tag(list, section["parent"]) if section["parent"]
11
11
  append_tag(list, section)
12
12
  end
13
- append_text(list, @artefact.title) if @artefact.title and @artefact.title !~ /\A\s*\z/
14
13
  end
15
14
  end
16
15
 
@@ -26,12 +25,5 @@ module Slimmer::Processors
26
25
 
27
26
  list.add_child(list_item)
28
27
  end
29
-
30
- def append_text(list, text)
31
- list_item = Nokogiri::XML::Node.new('li', list)
32
- list_item.content = text
33
-
34
- list.add_child(list_item)
35
- end
36
28
  end
37
29
  end
@@ -1,3 +1,3 @@
1
1
  module Slimmer
2
- VERSION = '3.1.0'
2
+ VERSION = '3.1.1'
3
3
  end
@@ -17,7 +17,7 @@
17
17
  <a href="<%= h item.web_url %>"><%= h item.title %></a>
18
18
  </li>
19
19
  <% end %>
20
- <% if root_section = artefact.root_primary_section %>
20
+ <% if root_section = artefact.primary_root_section %>
21
21
  <li class="related-topic"><a href="<%= h root_section["content_with_tag"]["web_url"] %>"
22
22
  >More from the <span><%= h root_section["title"] %></span> category</a></li>
23
23
  <% end %>
@@ -19,8 +19,7 @@ class SectionInserterTest < MiniTest::Unit::TestCase
19
19
 
20
20
  def test_should_add_section_link_and_title_to_breadcrumb
21
21
  artefact = create_artefact("something",
22
- "section_slug" => "business",
23
- "title" => "Something gooey")
22
+ "section_slug" => "business")
24
23
 
25
24
  template = as_nokogiri %{
26
25
  <html>
@@ -40,14 +39,12 @@ class SectionInserterTest < MiniTest::Unit::TestCase
40
39
  list = template.at_css(".header-context nav[role=navigation] ol")
41
40
  assert_in list, "li:nth-child(1)", %{<a href="/">Home</a>}
42
41
  assert_in list, "li:nth-child(2)", %{<a href="https://www.test.gov.uk/browse/business">Business</a>}
43
- assert_in list, "li:nth-child(3)", %{Something gooey}
44
42
  end
45
43
 
46
44
  def test_should_add_section_link_subsection_link_and_title_to_breadcrumb
47
45
  artefact = create_artefact("something",
48
46
  "section_slug" => "business",
49
- "subsection_slug" => "employing-people",
50
- "title" => "Something gooey")
47
+ "subsection_slug" => "employing-people")
51
48
 
52
49
  template = as_nokogiri %{
53
50
  <html>
@@ -66,47 +63,12 @@ class SectionInserterTest < MiniTest::Unit::TestCase
66
63
  assert_in list, "li:nth-child(1)", %{<a href="/">Home</a>}
67
64
  assert_in list, "li:nth-child(2)", %{<a href="https://www.test.gov.uk/browse/business">Business</a>}
68
65
  assert_in list, "li:nth-child(3)", %{<a href="https://www.test.gov.uk/browse/business/employing-people">Employing people</a>}
69
- assert_in list, "li:nth-child(4)", %{Something gooey}
70
- end
71
-
72
- def test_should_not_append_title_if_its_blank
73
- artefact = create_artefact("something",
74
- "section_slug" => "business",
75
- "subsection_slug" => "employing-people",
76
- "title" => nil)
77
-
78
- template = as_nokogiri %{
79
- <html>
80
- <body>
81
- <div class="header-context">
82
- <nav role="navigation">
83
- <ol class="group"><li><a href="/">Home</a></li></ol>
84
- </nav>
85
- </div>
86
- </body>
87
- </html>
88
- }
89
-
90
- t = template.dup
91
- Slimmer::Processors::SectionInserter.new(artefact).filter(:any_source, t)
92
- list = t.at_css(".header-context nav[role=navigation] ol")
93
- assert_not_in list, "li:nth-child(4)"
94
-
95
- artefact = create_artefact("something",
96
- "section_slug" => "business",
97
- "subsection_slug" => "employing-people",
98
- "title" => "")
99
-
100
- Slimmer::Processors::SectionInserter.new(artefact).filter(:any_source, template)
101
- list = template.at_css(".header-context nav[role=navigation] ol")
102
- assert_not_in list, "li:nth-child(4)"
103
66
  end
104
67
 
105
68
  def test_should_add_links_after_last_item_in_breadcrumb
106
69
  artefact = create_artefact("something",
107
70
  "section_slug" => "business",
108
- "subsection_slug" => "employing-people",
109
- "title" => "Something gooey")
71
+ "subsection_slug" => "employing-people")
110
72
 
111
73
  template = as_nokogiri %{
112
74
  <html>
@@ -129,7 +91,6 @@ class SectionInserterTest < MiniTest::Unit::TestCase
129
91
  assert_in list, "li:nth-child(2)", %{<a href="/browse">All Sections</a>}
130
92
  assert_in list, "li:nth-child(3)", %{<a href="https://www.test.gov.uk/browse/business">Business</a>}
131
93
  assert_in list, "li:nth-child(4)", %{<a href="https://www.test.gov.uk/browse/business/employing-people">Employing people</a>}
132
- assert_in list, "li:nth-child(5)", %{Something gooey}
133
94
  end
134
95
 
135
96
  def test_should_do_nothing_if_navigation_not_in_template
@@ -165,8 +126,7 @@ class SectionInserterTest < MiniTest::Unit::TestCase
165
126
  end
166
127
 
167
128
  def test_should_not_fail_with_no_sections
168
- artefact = create_artefact("something",
169
- "title" => "Something gooey")
129
+ artefact = create_artefact("something")
170
130
 
171
131
  template = as_nokogiri %{
172
132
  <html>
@@ -185,6 +145,5 @@ class SectionInserterTest < MiniTest::Unit::TestCase
185
145
  Slimmer::Processors::SectionInserter.new(artefact).filter(:any_source, template)
186
146
  list = template.at_css(".header-context nav[role=navigation] ol")
187
147
  assert_in list, "li:nth-child(1)", %{<a href="/">Home</a>}
188
- assert_in list, "li:nth-child(2)", %{Something gooey}
189
148
  end
190
149
  end
@@ -112,7 +112,6 @@ module TypicalUsage
112
112
 
113
113
  def test_should_insert_section_links_into_the_navigation
114
114
  assert_rendered_in_template "nav[role=navigation] li a[href='https://www.test.gov.uk/browse/this-section']", "This section"
115
- assert_rendered_in_template "nav[role=navigation] li:last-child", "Some article"
116
115
  end
117
116
 
118
117
  def test_should_add_logo_classes_to_wrapper
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: slimmer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.1.0
5
+ version: 3.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ben Griffiths
@@ -217,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
217
  requirements:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
- hash: 2041451578136689132
220
+ hash: -2539638205319737760
221
221
  segments:
222
222
  - 0
223
223
  version: "0"
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ">="
228
228
  - !ruby/object:Gem::Version
229
- hash: 2041451578136689132
229
+ hash: -2539638205319737760
230
230
  segments:
231
231
  - 0
232
232
  version: "0"