inky-rb 1.3.8.0 → 1.4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/inky.gemspec +5 -5
  3. data/lib/inky/component_factory.rb +15 -8
  4. data/lib/inky/rails/version.rb +1 -1
  5. data/lib/inky.rb +3 -1
  6. data/spec/_cases_output/button/no_link.inky +1 -1
  7. data/spec/_cases_output/button/with_expand_class.inky +3 -3
  8. data/spec/_cases_output/button/with_extra_attr.inky +3 -0
  9. data/spec/_cases_output/button/with_image.inky +2 -2
  10. data/spec/_cases_output/button/with_link.inky +2 -2
  11. data/spec/_cases_output/button/with_link_and_extra_attr.inky +3 -0
  12. data/spec/_cases_output/button/with_tricky_class.inky +13 -13
  13. data/spec/_cases_output/callout/basic.inky +1 -1
  14. data/spec/_cases_output/callout/with_attributes.inky +2 -2
  15. data/spec/_cases_output/general/multiple_root.inky +2 -2
  16. data/spec/_cases_output/general/root_within_text.inky +5 -1
  17. data/spec/_cases_output/general/void_html_elements.inky +2 -2
  18. data/spec/_cases_output/grid/columns.inky +2 -2
  19. data/spec/_cases_output/grid/row_with_columns.inky +3 -3
  20. data/spec/_cases_output/h_line/basic.inky +1 -0
  21. data/spec/_cases_output/h_line/h_line.inky +2 -0
  22. data/spec/_cases_output/h_line/multiple.inky +3 -0
  23. data/spec/_cases_output/h_line/with_attr.inky +1 -0
  24. data/spec/_cases_output/menu/menu.inky +2 -2
  25. data/spec/_cases_output/menu/menu_with_align.inky +2 -2
  26. data/spec/_cases_output/menu/menu_with_items.inky +2 -2
  27. data/spec/_cases_output/spacer/basic.inky +1 -1
  28. data/spec/_cases_output/spacer/with_attr.inky +6 -0
  29. data/spec/_cases_output/spacer/with_size.inky +1 -1
  30. data/spec/_cases_output/spacer/with_size_lg.inky +1 -1
  31. data/spec/_cases_output/spacer/with_size_sm.inky +1 -1
  32. data/spec/_cases_output/spacer/with_size_sm_and_lg.inky +1 -1
  33. data/spec/_cases_output/spacer/with_sizes_and_attr.inky +6 -0
  34. data/spec/_cases_output/wrapper/basic.inky +1 -1
  35. data/spec/_cases_output/wrapper/with_align.inky +1 -1
  36. data/spec/_cases_output/wrapper/with_attributes.inky +1 -1
  37. data/spec/cases/button/with_extra_attr.inky +3 -0
  38. data/spec/cases/button/with_link.inky +1 -1
  39. data/spec/cases/button/with_link_and_extra_attr.inky +3 -0
  40. data/spec/cases/h_line/basic.inky +1 -0
  41. data/spec/cases/h_line/multiple.inky +8 -0
  42. data/spec/cases/h_line/with_attr.inky +2 -0
  43. data/spec/cases/spacer/with_attr.inky +6 -0
  44. data/spec/cases/spacer/with_size.inky +1 -1
  45. data/spec/cases/spacer/with_size_lg.inky +1 -1
  46. data/spec/cases/spacer/with_size_sm.inky +1 -1
  47. data/spec/cases/spacer/with_size_sm_and_lg.inky +1 -1
  48. data/spec/cases/spacer/with_sizes_and_attr.inky +6 -0
  49. data/spec/components_spec.rb +48 -48
  50. data/spec/grid_spec.rb +38 -38
  51. data/spec/spec_helper.rb +0 -1
  52. data/spec/test_app/log/test.log +663 -0
  53. data/spec/test_app/spec/features/inky_spec.rb +3 -3
  54. metadata +130 -102
@@ -31,19 +31,19 @@ RSpec.describe "Center" do
31
31
 
32
32
  expected = <<-HTML
33
33
  <center>
34
- <table class="float-center menu " align="center">
34
+ <table class="float-center menu " align="center"><tbody>
35
35
  <tr>
36
36
  <td>
37
- <table>
37
+ <table><tbody>
38
38
  <tr>
39
39
  <th class="float-center menu-item">
40
40
  <a href="#"></a>
41
41
  </th>
42
42
  </tr>
43
- </table>
43
+ </tbody></table>
44
44
  </td>
45
45
  </tr>
46
- </table>
46
+ </tbody></table>
47
47
  </center>
48
48
  HTML
49
49
 
@@ -55,17 +55,17 @@ RSpec.describe "Button" do
55
55
  it "creates a simple button" do
56
56
  input = '<button href="http://zurb.com">Button</button>'
57
57
  expected = <<-HTML
58
- <table class="button">
58
+ <table class="button"><tbody>
59
59
  <tr>
60
60
  <td>
61
- <table>
61
+ <table><tbody>
62
62
  <tr>
63
63
  <td><a href="http://zurb.com">Button</a></td>
64
64
  </tr>
65
- </table>
65
+ </tbody></table>
66
66
  </td>
67
67
  </tr>
68
- </table>
68
+ </tbody></table>
69
69
  HTML
70
70
  compare(input, expected)
71
71
  end
@@ -73,17 +73,17 @@ RSpec.describe "Button" do
73
73
  it 'creates a button with target="_blank" attribute' do
74
74
  input = '<button href="http://zurb.com" target="_blank">Button</button>'
75
75
  expected = <<-HTML
76
- <table class="button">
76
+ <table class="button"><tbody>
77
77
  <tr>
78
78
  <td>
79
- <table>
79
+ <table><tbody>
80
80
  <tr>
81
81
  <td><a href="http://zurb.com" target="_blank">Button</a></td>
82
82
  </tr>
83
- </table>
83
+ </tbody></table>
84
84
  </td>
85
85
  </tr>
86
- </table>
86
+ </tbody></table>
87
87
  HTML
88
88
  compare(input, expected)
89
89
  end
@@ -91,17 +91,17 @@ RSpec.describe "Button" do
91
91
  it 'creates a button with classes' do
92
92
  input = '<button class="small alert" href="http://zurb.com">Button</button>'
93
93
  expected = <<-HTML
94
- <table class="button small alert">
94
+ <table class="button small alert"><tbody>
95
95
  <tr>
96
96
  <td>
97
- <table>
97
+ <table><tbody>
98
98
  <tr>
99
99
  <td><a href="http://zurb.com">Button</a></td>
100
100
  </tr>
101
- </table>
101
+ </tbody></table>
102
102
  </td>
103
103
  </tr>
104
- </table>
104
+ </tbody></table>
105
105
  HTML
106
106
 
107
107
  compare(input, expected)
@@ -110,20 +110,20 @@ RSpec.describe "Button" do
110
110
  it 'creates a correct expanded button' do
111
111
  input = '<button class="expand" href="http://zurb.com">Button</button>'
112
112
  expected = <<-HTML
113
- <table class="button expand">
113
+ <table class="button expand"><tbody>
114
114
  <tr>
115
115
  <td>
116
- <table>
116
+ <table><tbody>
117
117
  <tr>
118
118
  <td>
119
119
  <center><a href="http://zurb.com" align="center" class="float-center">Button</a></center>
120
120
  </td>
121
121
  </tr>
122
- </table>
122
+ </tbody></table>
123
123
  </td>
124
124
  <td class="expander"></td>
125
125
  </tr>
126
- </table>
126
+ </tbody></table>
127
127
  HTML
128
128
 
129
129
  compare(input, expected)
@@ -138,17 +138,17 @@ RSpec.describe "Menu" do
138
138
  </menu>
139
139
  INKY
140
140
  expected = <<-HTML
141
- <table class="menu">
141
+ <table class="menu"><tbody>
142
142
  <tr>
143
143
  <td>
144
- <table>
144
+ <table><tbody>
145
145
  <tr>
146
146
  <th class="menu-item"><a href="http://zurb.com">Item</a></th>
147
147
  </tr>
148
- </table>
148
+ </tbody></table>
149
149
  </td>
150
150
  </tr>
151
- </table>
151
+ </tbody></table>
152
152
  HTML
153
153
 
154
154
  compare(input, expected)
@@ -161,17 +161,17 @@ RSpec.describe "Menu" do
161
161
  </menu>
162
162
  INKY
163
163
  expected = <<-HTML
164
- <table class="menu">
164
+ <table class="menu"><tbody>
165
165
  <tr>
166
166
  <td>
167
- <table>
167
+ <table><tbody>
168
168
  <tr>
169
169
  <th class="menu-item"><a href="http://zurb.com" target="_blank">Item</a></th>
170
170
  </tr>
171
- </table>
171
+ </tbody></table>
172
172
  </td>
173
173
  </tr>
174
- </table>
174
+ </tbody></table>
175
175
  HTML
176
176
 
177
177
  compare(input, expected)
@@ -183,16 +183,16 @@ RSpec.describe "Menu" do
183
183
  </menu>
184
184
  INKY
185
185
  expected = <<-HTML
186
- <table class="menu vertical">
186
+ <table class="menu vertical"><tbody>
187
187
  <tr>
188
188
  <td>
189
- <table>
189
+ <table><tbody>
190
190
  <tr>
191
191
  </tr>
192
- </table>
192
+ </tbody></table>
193
193
  </td>
194
194
  </tr>
195
- </table>
195
+ </tbody></table>
196
196
  HTML
197
197
 
198
198
  compare(input, expected)
@@ -205,17 +205,17 @@ RSpec.describe "Menu" do
205
205
  </menu>
206
206
  INKY
207
207
  expected = <<-HTML
208
- <table class="menu">
208
+ <table class="menu"><tbody>
209
209
  <tr>
210
210
  <td>
211
- <table>
211
+ <table><tbody>
212
212
  <tr>
213
213
  <th class="menu-item"><a href="http://zurb.com">Item 1</a></th>
214
214
  </tr>
215
- </table>
215
+ </tbody></table>
216
216
  </td>
217
217
  </tr>
218
- </table>
218
+ </tbody></table>
219
219
  HTML
220
220
 
221
221
  compare(input, expected)
@@ -226,12 +226,12 @@ RSpec.describe "Callout" do
226
226
  it "creates a callout with correct syntax" do
227
227
  input = '<callout>Callout</callout>'
228
228
  expected = <<-HTML
229
- <table class="callout">
229
+ <table class="callout"><tbody>
230
230
  <tr>
231
231
  <th class="callout-inner">Callout</th>
232
232
  <th class="expander"></th>
233
233
  </tr>
234
- </table>
234
+ </tbody></table>
235
235
  HTML
236
236
 
237
237
  compare(input, expected)
@@ -240,12 +240,12 @@ RSpec.describe "Callout" do
240
240
  it "copies classes to the final HTML" do
241
241
  input = '<callout class="primary">Callout</callout>'
242
242
  expected = <<-HTML
243
- <table class="callout">
243
+ <table class="callout"><tbody>
244
244
  <tr>
245
245
  <th class="callout-inner primary">Callout</th>
246
246
  <th class="expander"></th>
247
247
  </tr>
248
- </table>
248
+ </tbody></table>
249
249
  HTML
250
250
 
251
251
  compare(input, expected)
@@ -259,7 +259,7 @@ RSpec.describe "Spacer" do
259
259
  <table class="spacer">
260
260
  <tbody>
261
261
  <tr>
262
- <td height="10" style="font-size:10px;line-height:10px;">&#xA0;</td>
262
+ <td height="10" style="font-size:10px;line-height:10px;">&nbsp;</td>
263
263
  </tr>
264
264
  </tbody>
265
265
  </table>
@@ -274,7 +274,7 @@ RSpec.describe "Spacer" do
274
274
  <table class="spacer hide-for-large">
275
275
  <tbody>
276
276
  <tr>
277
- <td height="10" style="font-size:10px;line-height:10px;">&#xA0;</td>
277
+ <td height="10" style="font-size:10px;line-height:10px;">&nbsp;</td>
278
278
  </tr>
279
279
  </tbody>
280
280
  </table>
@@ -289,7 +289,7 @@ RSpec.describe "Spacer" do
289
289
  <table class="spacer show-for-large">
290
290
  <tbody>
291
291
  <tr>
292
- <td height="20" style="font-size:20px;line-height:20px;">&#xA0;</td>
292
+ <td height="20" style="font-size:20px;line-height:20px;">&nbsp;</td>
293
293
  </tr>
294
294
  </tbody>
295
295
  </table>
@@ -304,14 +304,14 @@ RSpec.describe "Spacer" do
304
304
  <table class="spacer hide-for-large">
305
305
  <tbody>
306
306
  <tr>
307
- <td height="10" style="font-size:10px;line-height:10px;">&#xA0;</td>
307
+ <td height="10" style="font-size:10px;line-height:10px;">&nbsp;</td>
308
308
  </tr>
309
309
  </tbody>
310
310
  </table>
311
311
  <table class="spacer show-for-large">
312
312
  <tbody>
313
313
  <tr>
314
- <td height="20" style="font-size:20px;line-height:20px;">&#xA0;</td>
314
+ <td height="20" style="font-size:20px;line-height:20px;">&nbsp;</td>
315
315
  </tr>
316
316
  </tbody>
317
317
  </table>
@@ -326,7 +326,7 @@ RSpec.describe "Spacer" do
326
326
  <table class="spacer bgcolor">
327
327
  <tbody>
328
328
  <tr>
329
- <td height="10" style="font-size:10px;line-height:10px;">&#xA0;</td>
329
+ <td height="10" style="font-size:10px;line-height:10px;">&nbsp;</td>
330
330
  </tr>
331
331
  </tbody>
332
332
  </table>
@@ -340,11 +340,11 @@ RSpec.describe "Wrapper" do
340
340
  it 'creates a wrapper that you can attach classes to' do
341
341
  input = '<wrapper class="header"></wrapper>'
342
342
  expected = <<-HTML
343
- <table class="wrapper header" align="center">
343
+ <table class="wrapper header" align="center"><tbody>
344
344
  <tr>
345
345
  <td class="wrapper-inner"></td>
346
346
  </tr>
347
- </table>
347
+ </tbody></table>
348
348
  HTML
349
349
 
350
350
  compare(input, expected)
data/spec/grid_spec.rb CHANGED
@@ -61,12 +61,12 @@ RSpec.describe 'Grid' do
61
61
  input = '<columns>One</columns>'
62
62
  expected = <<-HTML
63
63
  <th class="small-12 large-12 columns first last">
64
- <table>
64
+ <table><tbody>
65
65
  <tr>
66
66
  <th>One</th>
67
67
  <th class="expander"></th>
68
68
  </tr>
69
- </table>
69
+ </tbody></table>
70
70
  </th>
71
71
  HTML
72
72
 
@@ -84,12 +84,12 @@ RSpec.describe 'Grid' do
84
84
  input = '<columns>One</columns>'
85
85
  expected = <<-HTML
86
86
  <th class="small-5 large-5 columns first last">
87
- <table>
87
+ <table><tbody>
88
88
  <tr>
89
89
  <th>One</th>
90
90
  <th class="expander"></th>
91
91
  </tr>
92
- </table>
92
+ </tbody></table>
93
93
  </th>
94
94
  HTML
95
95
 
@@ -105,12 +105,12 @@ RSpec.describe 'Grid' do
105
105
  input = '<columns large="12" small="12">One</columns>'
106
106
  expected = <<-HTML
107
107
  <th class="small-12 large-12 columns first last">
108
- <table>
108
+ <table><tbody>
109
109
  <tr>
110
110
  <th>One</th>
111
111
  <th class="expander"></th>
112
112
  </tr>
113
- </table>
113
+ </tbody></table>
114
114
  </th>
115
115
  HTML
116
116
 
@@ -127,18 +127,18 @@ RSpec.describe 'Grid' do
127
127
  expected = <<-HTML
128
128
  <body>
129
129
  <th class="small-12 large-6 columns first">
130
- <table>
130
+ <table><tbody>
131
131
  <tr>
132
132
  <th>One</th>
133
133
  </tr>
134
- </table>
134
+ </tbody></table>
135
135
  </th>
136
136
  <th class="small-12 large-6 columns last">
137
- <table>
137
+ <table><tbody>
138
138
  <tr>
139
139
  <th>Two</th>
140
140
  </tr>
141
- </table>
141
+ </tbody></table>
142
142
  </th>
143
143
  </body>
144
144
  HTML
@@ -157,25 +157,25 @@ RSpec.describe 'Grid' do
157
157
  expected = <<-INKY
158
158
  <body>
159
159
  <th class="small-12 large-4 columns first">
160
- <table>
160
+ <table><tbody>
161
161
  <tr>
162
162
  <th>One</th>
163
163
  </tr>
164
- </table>
164
+ </tbody></table>
165
165
  </th>
166
166
  <th class="small-12 large-4 columns">
167
- <table>
167
+ <table><tbody>
168
168
  <tr>
169
169
  <th>Two</th>
170
170
  </tr>
171
- </table>
171
+ </tbody></table>
172
172
  </th>
173
173
  <th class="small-12 large-4 columns last">
174
- <table>
174
+ <table><tbody>
175
175
  <tr>
176
176
  <th>Three</th>
177
177
  </tr>
178
- </table>
178
+ </tbody></table>
179
179
  </th>
180
180
  </body>
181
181
  INKY
@@ -187,12 +187,12 @@ RSpec.describe 'Grid' do
187
187
  input = '<columns class="small-offset-8 hide-for-small">One</columns>'
188
188
  expected = <<-HTML
189
189
  <th class="small-12 large-12 columns small-offset-8 hide-for-small first last">
190
- <table>
190
+ <table><tbody>
191
191
  <tr>
192
192
  <th>One</th>
193
193
  <th class="expander"></th>
194
194
  </tr>
195
- </table>
195
+ </tbody></table>
196
196
  </th>
197
197
  HTML
198
198
 
@@ -210,18 +210,18 @@ RSpec.describe 'Grid' do
210
210
  expected = <<-INKY
211
211
  <body>
212
212
  <th class="small-4 large-4 columns first">
213
- <table>
213
+ <table><tbody>
214
214
  <tr>
215
215
  <th>One</th>
216
216
  </tr>
217
- </table>
217
+ </tbody></table>
218
218
  </th>
219
219
  <th class="small-8 large-8 columns last">
220
- <table>
220
+ <table><tbody>
221
221
  <tr>
222
222
  <th>Two</th>
223
223
  </tr>
224
- </table>
224
+ </tbody></table>
225
225
  </th>
226
226
  </body>
227
227
  INKY
@@ -239,18 +239,18 @@ RSpec.describe 'Grid' do
239
239
  expected = <<-HTML
240
240
  <body>
241
241
  <th class="small-12 large-4 columns first">
242
- <table>
242
+ <table><tbody>
243
243
  <tr>
244
244
  <th>One</th>
245
245
  </tr>
246
- </table>
246
+ </tbody></table>
247
247
  </th>
248
248
  <th class="small-12 large-8 columns last">
249
- <table>
249
+ <table><tbody>
250
250
  <tr>
251
251
  <th>Two</th>
252
252
  </tr>
253
- </table>
253
+ </tbody></table>
254
254
  </th>
255
255
  </body>
256
256
  HTML
@@ -268,18 +268,18 @@ RSpec.describe 'Grid' do
268
268
  expected = <<-HTML
269
269
  <body>
270
270
  <th class="small-12 large-6 columns first">
271
- <table>
271
+ <table><tbody>
272
272
  <tr>
273
273
  <th>One</th>
274
274
  </tr>
275
- </table>
275
+ </tbody></table>
276
276
  </th>
277
277
  <th class="small-12 large-6 columns last">
278
- <table>
278
+ <table><tbody>
279
279
  <tr>
280
280
  <th>Two</th>
281
281
  </tr>
282
- </table>
282
+ </tbody></table>
283
283
  </th>
284
284
  </body>
285
285
  HTML
@@ -294,7 +294,7 @@ RSpec.describe 'Grid' do
294
294
  <tbody>
295
295
  <tr>
296
296
  <th class="small-12 large-12 columns first last">
297
- <table>
297
+ <table><tbody>
298
298
  <tr>
299
299
  <th>
300
300
  <table class="row">
@@ -304,7 +304,7 @@ RSpec.describe 'Grid' do
304
304
  </table>
305
305
  </th>
306
306
  </tr>
307
- </table>
307
+ </tbody></table>
308
308
  </th>
309
309
  </tr>
310
310
  </tbody>
@@ -318,13 +318,13 @@ RSpec.describe 'Grid' do
318
318
  input = '<columns small="6" valign="middle" foo="bar">x</columns>'
319
319
  expected = <<-HTML
320
320
  <th class="small-6 large-6 columns first last" valign="middle" foo="bar">
321
- <table>
321
+ <table><tbody>
322
322
  <tr>
323
323
  <th>
324
324
  x
325
325
  </th>
326
326
  </tr>
327
- </table>
327
+ </tbody></table>
328
328
  </th>
329
329
  HTML
330
330
 
@@ -336,9 +336,9 @@ RSpec.describe 'Block Grid' do
336
336
  it 'returns the correct block grid syntax' do
337
337
  input = '<block-grid up="4"></block-grid>'
338
338
  expected = <<-HTML
339
- <table class="block-grid up-4">
339
+ <table class="block-grid up-4"><tbody>
340
340
  <tr></tr>
341
- </table>
341
+ </tbody></table>
342
342
  HTML
343
343
 
344
344
  compare(input, expected)
@@ -347,9 +347,9 @@ RSpec.describe 'Block Grid' do
347
347
  it 'copies classes to the final HTML output' do
348
348
  input = '<block-grid up="4" class="show-for-large"></block-grid>'
349
349
  expected = <<-HTML
350
- <table class="block-grid up-4 show-for-large">
350
+ <table class="block-grid up-4 show-for-large"><tbody>
351
351
  <tr></tr>
352
- </table>
352
+ </tbody></table>
353
353
  HTML
354
354
 
355
355
  compare(input, expected)
data/spec/spec_helper.rb CHANGED
@@ -11,7 +11,6 @@ def reformat_html(html)
11
11
  .gsub(/ </, '<').gsub(/> /, '>') # Remove leading/trailing spaces inside tags
12
12
  .gsub(' data-parsed=""', '') # Don't consider this known inky-node artefact
13
13
  .gsub(' data-parsed>', '>') # Ditto
14
- .gsub('&#xA0;', ' ') # These are the same entity...
15
14
  .gsub(/(align="[^"]+") (class="[^"]+")/, '\2 \1') # Tweak order to match inky-node on container
16
15
  .gsub(/class\="([^"]+)"/) do # Sort class names
17
16
  classes = $1.split(' ').sort.join(' ')