govspeak 8.8.3 → 10.0.0

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
  SHA256:
3
- metadata.gz: ce925a76848a185792f6437ff7aab6b040012b0505901a154d2ccd6537700335
4
- data.tar.gz: 2bf3201946f0d8523bd5ec039e2c8c1b8be6febb90bfadf2c66bdc353eb9f144
3
+ metadata.gz: 4b920cf6948fc17a6bc0046c71bc4a92cde77dd1f1fab57b58be2d8a4d077ea9
4
+ data.tar.gz: d60959650aae08193cfedc1ad48cf1a6e3eb65c584b825d60701c2bbdf0dae31
5
5
  SHA512:
6
- metadata.gz: 587a8a16641f0ed9980e1ffdccc4bc210c2e0c7690e1e0a85d1415bed5a8a1cd5010fd3b25ed482df3fe062ae304205d41c80fbe04ebe37dee9fb5294337a8e8
7
- data.tar.gz: 64b061a60ac3175f81faf6075b6df2c52a51bf9aa4465837fc690222171f18a6e8940b5b9ee8e1a6a5af4560c2e440682a380c6fc12d087d970bb3fe13e4973b
6
+ metadata.gz: bc7e37cc770324bad3ad12fadba04eeb24fcf894411b052312029753a5532e647006f417e77f3080ea88c8ff43b67ad7c1f9834a9bc14ffa9e983cc1e59f2360
7
+ data.tar.gz: 9c93d9f23dfc2387b64f3280a431b28f110737b784811c31aa58a5045cb18797a0eac13fb18c3579393aa5c07054e6739ed9f9035e57b95353ee75d00acb16f8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 10.0.0
4
+
5
+ * Drop support for Ruby <3.2
6
+ * Drop support for govuk_publishing_components <43.0.0
7
+
8
+ ## 9.0.0
9
+
10
+ * Remove Advisory component ([#357](https://github.com/alphagov/govspeak/pull/357))
11
+
3
12
  ## 8.8.3
4
13
 
5
14
  * Update dependencies (actionview < 8.0.2, sanitize < 8, rubocop-govuk = 5.0.7)
data/README.md CHANGED
@@ -81,18 +81,6 @@ creates an example box
81
81
 
82
82
  ## Highlights
83
83
 
84
- ### Advisory (DEPRECATED: marked for removal. Use 'Information callouts' instead.)
85
-
86
- @This is a very important message or warning@
87
-
88
- highlights the enclosed text in yellow
89
-
90
- ```html
91
- <h3 role="note" aria-label="Important" class="advisory">
92
- <span>This is a very important message or warning</span>
93
- </h3>
94
- ```
95
-
96
84
  ### Answer (DEPRECATED: marked for removal)
97
85
 
98
86
  {::highlight-answer}
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "8.8.3".freeze
2
+ VERSION = "10.0.0".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -201,10 +201,6 @@ module Govspeak
201
201
  #{Govspeak::Document.new(body.strip).to_html}</div>\n)
202
202
  end
203
203
 
204
- extension("important", surrounded_by("@")) do |body|
205
- %(\n\n<div role="note" aria-label="Important" class="advisory">#{insert_strong_inside_p(body)}</div>\n)
206
- end
207
-
208
204
  extension("helpful", surrounded_by("%")) do |body|
209
205
  %(\n\n<div role="note" aria-label="Warning" class="application-notice help-notice">\n#{Govspeak::Document.new(body.strip).to_html}</div>\n)
210
206
  end
@@ -17,7 +17,7 @@ class GovspeakAttachmentTest < Minitest::Test
17
17
  }
18
18
 
19
19
  rendered = render_govspeak("[Attachment:attachment.pdf]", [attachment])
20
- assert_match(/<section class="gem-c-attachment/, rendered)
20
+ assert html_has_selector?(rendered, "section.gem-c-attachment")
21
21
  assert_match(/Attachment Title/, rendered)
22
22
  end
23
23
 
@@ -29,7 +29,7 @@ class GovspeakAttachmentTest < Minitest::Test
29
29
  }
30
30
 
31
31
  rendered = render_govspeak("[Attachment: This is the name of my &%$@€? attachment]", [attachment])
32
- assert_match(/<section class="gem-c-attachment/, rendered)
32
+ assert html_has_selector?(rendered, "section.gem-c-attachment")
33
33
  assert_match(/Attachment Title/, rendered)
34
34
  end
35
35
 
@@ -44,12 +44,12 @@ class GovspeakAttachmentTest < Minitest::Test
44
44
  assert_equal("<p>some text [Attachment:attachment.pdf]</p>\n", rendered)
45
45
 
46
46
  rendered = render_govspeak("[Attachment:attachment.pdf] some text", [attachment])
47
- assert_match(/<section class="gem-c-attachment/, rendered)
47
+ assert html_has_selector?(rendered, "section.gem-c-attachment")
48
48
  assert_match(/<p>some text<\/p>/, rendered)
49
49
 
50
50
  rendered = render_govspeak("some text\n[Attachment:attachment.pdf]\nsome more text", [attachment])
51
51
  assert_match(/<p>some text<\/p>/, rendered)
52
- assert_match(/<section class="gem-c-attachment/, rendered)
52
+ assert html_has_selector?(rendered, "section.gem-c-attachment")
53
53
  assert_match(/<p>some more text<\/p>/, rendered)
54
54
  end
55
55
  end
@@ -209,27 +209,6 @@ Teston
209
209
  assert_text_output "I am very informational"
210
210
  end
211
211
 
212
- test_given_govspeak "@ I am very important @" do
213
- assert_html_output %(
214
- <div role="note" aria-label="Important" class="advisory">
215
- <p><strong>I am very important</strong></p>
216
- </div>)
217
- assert_text_output "I am very important"
218
- end
219
-
220
- test_given_govspeak "
221
- The following is very important
222
- @ I am very important @
223
- " do
224
- assert_html_output %(
225
- <p>The following is very important</p>
226
-
227
- <div role="note" aria-label="Important" class="advisory">
228
- <p><strong>I am very important</strong></p>
229
- </div>)
230
- assert_text_output "The following is very important I am very important"
231
- end
232
-
233
212
  test_given_govspeak "% I am very helpful %" do
234
213
  assert_html_output %(
235
214
  <div role="note" aria-label="Warning" class="application-notice help-notice">
@@ -1527,14 +1506,6 @@ Teston
1527
1506
  '
1528
1507
  end
1529
1508
 
1530
- test_given_govspeak "@ Message with [a link](http://foo.bar/)@" do
1531
- assert_html_output %(
1532
- <div role="note" aria-label="Important" class="advisory">
1533
- <p><strong>Message with <a rel="external" href="http://foo.bar/">a link</a></strong></p>
1534
- </div>
1535
- )
1536
- end
1537
-
1538
1509
  test "sanitize source input by default" do
1539
1510
  document = Govspeak::Document.new("<script>doBadThings();</script>")
1540
1511
  assert_equal "", document.to_html.strip
@@ -0,0 +1,10 @@
1
+ module HtmlHelpers
2
+ def html_has_selector?(html_string, selector)
3
+ return false if html_string.nil? || html_string.empty?
4
+
5
+ raise "No selector specified" if selector.nil? || selector.empty?
6
+
7
+ fragment = Nokogiri::HTML.fragment(html_string)
8
+ fragment.css(selector).any?
9
+ end
10
+ end
data/test/test_helper.rb CHANGED
@@ -9,7 +9,11 @@ Bundler.setup :default, :development, :test
9
9
 
10
10
  require "minitest/autorun"
11
11
 
12
+ require "support/html_helpers"
13
+
12
14
  class Minitest::Test
15
+ include HtmlHelpers
16
+
13
17
  class << self
14
18
  def test(name, &block)
15
19
  clean_name = name.gsub(/\s+/, "_")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govspeak
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.8.3
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-03 00:00:00.000000000 Z
10
+ date: 2025-01-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: actionview
@@ -55,14 +55,14 @@ dependencies:
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: '35.1'
58
+ version: '43'
59
59
  type: :runtime
60
60
  prerelease: false
61
61
  version_requirements: !ruby/object:Gem::Requirement
62
62
  requirements:
63
63
  - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: '35.1'
65
+ version: '43'
66
66
  - !ruby/object:Gem::Dependency
67
67
  name: htmlentities
68
68
  requirement: !ruby/object:Gem::Requirement
@@ -330,6 +330,7 @@ files:
330
330
  - test/html_sanitizer_test.rb
331
331
  - test/html_validator_test.rb
332
332
  - test/presenters/h_card_presenter_test.rb
333
+ - test/support/html_helpers.rb
333
334
  - test/test_helper.rb
334
335
  homepage: http://github.com/alphagov/govspeak
335
336
  licenses: []
@@ -341,14 +342,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
341
342
  requirements:
342
343
  - - ">="
343
344
  - !ruby/object:Gem::Version
344
- version: 3.1.4
345
+ version: '3.2'
345
346
  required_rubygems_version: !ruby/object:Gem::Requirement
346
347
  requirements:
347
348
  - - ">="
348
349
  - !ruby/object:Gem::Version
349
350
  version: '0'
350
351
  requirements: []
351
- rubygems_version: 3.6.2
352
+ rubygems_version: 3.6.3
352
353
  specification_version: 4
353
354
  summary: Markup language for single domain
354
355
  test_files:
@@ -372,4 +373,5 @@ test_files:
372
373
  - test/html_sanitizer_test.rb
373
374
  - test/html_validator_test.rb
374
375
  - test/presenters/h_card_presenter_test.rb
376
+ - test/support/html_helpers.rb
375
377
  - test/test_helper.rb