html-table 1.3.6 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,10 +4,7 @@
4
4
  # Test suite for the AttributeHandler module. For these tests, we'll use an
5
5
  # instance of the Table class where the module has been mixed in.
6
6
  ############################################################################
7
- require 'rubygems'
8
- gem 'test-unit'
9
-
10
- require 'test/unit'
7
+ require 'test-unit'
11
8
  require 'html/table'
12
9
  include HTML
13
10
 
@@ -19,7 +16,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
19
16
  def setup
20
17
  @table = Table.new(['foo',1,'bar'])
21
18
  end
22
-
19
+
23
20
  def test_abbr_basic
24
21
  assert_respond_to(@table, :abbr)
25
22
  assert_respond_to(@table, :abbr=)
@@ -31,7 +28,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
31
28
  assert_nothing_raised{ @table.abbr = 'foo' }
32
29
  assert_equal('foo', @table.abbr)
33
30
  end
34
-
31
+
35
32
  def test_align_basic
36
33
  assert_respond_to(@table, :align)
37
34
  assert_respond_to(@table, :align=)
@@ -47,14 +44,14 @@ class TC_AttributeHandler < Test::Unit::TestCase
47
44
  def test_align_expected_errors
48
45
  assert_raises(ArgumentError){ @table.align = 'foo' }
49
46
  end
50
-
47
+
51
48
  def test_axis
52
49
  assert_respond_to(@table, :axis)
53
50
  assert_respond_to(@table, :axis=)
54
51
  assert_nothing_raised{ @table.axis }
55
52
  assert_nothing_raised{ @table.axis = 'foo' }
56
53
  end
57
-
54
+
58
55
  def test_background_basic
59
56
  assert_respond_to(@table, :background)
60
57
  assert_respond_to(@table, :background=)
@@ -70,7 +67,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
70
67
  def test_background_expected_errors
71
68
  assert_raises(TypeError){ @table.background = 1 }
72
69
  end
73
-
70
+
74
71
  def test_bgcolor_basic
75
72
  assert_respond_to(@table, :bgcolor)
76
73
  assert_respond_to(@table, :bgcolor=)
@@ -94,7 +91,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
94
91
  assert_nothing_raised{ @table.border = true }
95
92
  assert_nothing_raised{ @table.border = false }
96
93
  end
97
-
94
+
98
95
  def test_bordercolor_basic
99
96
  assert_respond_to(@table, :bordercolor)
100
97
  assert_respond_to(@table, :bordercolor=)
@@ -106,7 +103,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
106
103
  assert_nothing_raised{ @table.bordercolor = 'foo' }
107
104
  assert_equal('foo', @table.bordercolor)
108
105
  end
109
-
106
+
110
107
  def test_bordercolordark_basic
111
108
  assert_respond_to(@table, :bordercolordark)
112
109
  assert_respond_to(@table, :bordercolordark=)
@@ -118,14 +115,14 @@ class TC_AttributeHandler < Test::Unit::TestCase
118
115
  assert_nothing_raised{ @table.bordercolordark = 'foo' }
119
116
  assert_equal('foo', @table.bordercolordark)
120
117
  end
121
-
118
+
122
119
  def test_bordercolorlight
123
120
  assert_respond_to(@table, :bordercolorlight)
124
121
  assert_respond_to(@table, :bordercolorlight=)
125
122
  assert_nothing_raised{ @table.bordercolorlight }
126
123
  assert_nothing_raised{ @table.bordercolorlight = 'foo' }
127
124
  end
128
-
125
+
129
126
  def test_cellpadding
130
127
  assert_respond_to(@table, :cellpadding)
131
128
  assert_respond_to(@table, :cellpadding=)
@@ -135,8 +132,8 @@ class TC_AttributeHandler < Test::Unit::TestCase
135
132
 
136
133
  def test_cellpadding_expected_errors
137
134
  assert_raises(ArgumentError){ @table.cellpadding = -1 }
138
- end
139
-
135
+ end
136
+
140
137
  def test_cellspacing
141
138
  assert_respond_to(@table, :cellspacing)
142
139
  assert_respond_to(@table, :cellspacing=)
@@ -147,7 +144,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
147
144
  def test_cellspacing_expected_errors
148
145
  assert_raises(ArgumentError){ @table.cellspacing = -1 }
149
146
  end
150
-
147
+
151
148
  def test_char
152
149
  assert_respond_to(@table, :char)
153
150
  assert_respond_to(@table, :char=)
@@ -158,7 +155,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
158
155
  def test_char_expected_errors
159
156
  assert_raises(ArgumentError){ @table.char = 'xx' }
160
157
  end
161
-
158
+
162
159
  def test_charoff
163
160
  assert_respond_to(@table, :charoff)
164
161
  assert_respond_to(@table, :charoff=)
@@ -176,7 +173,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
176
173
  assert_nothing_raised{ @table.class_ }
177
174
  assert_nothing_raised{ @table.class_ = 'myclass' }
178
175
  end
179
-
176
+
180
177
  def test_col
181
178
  assert_respond_to(@table, :col)
182
179
  assert_respond_to(@table, :col=)
@@ -187,7 +184,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
187
184
  def test_col_expected_errors
188
185
  assert_raises(ArgumentError){ @table.col = -1 }
189
186
  end
190
-
187
+
191
188
  def test_colspan
192
189
  assert_respond_to(@table, :colspan)
193
190
  assert_respond_to(@table, :colspan=)
@@ -198,7 +195,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
198
195
  def test_colspan_expected_errors
199
196
  assert_raises(ArgumentError){ @table.colspan = -1 }
200
197
  end
201
-
198
+
202
199
  def test_configure
203
200
  assert_respond_to(@table, :configure)
204
201
  assert_nothing_raised{ @table.configure(0){} }
@@ -208,7 +205,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
208
205
  def test_configure_expected_errors
209
206
  assert_raises(ArgumentError){ @table.configure(0,0,0){} }
210
207
  end
211
-
208
+
212
209
  ########################################################################
213
210
  # This test could probably be broken out into separate tests for each
214
211
  # type that we want to add as content.
@@ -227,7 +224,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
227
224
  assert_nothing_raised{ @table.content = Table::Foot.create }
228
225
  assert_nothing_raised{ @table.content = Table::Body.new }
229
226
  end
230
-
227
+
231
228
  def test_frame
232
229
  assert_respond_to(@table, :frame)
233
230
  assert_respond_to(@table, :frame=)
@@ -238,7 +235,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
238
235
  def test_frame_expected_errors
239
236
  assert_raises(ArgumentError){ @table.frame = 'foo' }
240
237
  end
241
-
238
+
242
239
  def test_height
243
240
  assert_respond_to(@table, :height)
244
241
  assert_respond_to(@table, :height=)
@@ -249,7 +246,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
249
246
  def test_height_expected_errors
250
247
  assert_raises(ArgumentError){ @table.height = -1 }
251
248
  end
252
-
249
+
253
250
  def test_hspace
254
251
  assert_respond_to(@table, :hspace)
255
252
  assert_respond_to(@table, :hspace=)
@@ -260,7 +257,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
260
257
  def test_hspace_expected_errors
261
258
  assert_raises(ArgumentError){ @table.hspace = -1 }
262
259
  end
263
-
260
+
264
261
  def test_nowrap
265
262
  assert_respond_to(@table, :nowrap)
266
263
  assert_respond_to(@table, :nowrap=)
@@ -271,7 +268,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
271
268
  def test_nowrap_expected_errors
272
269
  assert_raises(TypeError){ @table.nowrap = 'foo' }
273
270
  end
274
-
271
+
275
272
  def test_rowspan
276
273
  assert_respond_to(@table, :rowspan)
277
274
  assert_respond_to(@table, :rowspan=)
@@ -282,7 +279,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
282
279
  def test_rowspan_expected_errors
283
280
  assert_raises(ArgumentError){ @table.rowspan = -1 }
284
281
  end
285
-
282
+
286
283
  def test_rules
287
284
  assert_respond_to(@table, :rules)
288
285
  assert_respond_to(@table, :rules=)
@@ -293,7 +290,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
293
290
  def test_rules_expected_errors
294
291
  assert_raises(ArgumentError){ @table.rules = 'foo' }
295
292
  end
296
-
293
+
297
294
  def test_span
298
295
  assert_respond_to(@table, :span)
299
296
  assert_respond_to(@table, :span=)
@@ -311,7 +308,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
311
308
  assert_nothing_raised{ @table.style }
312
309
  assert_nothing_raised{ @table.style = 'color: blue' }
313
310
  end
314
-
311
+
315
312
  def test_summary
316
313
  assert_respond_to(@table, :summary)
317
314
  assert_respond_to(@table, :summary=)
@@ -319,7 +316,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
319
316
  assert_nothing_raised{ @table.summary = 'foo' }
320
317
  assert_nothing_raised{ @table.summary = 1 }
321
318
  end
322
-
319
+
323
320
  def test_valign
324
321
  assert_respond_to(@table, :valign)
325
322
  assert_respond_to(@table, :valign=)
@@ -330,7 +327,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
330
327
  def test_valign_expected_errors
331
328
  assert_raises(ArgumentError){ @table.valign = 'foo' }
332
329
  end
333
-
330
+
334
331
  def test_vspace
335
332
  assert_respond_to(@table, :vspace)
336
333
  assert_respond_to(@table, :vspace=)
@@ -341,7 +338,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
341
338
  def test_vspace_expected_errors
342
339
  assert_raises(ArgumentError){ @table.vspace = -1 }
343
340
  end
344
-
341
+
345
342
  def test_width
346
343
  assert_respond_to(@table, :width)
347
344
  assert_respond_to(@table, :width=)
@@ -353,7 +350,7 @@ class TC_AttributeHandler < Test::Unit::TestCase
353
350
  def test_width_expected_errors
354
351
  assert_raises(ArgumentError){ @table.width = -1 }
355
352
  end
356
-
353
+
357
354
  def teardown
358
355
  @table = nil
359
356
  end
data/test/test_body.rb CHANGED
@@ -3,10 +3,7 @@
3
3
  #
4
4
  # Test suite for the Table::Body class
5
5
  ############################################
6
- require 'rubygems'
7
- gem 'test-unit'
8
-
9
- require 'test/unit'
6
+ require 'test-unit'
10
7
  require 'html/table'
11
8
  include HTML
12
9
 
@@ -24,25 +21,25 @@ class TC_HTML_Table_Body < Test::Unit::TestCase
24
21
  assert_nothing_raised{ Table::Body.new([1,2,3]) }
25
22
  assert_nothing_raised{ Table::Body.new([[1,2,3],["foo","bar"]]) }
26
23
  end
27
-
24
+
28
25
  def test_basic
29
26
  html = "<tbody></tbody>"
30
27
  assert_equal(html, @tbody.html.gsub(/\s{2,}|\n/,''))
31
28
  end
32
-
29
+
33
30
  def test_with_attributes
34
31
  html = "<tbody align='left' char='x'></tbody>"
35
32
  @tbody.align = "left"
36
33
  @tbody.char = 'x'
37
34
  assert_equal(html, @tbody.html.gsub(/\s{2,}|\n/,''))
38
35
  end
39
-
36
+
40
37
  def test_push_single_row
41
38
  html = "<tbody><tr><td>test</td></tr></tbody>"
42
39
  @tbody.push Table::Row.new{|r| r.content = "test" }
43
40
  assert_equal(html, @tbody.html.gsub(/\s{2,}|\n/,''))
44
41
  end
45
-
42
+
46
43
  def test_push_multiple_rows
47
44
  html = "<tbody><tr><td>test</td></tr><tr><td>foo</td></tr></tbody>"
48
45
  r1 = Table::Row.new{|r| r.content = "test" }
@@ -50,7 +47,7 @@ class TC_HTML_Table_Body < Test::Unit::TestCase
50
47
  @tbody.push r1, r2
51
48
  assert_equal(html, @tbody.html.gsub(/\s{2,}|\n/,''))
52
49
  end
53
-
50
+
54
51
  def test_add_content_directly
55
52
  html = "<tbody><tr><td>hello</td><td>world</td></tr></tbody>"
56
53
  @tbody.content = "hello","world"
@@ -62,7 +59,7 @@ class TC_HTML_Table_Body < Test::Unit::TestCase
62
59
  tb = Table::Body.new(%w/hello world/)
63
60
  assert_equal(html, tb.html.gsub(/\s{2,}|\n+/,''))
64
61
  end
65
-
62
+
66
63
  def test_configure_column
67
64
  html = "<tbody><tr><td>hello</td><td abbr='test' width=3 nowrap>world"
68
65
  html += "</td></tr></tbody>"
@@ -82,7 +79,7 @@ class TC_HTML_Table_Body < Test::Unit::TestCase
82
79
  assert_raises(ArgumentTypeError){ Table::Body.end_tags = 1 }
83
80
  assert_nothing_raised{ Table::Body.end_tags = true }
84
81
  end
85
-
82
+
86
83
  def teardown
87
84
  @table = nil
88
85
  @tbody = nil
data/test/test_caption.rb CHANGED
@@ -3,10 +3,7 @@
3
3
  #
4
4
  # Test suite for the Table::Caption class
5
5
  ################################################
6
- require 'rubygems'
7
- gem 'test-unit'
8
-
9
- require 'test/unit'
6
+ require 'test-unit'
10
7
  require 'html/table'
11
8
  include HTML
12
9
 
data/test/test_col.rb CHANGED
@@ -3,10 +3,7 @@
3
3
  #
4
4
  # Test suite for the Table::ColGroup::Col class
5
5
  ##################################################
6
- require 'rubygems'
7
- gem 'test-unit'
8
-
9
- require 'test/unit'
6
+ require 'test-unit'
10
7
  require 'html/table'
11
8
  include HTML
12
9
 
@@ -24,7 +21,7 @@ class TC_HTML_Table_Col < Test::Unit::TestCase
24
21
  def test_no_configure
25
22
  assert_raises(NoMethodError){ @col.configure }
26
23
  end
27
-
24
+
28
25
  def test_no_content_allowed
29
26
  assert_raises(NoMethodError){ @col.content }
30
27
  assert_raises(NoMethodError){ @col.content = "foo" }
@@ -36,7 +33,7 @@ class TC_HTML_Table_Col < Test::Unit::TestCase
36
33
  assert_raises(ArgumentTypeError){ Table::ColGroup::Col.indent_level = "foo" }
37
34
  assert_nothing_raised{ Table::ColGroup::Col.indent_level = 6 }
38
35
  end
39
-
36
+
40
37
  def teardown
41
38
  @col = nil
42
39
  end
@@ -3,10 +3,7 @@
3
3
  #
4
4
  # Test suite for the Table::ColGroup class
5
5
  ############################################
6
- require 'rubygems'
7
- gem 'test-unit'
8
-
9
- require 'test/unit'
6
+ require 'test-unit'
10
7
  require 'html/table'
11
8
  include HTML
12
9
 
@@ -21,19 +18,19 @@ class TC_HTML_Table_ColGroup < Test::Unit::TestCase
21
18
  assert_nothing_raised{ Table::ColGroup.new(@col) }
22
19
  assert_raises(TypeError){ Table::ColGroup.new("foo") }
23
20
  end
24
-
21
+
25
22
  def test_basic
26
23
  html = "<colgroup></colgroup>"
27
24
  assert_equal(html,@cgroup.html.gsub(/\s+/,''))
28
25
  end
29
-
26
+
30
27
  def test_with_attributes
31
28
  html = "<colgroup align='center' width='20%'></colgroup>"
32
29
  @cgroup.align = "center"
33
30
  @cgroup.width = "20%"
34
31
  assert_equal(html,@cgroup.html.gsub(/\s{2,}|\n+/,''))
35
32
  end
36
-
33
+
37
34
  def test_push_single_col_element
38
35
  html = "<colgroup><col></colgroup>"
39
36
  @cgroup.push(@col)
@@ -61,11 +58,11 @@ class TC_HTML_Table_ColGroup < Test::Unit::TestCase
61
58
  assert_raises(TypeError){ @cgroup << Table::Row.new }
62
59
  assert_nothing_raised{ @cgroup << Table::ColGroup::Col.new }
63
60
  end
64
-
61
+
65
62
  def test_configure_error
66
63
  assert_raises(ArgumentError){ @cgroup.configure(0,0){ } }
67
64
  end
68
-
65
+
69
66
  def test_content_error
70
67
  assert_raises(NoMethodError){ @cgroup.content }
71
68
  assert_raises(NoMethodError){ @cgroup.content = 'blah' }
@@ -85,7 +82,7 @@ class TC_HTML_Table_ColGroup < Test::Unit::TestCase
85
82
  assert_raises(ArgumentTypeError){ Table::ColGroup.end_tags = 1 }
86
83
  assert_nothing_raised{ Table::ColGroup.end_tags = true }
87
84
  end
88
-
85
+
89
86
  def teardown
90
87
  @cgroup = nil
91
88
  end
data/test/test_data.rb CHANGED
@@ -3,10 +3,7 @@
3
3
  #
4
4
  # Test suite for the Table::Row::Data class
5
5
  ##############################################
6
- require 'rubygems'
7
- gem 'test-unit'
8
-
9
- require 'test/unit'
6
+ require 'test-unit'
10
7
  require 'html/table'
11
8
  include HTML
12
9
 
@@ -23,12 +20,12 @@ class TC_HTML_Table_Row_Data < Test::Unit::TestCase
23
20
  assert_nothing_raised{ Table::Row::Data.new([1,2,3]) }
24
21
  assert_nothing_raised{ Table::Row::Data.new([[1,2,3],["foo","bar"]]) }
25
22
  end
26
-
23
+
27
24
  def test_basic
28
25
  html = "<td></td>"
29
26
  assert_equal(html,@tdata.html.gsub(/\s+/,''))
30
27
  end
31
-
28
+
32
29
  def test_with_attributes
33
30
  html = "<td align='left' width=3 nowrap></td>"
34
31
  @tdata.align = 'left'
@@ -36,11 +33,11 @@ class TC_HTML_Table_Row_Data < Test::Unit::TestCase
36
33
  @tdata.nowrap = true
37
34
  assert_equal(html,@tdata.html.gsub(/\s{2,}|\n+/,''))
38
35
  end
39
-
36
+
40
37
  def test_configure_not_allowed
41
38
  assert_raises(NoMethodError){ @tdata.configure }
42
39
  end
43
-
40
+
44
41
  def test_add_content
45
42
  html = "<td>hello world</td>"
46
43
  @tdata.content = "hello world"
@@ -52,7 +49,7 @@ class TC_HTML_Table_Row_Data < Test::Unit::TestCase
52
49
  td = Table::Row::Data.new("hello world")
53
50
  assert_equal(html,td.html.gsub(/\s{2,}/,''))
54
51
  end
55
-
52
+
56
53
  def test_add_multiple_content_items
57
54
  html = "<td>hello world</td>"
58
55
  @tdata.content = "hello"," world"
@@ -73,7 +70,7 @@ class TC_HTML_Table_Row_Data < Test::Unit::TestCase
73
70
  assert_raises(ArgumentTypeError){ Table::Row::Data.end_tags = 1 }
74
71
  assert_nothing_raised{ Table::Row::Data.end_tags = true }
75
72
  end
76
-
73
+
77
74
  def teardown
78
75
  @tdata = nil
79
76
  end