govspeak 6.5.4 → 6.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,7 @@ class GovspeakLinkExtractorTest < Minitest::Test
40
40
  end
41
41
 
42
42
  test "Links are extracted from the body" do
43
- expected_links = %w{http://www.example.com http://www.gov.com /cais-trwydded-yrru-dros-dro http://www.example.com/from/html}
43
+ expected_links = %w[http://www.example.com http://www.gov.com /cais-trwydded-yrru-dros-dro http://www.example.com/from/html]
44
44
  assert_equal expected_links, links
45
45
  end
46
46
 
@@ -1,5 +1,3 @@
1
- # encoding: UTF-8
2
-
3
1
  require "test_helper"
4
2
 
5
3
  class GovspeakLinkTest < Minitest::Test
@@ -2,7 +2,7 @@ require "test_helper"
2
2
 
3
3
  class GovspeakStructuredHeadersTest < Minitest::Test
4
4
  def document_body
5
- %{
5
+ %(
6
6
  ## Heading 1
7
7
 
8
8
  ## Heading 2
@@ -29,7 +29,7 @@ class GovspeakStructuredHeadersTest < Minitest::Test
29
29
 
30
30
  ## Heading 5
31
31
 
32
- }
32
+ )
33
33
  end
34
34
 
35
35
  def doc
@@ -96,8 +96,9 @@ class GovspeakStructuredHeadersTest < Minitest::Test
96
96
  },
97
97
  {
98
98
  text: "Sub heading 2.3",
99
- level: 3, id: "sub-heading-23",
100
- headers: []
99
+ level: 3,
100
+ id: "sub-heading-23",
101
+ headers: [],
101
102
  },
102
103
  ],
103
104
  }
@@ -2,7 +2,7 @@ require "test_helper"
2
2
 
3
3
  class GovspeakTableWithHeadersTest < Minitest::Test
4
4
  def expected_outcome
5
- %{
5
+ %(
6
6
  <table>
7
7
  <thead>
8
8
  <tr>
@@ -24,11 +24,11 @@ class GovspeakTableWithHeadersTest < Minitest::Test
24
24
  </tr>
25
25
  </tbody>
26
26
  </table>
27
- }
27
+ )
28
28
  end
29
29
 
30
30
  def expected_outcome_with_hashes_in_cell_contents
31
- %{
31
+ %(
32
32
  <table>
33
33
  <thead>
34
34
  <tr>
@@ -50,11 +50,11 @@ class GovspeakTableWithHeadersTest < Minitest::Test
50
50
  </tr>
51
51
  </tbody>
52
52
  </table>
53
- }
53
+ )
54
54
  end
55
55
 
56
56
  def expected_outcome_for_table_with_alignments
57
- %{
57
+ %(
58
58
  <table>
59
59
  <thead>
60
60
  <tr>
@@ -76,11 +76,11 @@ class GovspeakTableWithHeadersTest < Minitest::Test
76
76
  </tr>
77
77
  </tbody>
78
78
  </table>
79
- }
79
+ )
80
80
  end
81
81
 
82
82
  def expected_outcome_for_table_headers_in_the_wrong_place
83
- %{
83
+ %(
84
84
  <table>
85
85
  <thead>
86
86
  <tr>
@@ -102,11 +102,11 @@ class GovspeakTableWithHeadersTest < Minitest::Test
102
102
  </tr>
103
103
  </tbody>
104
104
  </table>
105
- }
105
+ )
106
106
  end
107
107
 
108
108
  def expected_outcome_for_table_with_blank_table_headers
109
- %{
109
+ %(
110
110
  <table>
111
111
  <thead>
112
112
  <tr>
@@ -128,52 +128,95 @@ class GovspeakTableWithHeadersTest < Minitest::Test
128
128
  </tr>
129
129
  </tbody>
130
130
  </table>
131
- }
131
+ )
132
+ end
133
+
134
+ def expected_outcome_for_table_headers_containing_links
135
+ %(
136
+ <table>
137
+ <thead>
138
+ <tr>
139
+ <td></td>
140
+ <th scope="col">Second Column</th>
141
+ <th scope="col">Third Column</th>
142
+ </tr>
143
+ </thead>
144
+ <tbody>
145
+ <tr>
146
+ <th scope="row">Link contained in header <a rel="external" href="http://google.com">link1</a>
147
+ </th>
148
+ <td>Cell</td>
149
+ <td>Cell</td>
150
+ </tr>
151
+ <tr>
152
+ <th scope="row">No link</th>
153
+ <td>Cell</td>
154
+ <td>Cell</td>
155
+ </tr>
156
+ <tr>
157
+ <th scope="row"><a rel="external" href="http://www.bbc.co.uk">Whole header is link</a>
158
+ </th>
159
+ <td>Cell</td>
160
+ <td>Cell</td>
161
+ </tr>
162
+ </tbody>
163
+ </table>
164
+ )
132
165
  end
133
166
 
134
167
  def document_body_with_hashes_for_all_headers
135
- @document_body_with_hashes_for_all_headers ||= Govspeak::Document.new(%{
168
+ @document_body_with_hashes_for_all_headers ||= Govspeak::Document.new(%(
136
169
  | |# Second Column |# Third Column |
137
170
  | --------------- | --------------- | ------------------- |
138
171
  |# First row | Cell | Cell |
139
172
  |# Second row | Cell | Cell |
140
- })
173
+ ))
141
174
  end
142
175
 
143
176
  def document_body_with_hashes_for_row_headers
144
- @document_body_with_hashes_for_row_headers ||= Govspeak::Document.new(%{
177
+ @document_body_with_hashes_for_row_headers ||= Govspeak::Document.new(%(
145
178
  | | Second Column | Third Column |
146
179
  | --------------- | --------------- | ------------------- |
147
180
  |# First row | Cell | Cell |
148
181
  |# Second row | Cell | Cell |
149
- })
182
+ ))
150
183
  end
151
184
 
152
185
  def document_body_with_alignments
153
- @document_body_with_alignments ||= Govspeak::Document.new(%{
186
+ @document_body_with_alignments ||= Govspeak::Document.new(%(
154
187
  | | Second Column | Third Column |
155
188
  | :-------------- | :-------------: | ------------------: |
156
189
  |# First row | Cell | Cell |
157
190
  |# Second row | Cell | Cell |
158
- })
191
+ ))
159
192
  end
160
193
 
161
194
  def document_body_with_table_headers_in_the_wrong_place
162
- @document_body_with_table_headers_in_the_wrong_place ||= Govspeak::Document.new(%{
195
+ @document_body_with_table_headers_in_the_wrong_place ||= Govspeak::Document.new(%(
163
196
  | | Second Column | Third Column |
164
197
  | --------------- | --------------- | ------------------- |
165
198
  |# First row |# Cell | Cell |
166
199
  |# Second row | Cell |# Cell |
167
- })
200
+ ))
168
201
  end
169
202
 
170
203
  def document_body_with_blank_table_headers
171
- @document_body_with_blank_table_headers ||= Govspeak::Document.new(%{
204
+ @document_body_with_blank_table_headers ||= Govspeak::Document.new(%(
172
205
  | | Second Column | Third Column |
173
206
  | --------------- | --------------- | ------------------- |
174
207
  |# | Cell | Cell |
175
208
  |# Second row | Cell | Cell |
176
- })
209
+ ))
210
+ end
211
+
212
+ def document_body_with_table_headers_containing_links
213
+ @document_body_with_table_headers_containing_links ||= Govspeak::Document.new(%(
214
+ | | Second Column | Third Column |
215
+ | ---------------------------------------------------- | --------------- | ------------------- |
216
+ |# Link contained in header [link1](http://google.com) | Cell | Cell |
217
+ |# No link | Cell | Cell |
218
+ |# [Whole header is link](http://www.bbc.co.uk) | Cell | Cell |
219
+ ))
177
220
  end
178
221
 
179
222
  test "Cells with |# are headers" do
@@ -192,6 +235,10 @@ class GovspeakTableWithHeadersTest < Minitest::Test
192
235
  assert_equal document_body_with_table_headers_in_the_wrong_place.to_html, expected_outcome_for_table_headers_in_the_wrong_place
193
236
  end
194
237
 
238
+ test "Table headers with a scope of row can have embedded links" do
239
+ assert_equal document_body_with_table_headers_containing_links.to_html, expected_outcome_for_table_headers_containing_links
240
+ end
241
+
195
242
  test "Table headers are not blank" do
196
243
  assert_equal document_body_with_blank_table_headers.to_html, expected_outcome_for_table_with_blank_table_headers
197
244
  end
@@ -1,5 +1,3 @@
1
- # encoding: UTF-8
2
-
3
1
  require "test_helper"
4
2
  require "govspeak_test_helper"
5
3
 
@@ -27,22 +25,22 @@ class GovspeakTest < Minitest::Test
27
25
 
28
26
  test "highlight-answer block extension" do
29
27
  rendered = Govspeak::Document.new("this \n{::highlight-answer}Lead in to *BIG TEXT*\n{:/highlight-answer}").to_html
30
- assert_equal %{<p>this</p>\n\n<div class="highlight-answer">\n<p>Lead in to <em>BIG TEXT</em></p>\n</div>\n}, rendered
28
+ assert_equal %(<p>this</p>\n\n<div class="highlight-answer">\n<p>Lead in to <em>BIG TEXT</em></p>\n</div>\n), rendered
31
29
  end
32
30
 
33
31
  test "stat-headline block extension" do
34
32
  rendered = Govspeak::Document.new("this \n{stat-headline}*13.8bn* Age of the universe in years{/stat-headline}").to_html
35
- assert_equal %{<p>this</p>\n\n<aside class="stat-headline">\n<p><em>13.8bn</em> Age of the universe in years</p>\n</aside>\n}, rendered
33
+ assert_equal %(<p>this</p>\n\n<aside class="stat-headline">\n<p><em>13.8bn</em> Age of the universe in years</p>\n</aside>\n), rendered
36
34
  end
37
35
 
38
36
  test "extracts headers with text, level and generated id" do
39
- document = Govspeak::Document.new %{
37
+ document = Govspeak::Document.new %(
40
38
  # Big title
41
39
 
42
40
  ### Small subtitle
43
41
 
44
42
  ## Medium title
45
- }
43
+ )
46
44
  assert_equal [
47
45
  Govspeak::Header.new("Big title", 1, "big-title"),
48
46
  Govspeak::Header.new("Small subtitle", 3, "small-subtitle"),
@@ -59,7 +57,7 @@ class GovspeakTest < Minitest::Test
59
57
  end
60
58
 
61
59
  test "extracts headers when nested inside blocks" do
62
- document = Govspeak::Document.new %{
60
+ document = Govspeak::Document.new %(
63
61
  # First title
64
62
 
65
63
  <div markdown="1">
@@ -74,7 +72,7 @@ class GovspeakTest < Minitest::Test
74
72
  ### Second double subtitle
75
73
  </div>
76
74
  </div>
77
- }
75
+ )
78
76
  assert_equal [
79
77
  Govspeak::Header.new("First title", 1, "first-title"),
80
78
  Govspeak::Header.new("Nested subtitle", 2, "nested-subtitle"),
@@ -84,11 +82,11 @@ class GovspeakTest < Minitest::Test
84
82
  end
85
83
 
86
84
  test "extracts headers with explicitly specified ids" do
87
- document = Govspeak::Document.new %{
85
+ document = Govspeak::Document.new %(
88
86
  # First title
89
87
 
90
88
  ## Second title {#special}
91
- }
89
+ )
92
90
  assert_equal [
93
91
  Govspeak::Header.new("First title", 1, "first-title"),
94
92
  Govspeak::Header.new("Second title", 2, "special"),
@@ -102,13 +100,13 @@ class GovspeakTest < Minitest::Test
102
100
  end
103
101
 
104
102
  test "trailing space after the address should not prevent parsing" do
105
- input = %{$A
103
+ input = %($A
106
104
  123 Test Street
107
105
  Testcase Cliffs
108
106
  Teston
109
- 0123 456 7890 $A }
107
+ 0123 456 7890 $A )
110
108
  doc = Govspeak::Document.new(input)
111
- assert_equal %{\n<div class="address"><div class="adr org fn"><p>\n123 Test Street<br>Testcase Cliffs<br>Teston<br>0123 456 7890 \n</p></div></div>\n}, doc.to_html
109
+ assert_equal %(\n<div class="address"><div class="adr org fn"><p>\n123 Test Street<br>Testcase Cliffs<br>Teston<br>0123 456 7890 \n</p></div></div>\n), doc.to_html
112
110
  end
113
111
 
114
112
  test "should convert barchart" do
@@ -119,7 +117,7 @@ Teston
119
117
  {barchart}
120
118
  GOVSPEAK
121
119
  html = Govspeak::Document.new(input).to_html
122
- assert_equal %{<table class=\"js-barchart-table mc-auto-outdent\">\n <thead>\n <tr>\n <th scope="col">col</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>val</td>\n </tr>\n </tbody>\n</table>\n}, html
120
+ assert_equal %(<table class=\"js-barchart-table mc-auto-outdent\">\n <thead>\n <tr>\n <th scope="col">col</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>val</td>\n </tr>\n </tbody>\n</table>\n), html
123
121
  end
124
122
 
125
123
  test "should convert barchart with stacked compact and negative" do
@@ -130,27 +128,27 @@ Teston
130
128
  {barchart stacked compact negative}
131
129
  GOVSPEAK
132
130
  html = Govspeak::Document.new(input).to_html
133
- assert_equal %{<table class=\"js-barchart-table mc-stacked compact mc-negative mc-auto-outdent\">\n <thead>\n <tr>\n <th scope="col">col</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>val</td>\n </tr>\n </tbody>\n</table>\n}, html
131
+ assert_equal %(<table class=\"js-barchart-table mc-stacked compact mc-negative mc-auto-outdent\">\n <thead>\n <tr>\n <th scope="col">col</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>val</td>\n </tr>\n </tbody>\n</table>\n), html
134
132
  end
135
133
 
136
134
  test "address div is separated from paragraph text by a couple of line-breaks" do
137
135
  # else kramdown processes address div as part of paragraph text and escapes HTML
138
- input = %{Paragraph1
136
+ input = %(Paragraph1
139
137
 
140
138
  $A
141
139
  123 Test Street
142
140
  Testcase Cliffs
143
141
  Teston
144
- 0123 456 7890 $A}
142
+ 0123 456 7890 $A)
145
143
  doc = Govspeak::Document.new(input)
146
- assert_equal %{<p>Paragraph1</p>\n\n<div class="address"><div class="adr org fn"><p>\n123 Test Street<br>Testcase Cliffs<br>Teston<br>0123 456 7890 \n</p></div></div>\n}, doc.to_html
144
+ assert_equal %(<p>Paragraph1</p>\n\n<div class="address"><div class="adr org fn"><p>\n123 Test Street<br>Testcase Cliffs<br>Teston<br>0123 456 7890 \n</p></div></div>\n), doc.to_html
147
145
  end
148
146
 
149
147
  test_given_govspeak("^ I am very informational ^") do
150
- assert_html_output %{
148
+ assert_html_output %(
151
149
  <div role="note" aria-label="Information" class="application-notice info-notice">
152
150
  <p>I am very informational</p>
153
- </div>}
151
+ </div>)
154
152
  assert_text_output "I am very informational"
155
153
  end
156
154
 
@@ -161,28 +159,28 @@ Teston
161
159
  end
162
160
 
163
161
  test_given_govspeak "The following is very informational\n^ I am very informational ^" do
164
- assert_html_output %{
162
+ assert_html_output %(
165
163
  <p>The following is very informational</p>
166
164
 
167
165
  <div role="note" aria-label="Information" class="application-notice info-notice">
168
166
  <p>I am very informational</p>
169
- </div>}
167
+ </div>)
170
168
  assert_text_output "The following is very informational I am very informational"
171
169
  end
172
170
 
173
171
  test_given_govspeak "^ I am very informational" do
174
- assert_html_output %{
172
+ assert_html_output %(
175
173
  <div role="note" aria-label="Information" class="application-notice info-notice">
176
174
  <p>I am very informational</p>
177
- </div>}
175
+ </div>)
178
176
  assert_text_output "I am very informational"
179
177
  end
180
178
 
181
179
  test_given_govspeak "@ I am very important @" do
182
- assert_html_output %{
180
+ assert_html_output %(
183
181
  <div role="note" aria-label="Important" class="advisory">
184
182
  <p><strong>I am very important</strong></p>
185
- </div>}
183
+ </div>)
186
184
  assert_text_output "I am very important"
187
185
  end
188
186
 
@@ -190,50 +188,50 @@ Teston
190
188
  The following is very important
191
189
  @ I am very important @
192
190
  " do
193
- assert_html_output %{
191
+ assert_html_output %(
194
192
  <p>The following is very important</p>
195
193
 
196
194
  <div role="note" aria-label="Important" class="advisory">
197
195
  <p><strong>I am very important</strong></p>
198
- </div>}
196
+ </div>)
199
197
  assert_text_output "The following is very important I am very important"
200
198
  end
201
199
 
202
200
  test_given_govspeak "% I am very helpful %" do
203
- assert_html_output %{
201
+ assert_html_output %(
204
202
  <div role="note" aria-label="Warning" class="application-notice help-notice">
205
203
  <p>I am very helpful</p>
206
- </div>}
204
+ </div>)
207
205
  assert_text_output "I am very helpful"
208
206
  end
209
207
 
210
208
  test_given_govspeak "The following is very helpful\n% I am very helpful %" do
211
- assert_html_output %{
209
+ assert_html_output %(
212
210
  <p>The following is very helpful</p>
213
211
 
214
212
  <div role="note" aria-label="Warning" class="application-notice help-notice">
215
213
  <p>I am very helpful</p>
216
- </div>}
214
+ </div>)
217
215
  assert_text_output "The following is very helpful I am very helpful"
218
216
  end
219
217
 
220
218
  test_given_govspeak "## Hello ##\n\n% I am very helpful %\r\n### Young Workers ###\n\n" do
221
- assert_html_output %{
219
+ assert_html_output %(
222
220
  <h2 id="hello">Hello</h2>
223
221
 
224
222
  <div role="note" aria-label="Warning" class="application-notice help-notice">
225
223
  <p>I am very helpful</p>
226
224
  </div>
227
225
 
228
- <h3 id="young-workers">Young Workers</h3>}
226
+ <h3 id="young-workers">Young Workers</h3>)
229
227
  assert_text_output "Hello I am very helpful Young Workers"
230
228
  end
231
229
 
232
230
  test_given_govspeak "% I am very helpful" do
233
- assert_html_output %{
231
+ assert_html_output %(
234
232
  <div role="note" aria-label="Warning" class="application-notice help-notice">
235
233
  <p>I am very helpful</p>
236
- </div>}
234
+ </div>)
237
235
  assert_text_output "I am very helpful"
238
236
  end
239
237
 
@@ -251,7 +249,7 @@ Teston
251
249
  HTML
252
250
 
253
251
  *[HTML]: Hyper Text Markup Language" do
254
- assert_html_output %{<p><abbr title="Hyper Text Markup Language">HTML</abbr></p>}
252
+ assert_html_output %(<p><abbr title="Hyper Text Markup Language">HTML</abbr></p>)
255
253
  assert_text_output "HTML"
256
254
  end
257
255
 
@@ -311,12 +309,12 @@ Teston
311
309
  end
312
310
 
313
311
  test "should be able to override default 'document_domains' option" do
314
- html = Govspeak::Document.new("[internal link](http://www.not-external.com)", document_domains: %w(www.not-external.com)).to_html
312
+ html = Govspeak::Document.new("[internal link](http://www.not-external.com)", document_domains: %w[www.not-external.com]).to_html
315
313
  refute html.include?('rel="external"'), "should not consider www.not-external.com as an external url"
316
314
  end
317
315
 
318
316
  test "should be able to supply multiple domains for 'document_domains' option" do
319
- html = Govspeak::Document.new("[internal link](http://www.not-external-either.com)", document_domains: %w(www.not-external.com www.not-external-either.com)).to_html
317
+ html = Govspeak::Document.new("[internal link](http://www.not-external-either.com)", document_domains: %w[www.not-external.com www.not-external-either.com]).to_html
320
318
  refute html.include?('rel="external"'), "should not consider www.not-external-either.com as an external url"
321
319
  end
322
320
 
@@ -338,17 +336,17 @@ Teston
338
336
  test "should treat a mailto as internal" do
339
337
  html = Govspeak::Document.new("[link](mailto:a@b.com)").to_html
340
338
  refute html.include?('rel="external"')
341
- assert_equal %{<p><a href="mailto:a@b.com">link</a></p>\n}, deobfuscate_mailto(html)
339
+ assert_equal %(<p><a href="mailto:a@b.com">link</a></p>\n), deobfuscate_mailto(html)
342
340
  end
343
341
 
344
342
  test "permits mailto:// URI" do
345
343
  html = Govspeak::Document.new("[link](mailto://a@b.com)").to_html
346
- assert_equal %{<p><a rel="external" href="mailto://a@b.com">link</a></p>\n}, deobfuscate_mailto(html)
344
+ assert_equal %(<p><a rel="external" href="mailto://a@b.com">link</a></p>\n), deobfuscate_mailto(html)
347
345
  end
348
346
 
349
347
  test "permits dud mailto: URI" do
350
348
  html = Govspeak::Document.new("[link](mailto:)").to_html
351
- assert_equal %{<p><a href="mailto:">link</a></p>\n}, deobfuscate_mailto(html)
349
+ assert_equal %(<p><a href="mailto:">link</a></p>\n), deobfuscate_mailto(html)
352
350
  end
353
351
 
354
352
  test "permits trailing whitespace in an URI" do
@@ -368,18 +366,18 @@ Teston
368
366
  $!
369
367
  rainbow
370
368
  $!" do
371
- assert_html_output %{
369
+ assert_html_output %(
372
370
  <div class="summary">
373
371
  <p>rainbow</p>
374
- </div>}
372
+ </div>)
375
373
  assert_text_output "rainbow"
376
374
  end
377
375
 
378
376
  test_given_govspeak "$C help, send cake $C" do
379
- assert_html_output %{
377
+ assert_html_output %(
380
378
  <div class="contact">
381
379
  <p>help, send cake</p>
382
- </div>}
380
+ </div>)
383
381
  assert_text_output "help, send cake"
384
382
  end
385
383
 
@@ -388,10 +386,10 @@ Teston
388
386
  street
389
387
  road
390
388
  $A" do
391
- assert_html_output %{
389
+ assert_html_output %(
392
390
  <div class="address"><div class="adr org fn"><p>
393
391
  street<br>road<br>
394
- </p></div></div>}
392
+ </p></div></div>)
395
393
  assert_text_output "street road"
396
394
  end
397
395
 
@@ -401,7 +399,7 @@ Teston
401
399
  help
402
400
  $I
403
401
  $P" do
404
- assert_html_output %{<div class="place">\n\n<div class="information">\n<p>help</p>\n</div>\n</div>}
402
+ assert_html_output %(<div class="place">\n\n<div class="information">\n<p>help</p>\n</div>\n</div>)
405
403
  assert_text_output "help"
406
404
  end
407
405
 
@@ -409,10 +407,10 @@ Teston
409
407
  $D
410
408
  can you tell me how to get to...
411
409
  $D" do
412
- assert_html_output %{
410
+ assert_html_output %(
413
411
  <div class="form-download">
414
412
  <p>can you tell me how to get to…</p>
415
- </div>}
413
+ </div>)
416
414
  assert_text_output "can you tell me how to get to…"
417
415
  end
418
416
 
@@ -420,10 +418,10 @@ Teston
420
418
  $CTA
421
419
  Click here to start the tool
422
420
  $CTA" do
423
- assert_html_output %{
421
+ assert_html_output %(
424
422
  <div class="call-to-action">
425
423
  <p>Click here to start the tool</p>
426
- </div>}
424
+ </div>)
427
425
  assert_text_output "Click here to start the tool"
428
426
  end
429
427
 
@@ -434,12 +432,12 @@ Teston
434
432
  Click here to start the tool
435
433
  $CTA
436
434
  " do
437
- assert_html_output %{
435
+ assert_html_output %(
438
436
  <p>Here is some text</p>
439
437
 
440
438
  <div class="call-to-action">
441
439
  <p>Click here to start the tool</p>
442
- </div>}
440
+ </div>)
443
441
  end
444
442
 
445
443
  test_given_govspeak "
@@ -447,13 +445,13 @@ Teston
447
445
 
448
446
  $CTA
449
447
  Click here to start the tool
450
- $CTA", document_domains: %w(www.not-external.com) do
451
- assert_html_output %{
448
+ $CTA", document_domains: %w[www.not-external.com] do
449
+ assert_html_output %(
452
450
  <p><a href="http://www.not-external.com">internal link</a></p>
453
451
 
454
452
  <div class="call-to-action">
455
453
  <p>Click here to start the tool</p>
456
- </div>}
454
+ </div>)
457
455
  end
458
456
 
459
457
  test_given_govspeak "
@@ -469,7 +467,7 @@ Teston
469
467
  s2. bungle
470
468
  s3. george
471
469
  " do
472
- assert_html_output %{
470
+ assert_html_output %(
473
471
  <ol class="steps">
474
472
  <li>
475
473
  <p>zippy</p>
@@ -480,7 +478,7 @@ Teston
480
478
  <li>
481
479
  <p>george</p>
482
480
  </li>
483
- </ol>}
481
+ </ol>)
484
482
  assert_text_output "zippy bungle george"
485
483
  end
486
484
 
@@ -491,7 +489,7 @@ Teston
491
489
  s1. step
492
490
  s2. list
493
491
  " do
494
- assert_html_output %{
492
+ assert_html_output %(
495
493
  <ul>
496
494
  <li>unordered</li>
497
495
  <li>list</li>
@@ -504,7 +502,7 @@ Teston
504
502
  <li>
505
503
  <p>list</p>
506
504
  </li>
507
- </ol>}
505
+ </ol>)
508
506
  assert_text_output "unordered list step list"
509
507
  end
510
508
 
@@ -592,31 +590,31 @@ Teston
592
590
  * 1. jumps over the lazy dog
593
591
  $EndLegislativeList
594
592
  " do
595
- assert_html_output %{
593
+ assert_html_output %(
596
594
  <p>The quick brown fox</p>
597
595
 
598
596
  <ol class="legislative-list">
599
597
  <li>1. jumps over the lazy dog</li>
600
598
  </ol>
601
- }
599
+ )
602
600
  end
603
601
 
604
602
  test_given_govspeak "This bit of text\r\n\r\n$LegislativeList\r\n* 1. should be turned into a list\r\n$EndLegislativeList" do
605
- assert_html_output %{
603
+ assert_html_output %(
606
604
  <p>This bit of text</p>
607
605
 
608
606
  <ol class="legislative-list">
609
607
  <li>1. should be turned into a list</li>
610
608
  </ol>
611
- }
609
+ )
612
610
  end
613
611
 
614
612
  test_given_govspeak "
615
613
  Zippy, Bungle and George did not qualify for the tax exemption in s428. They filled in their tax return accordingly.
616
614
  " do
617
- assert_html_output %{
615
+ assert_html_output %(
618
616
  <p>Zippy, Bungle and George did not qualify for the tax exemption in s428. They filled in their tax return accordingly.</p>
619
- }
617
+ )
620
618
  end
621
619
 
622
620
  test_given_govspeak ":scotland: I am very devolved\n and very scottish \n:scotland:" do
@@ -632,11 +630,11 @@ Teston
632
630
  end
633
631
 
634
632
  test_given_govspeak "@ Message with [a link](http://foo.bar/)@" do
635
- assert_html_output %{
633
+ assert_html_output %(
636
634
  <div role="note" aria-label="Important" class="advisory">
637
635
  <p><strong>Message with <a rel="external" href="http://foo.bar/">a link</a></strong></p>
638
636
  </div>
639
- }
637
+ )
640
638
  end
641
639
 
642
640
  test "sanitize source input by default" do
@@ -659,7 +657,7 @@ Teston
659
657
  assert document.valid?
660
658
  end
661
659
 
662
- expected_priority_list_output = %|
660
+ expected_priority_list_output = %(
663
661
  <ul>
664
662
  <li class="primary-item">List item 1</li>
665
663
  <li class="primary-item">List item 2</li>
@@ -667,7 +665,7 @@ Teston
667
665
  <li>List item 4</li>
668
666
  <li>List item 5</li>
669
667
  </ul>
670
- |
668
+ )
671
669
 
672
670
  test "Single priority list ending with EOF" do
673
671
  govspeak = "$PriorityList:3
@@ -713,7 +711,6 @@ Teston
713
711
  end
714
712
  end
715
713
 
716
-
717
714
  test "Multiple priority lists" do
718
715
  govspeak = "
719
716
  $PriorityList:3
@@ -728,7 +725,7 @@ $PriorityList:1
728
725
  * List item 2"
729
726
 
730
727
  given_govspeak(govspeak) do
731
- assert_html_output %|
728
+ assert_html_output %(
732
729
  <ul>
733
730
  <li class="primary-item">List item 1</li>
734
731
  <li class="primary-item">List item 2</li>
@@ -741,7 +738,7 @@ $PriorityList:1
741
738
  <li class="primary-item">List item 1</li>
742
739
  <li>List item 2</li>
743
740
  </ul>
744
- |
741
+ )
745
742
  end
746
743
  end
747
744
 
@@ -779,7 +776,7 @@ $PriorityList:1
779
776
  * List item 5"
780
777
 
781
778
  given_govspeak(govspeak) do
782
- assert_html_output %|
779
+ assert_html_output %(
783
780
  <p>This is a paragraph</p>
784
781
 
785
782
  <ul>
@@ -789,20 +786,20 @@ $PriorityList:1
789
786
  <li>List item 4</li>
790
787
  <li>List item 5</li>
791
788
  </ul>
792
- |
789
+ )
793
790
  end
794
791
  end
795
792
 
796
793
  test "should remove quotes surrounding a blockquote" do
797
- govspeak = %{
794
+ govspeak = %(
798
795
  He said:
799
796
 
800
797
  > "I'm not sure what you mean!"
801
798
 
802
- Or so we thought.}
799
+ Or so we thought.)
803
800
 
804
801
  given_govspeak(govspeak) do
805
- assert_html_output %|
802
+ assert_html_output %(
806
803
  <p>He said:</p>
807
804
 
808
805
  <blockquote>
@@ -810,7 +807,7 @@ Or so we thought.}
810
807
  </blockquote>
811
808
 
812
809
  <p>Or so we thought.</p>
813
- |
810
+ )
814
811
  end
815
812
  end
816
813
 
@@ -821,13 +818,13 @@ Or so we thought.}
821
818
  > last line"
822
819
 
823
820
  given_govspeak(govspeak) do
824
- assert_html_output %|
821
+ assert_html_output %(
825
822
  <blockquote>
826
823
  <p>first line</p>
827
824
 
828
825
  <p class="last-child">last line</p>
829
826
  </blockquote>
830
- |
827
+ )
831
828
  end
832
829
  end
833
830
  end