html-table 1.2.2 → 1.3.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.
- data/CHANGES +17 -0
- data/MANIFEST +15 -0
- data/README +8 -1
- data/doc/table_content.rdoc +15 -0
- data/lib/html/attribute_handler.rb +135 -60
- data/lib/html/body.rb +6 -2
- data/lib/html/caption.rb +9 -3
- data/lib/html/col.rb +8 -3
- data/lib/html/colgroup.rb +13 -2
- data/lib/html/content.rb +18 -0
- data/lib/html/data.rb +13 -4
- data/lib/html/foot.rb +8 -2
- data/lib/html/head.rb +11 -4
- data/lib/html/header.rb +13 -4
- data/lib/html/html_handler.rb +33 -7
- data/lib/html/row.rb +79 -23
- data/lib/html/table.rb +90 -62
- data/lib/html/tablesection.rb +7 -4
- data/lib/html/tag_handler.rb +73 -23
- data/test/tc_attribute_handler.rb +165 -151
- data/test/tc_row.rb +14 -1
- data/test/tc_table.rb +1 -1
- data/test/tc_tag_handler.rb +92 -0
- data/test/ts_all.rb +19 -18
- metadata +42 -35
data/lib/html/tablesection.rb
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
module HTML
|
|
2
2
|
# Superclass for THEAD, TBODY, TFOOT
|
|
3
|
+
#
|
|
3
4
|
class Table::TableSection < Array
|
|
4
5
|
include AttributeHandler
|
|
5
6
|
include HtmlHandler
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
def initialize(&block)
|
|
9
|
+
instance_eval(&block) if block_given?
|
|
8
10
|
end
|
|
9
11
|
|
|
10
12
|
# Adds a Table::Row object as content. The +arg+ is passed as the value
|
|
11
13
|
# to the Table::Row constructor.
|
|
14
|
+
#
|
|
12
15
|
def content=(arg)
|
|
13
16
|
tr = Table::Row.new(arg)
|
|
14
17
|
self.push(tr)
|
|
@@ -19,8 +22,8 @@ module HTML
|
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
def self.indent_level=(num)
|
|
22
|
-
expect(num,Integer)
|
|
23
|
-
raise ArgumentError,"indent_level must be >= 0" if num < 0
|
|
25
|
+
expect(num, Integer)
|
|
26
|
+
raise ArgumentError, "indent_level must be >= 0" if num < 0
|
|
24
27
|
@indent_level = num
|
|
25
28
|
end
|
|
26
29
|
|
data/lib/html/tag_handler.rb
CHANGED
|
@@ -2,63 +2,113 @@
|
|
|
2
2
|
# tag_handler.rb
|
|
3
3
|
#
|
|
4
4
|
# Module for handling standard html physical tags (<b>, <i>, etc).
|
|
5
|
-
# Only used for Table objects
|
|
6
|
-
#
|
|
5
|
+
# Only used for Table::Content objects, which are in turn used by
|
|
6
|
+
# Table::Row::Data, Table::Row::Header and Table::Caption.
|
|
7
7
|
###################################################################
|
|
8
|
-
module
|
|
8
|
+
module TagHandler
|
|
9
|
+
def bold(bool = nil)
|
|
10
|
+
self.bold = bool if bool
|
|
11
|
+
@bold
|
|
12
|
+
end
|
|
9
13
|
|
|
10
14
|
def bold=(bool)
|
|
11
|
-
handle_physical_tag('b',bool)
|
|
15
|
+
handle_physical_tag('b', bool)
|
|
16
|
+
@bold = bool
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def big(bool = nil)
|
|
20
|
+
self.big = bool if bool
|
|
21
|
+
@big
|
|
12
22
|
end
|
|
13
23
|
|
|
14
24
|
def big=(bool)
|
|
15
|
-
handle_physical_tag('big',bool)
|
|
25
|
+
handle_physical_tag('big', bool)
|
|
26
|
+
@big = bool
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def blink(bool = nil)
|
|
30
|
+
self.blink = bool if bool
|
|
31
|
+
@blink
|
|
16
32
|
end
|
|
17
33
|
|
|
18
34
|
def blink=(bool)
|
|
19
35
|
if $VERBOSE
|
|
20
36
|
STDERR.puts("The 'blink' tag is very annoying. Please reconsider.")
|
|
21
37
|
end
|
|
22
|
-
handle_physical_tag('blink',bool)
|
|
38
|
+
handle_physical_tag('blink', bool)
|
|
39
|
+
@blink = bool
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def italic(bool = nil)
|
|
43
|
+
self.italic = bool if bool
|
|
44
|
+
@italic
|
|
23
45
|
end
|
|
24
46
|
|
|
25
47
|
def italic=(bool)
|
|
26
|
-
handle_physical_tag('i',bool)
|
|
48
|
+
handle_physical_tag('i', bool)
|
|
49
|
+
@italic = bool
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def strike(bool = nil)
|
|
53
|
+
self.strike = bool if bool
|
|
54
|
+
@strike
|
|
27
55
|
end
|
|
28
56
|
|
|
29
57
|
def strike=(bool)
|
|
30
|
-
handle_physical_tag('strike',bool)
|
|
58
|
+
handle_physical_tag('strike', bool)
|
|
59
|
+
@strike = bool
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def sub(bool = nil)
|
|
63
|
+
self.sub = bool if bool
|
|
64
|
+
@sub
|
|
31
65
|
end
|
|
32
66
|
|
|
33
67
|
def sub=(bool)
|
|
34
|
-
handle_physical_tag('sub',bool)
|
|
68
|
+
handle_physical_tag('sub', bool)
|
|
69
|
+
@sub = bool
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def sup(bool = nil)
|
|
73
|
+
self.sup = bool if bool
|
|
74
|
+
@sup
|
|
35
75
|
end
|
|
36
76
|
|
|
37
77
|
def sup=(bool)
|
|
38
|
-
handle_physical_tag('sup',bool)
|
|
78
|
+
handle_physical_tag('sup', bool)
|
|
79
|
+
@sup = bool
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def tt(bool = nil)
|
|
83
|
+
self.tt = bool if bool
|
|
84
|
+
@tt
|
|
39
85
|
end
|
|
40
86
|
|
|
41
87
|
def tt=(bool)
|
|
42
|
-
handle_physical_tag('tt',bool)
|
|
88
|
+
handle_physical_tag('tt', bool)
|
|
89
|
+
@tt = bool
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def underline(bool = nil)
|
|
93
|
+
self.underline = bool if bool
|
|
94
|
+
@bool
|
|
43
95
|
end
|
|
44
96
|
|
|
45
97
|
def underline=(bool)
|
|
46
|
-
handle_physical_tag('u',bool)
|
|
98
|
+
handle_physical_tag('u', bool)
|
|
99
|
+
@bool = bool
|
|
47
100
|
end
|
|
48
101
|
|
|
49
|
-
|
|
102
|
+
private
|
|
103
|
+
|
|
104
|
+
def handle_physical_tag(tag, bool)
|
|
50
105
|
begin_tag = "<#{tag}>"
|
|
51
106
|
end_tag = "</#{tag}>"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
end
|
|
56
|
-
if bool == true
|
|
57
|
-
@html_body = begin_tag + @html_body + end_tag
|
|
107
|
+
|
|
108
|
+
if bool
|
|
109
|
+
self.replace(begin_tag << self << end_tag)
|
|
58
110
|
else
|
|
59
|
-
|
|
111
|
+
self.replace(self.gsub(/#{begin_tag}|#{end_tag}/,''))
|
|
60
112
|
end
|
|
61
|
-
@html_body
|
|
62
113
|
end
|
|
63
|
-
|
|
64
|
-
end
|
|
114
|
+
end
|
|
@@ -6,143 +6,150 @@
|
|
|
6
6
|
############################################################################
|
|
7
7
|
base = File.basename(Dir.pwd)
|
|
8
8
|
|
|
9
|
-
if base ==
|
|
10
|
-
Dir.chdir(
|
|
9
|
+
if base == 'test' || base =~ /html-table/
|
|
10
|
+
Dir.chdir('..') if base == 'test'
|
|
11
11
|
$LOAD_PATH.unshift(Dir.pwd)
|
|
12
|
-
$LOAD_PATH.unshift(Dir.pwd +
|
|
13
|
-
$LOAD_PATH.unshift(Dir.pwd +
|
|
14
|
-
Dir.chdir(
|
|
12
|
+
$LOAD_PATH.unshift(Dir.pwd + '/lib')
|
|
13
|
+
$LOAD_PATH.unshift(Dir.pwd + '/lib/html')
|
|
14
|
+
Dir.chdir('test') rescue nil
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
require
|
|
18
|
-
require
|
|
17
|
+
require 'test/unit'
|
|
18
|
+
require 'html/table'
|
|
19
19
|
include HTML
|
|
20
20
|
|
|
21
21
|
class TC_AttributeHandler < Test::Unit::TestCase
|
|
22
22
|
def setup
|
|
23
|
-
@
|
|
23
|
+
@table = Table.new(['foo',1,'bar'])
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def test_abbr
|
|
27
|
-
assert_respond_to(@
|
|
28
|
-
assert_respond_to(@
|
|
29
|
-
assert_nothing_raised{ @
|
|
30
|
-
assert_nothing_raised{ @
|
|
27
|
+
assert_respond_to(@table, :abbr)
|
|
28
|
+
assert_respond_to(@table, :abbr=)
|
|
29
|
+
assert_nothing_raised{ @table.abbr }
|
|
30
|
+
assert_nothing_raised{ @table.abbr = 'foo' }
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def test_align
|
|
34
|
-
assert_respond_to(@
|
|
35
|
-
assert_respond_to(@
|
|
36
|
-
assert_nothing_raised{ @
|
|
37
|
-
assert_nothing_raised{ @
|
|
38
|
-
assert_raises(ArgumentError){ @
|
|
34
|
+
assert_respond_to(@table, :align)
|
|
35
|
+
assert_respond_to(@table, :align=)
|
|
36
|
+
assert_nothing_raised{ @table.align }
|
|
37
|
+
assert_nothing_raised{ @table.align = 'center' }
|
|
38
|
+
assert_raises(ArgumentError){ @table.align = 'foo' }
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def test_axis
|
|
42
|
-
assert_respond_to(@
|
|
43
|
-
assert_respond_to(@
|
|
44
|
-
assert_nothing_raised{ @
|
|
45
|
-
assert_nothing_raised{ @
|
|
42
|
+
assert_respond_to(@table, :axis)
|
|
43
|
+
assert_respond_to(@table, :axis=)
|
|
44
|
+
assert_nothing_raised{ @table.axis }
|
|
45
|
+
assert_nothing_raised{ @table.axis = 'foo' }
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def test_background
|
|
49
|
-
assert_respond_to(@
|
|
50
|
-
assert_respond_to(@
|
|
51
|
-
assert_nothing_raised{ @
|
|
52
|
-
assert_nothing_raised{ @
|
|
53
|
-
assert_raises(TypeError){ @
|
|
49
|
+
assert_respond_to(@table, :background)
|
|
50
|
+
assert_respond_to(@table, :background=)
|
|
51
|
+
assert_nothing_raised{ @table.background }
|
|
52
|
+
assert_nothing_raised{ @table.background = 'foo' }
|
|
53
|
+
assert_raises(TypeError){ @table.background = 1 }
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def test_bgcolor
|
|
57
|
-
assert_respond_to(@
|
|
58
|
-
assert_respond_to(@
|
|
59
|
-
assert_nothing_raised{ @
|
|
60
|
-
assert_nothing_raised{ @
|
|
57
|
+
assert_respond_to(@table, :bgcolor)
|
|
58
|
+
assert_respond_to(@table, :bgcolor=)
|
|
59
|
+
assert_nothing_raised{ @table.bgcolor }
|
|
60
|
+
assert_nothing_raised{ @table.bgcolor = 'foo' }
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def test_border
|
|
64
|
-
assert_respond_to(@
|
|
65
|
-
assert_respond_to(@
|
|
66
|
-
assert_nothing_raised{ @
|
|
67
|
-
assert_nothing_raised{ @
|
|
68
|
-
assert_nothing_raised{ @
|
|
69
|
-
assert_nothing_raised{ @
|
|
64
|
+
assert_respond_to(@table, :border)
|
|
65
|
+
assert_respond_to(@table, :border=)
|
|
66
|
+
assert_nothing_raised{ @table.border }
|
|
67
|
+
assert_nothing_raised{ @table.border = 2 }
|
|
68
|
+
assert_nothing_raised{ @table.border = true }
|
|
69
|
+
assert_nothing_raised{ @table.border = false }
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def test_bordercolor
|
|
73
|
-
assert_respond_to(@
|
|
74
|
-
assert_respond_to(@
|
|
75
|
-
assert_nothing_raised{ @
|
|
76
|
-
assert_nothing_raised{ @
|
|
73
|
+
assert_respond_to(@table, :bordercolor)
|
|
74
|
+
assert_respond_to(@table, :bordercolor=)
|
|
75
|
+
assert_nothing_raised{ @table.bordercolor }
|
|
76
|
+
assert_nothing_raised{ @table.bordercolor = 'foo' }
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def test_bordercolordark
|
|
80
|
-
assert_respond_to(@
|
|
81
|
-
assert_respond_to(@
|
|
82
|
-
assert_nothing_raised{ @
|
|
83
|
-
assert_nothing_raised{ @
|
|
80
|
+
assert_respond_to(@table, :bordercolordark)
|
|
81
|
+
assert_respond_to(@table, :bordercolordark=)
|
|
82
|
+
assert_nothing_raised{ @table.bordercolordark }
|
|
83
|
+
assert_nothing_raised{ @table.bordercolordark = 'foo' }
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def test_bordercolorlight
|
|
87
|
-
assert_respond_to(@
|
|
88
|
-
assert_respond_to(@
|
|
89
|
-
assert_nothing_raised{ @
|
|
90
|
-
assert_nothing_raised{ @
|
|
87
|
+
assert_respond_to(@table, :bordercolorlight)
|
|
88
|
+
assert_respond_to(@table, :bordercolorlight=)
|
|
89
|
+
assert_nothing_raised{ @table.bordercolorlight }
|
|
90
|
+
assert_nothing_raised{ @table.bordercolorlight = 'foo' }
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def test_cellpadding
|
|
94
|
-
assert_respond_to(@
|
|
95
|
-
assert_respond_to(@
|
|
96
|
-
assert_nothing_raised{ @
|
|
97
|
-
assert_nothing_raised{ @
|
|
98
|
-
assert_raises(ArgumentError){ @
|
|
94
|
+
assert_respond_to(@table, :cellpadding)
|
|
95
|
+
assert_respond_to(@table, :cellpadding=)
|
|
96
|
+
assert_nothing_raised{ @table.cellpadding }
|
|
97
|
+
assert_nothing_raised{ @table.cellpadding = 1 }
|
|
98
|
+
assert_raises(ArgumentError){ @table.cellpadding = -1 }
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
def test_cellspacing
|
|
102
|
-
assert_respond_to(@
|
|
103
|
-
assert_respond_to(@
|
|
104
|
-
assert_nothing_raised{ @
|
|
105
|
-
assert_nothing_raised{ @
|
|
106
|
-
assert_raises(ArgumentError){ @
|
|
102
|
+
assert_respond_to(@table, :cellspacing)
|
|
103
|
+
assert_respond_to(@table, :cellspacing=)
|
|
104
|
+
assert_nothing_raised{ @table.cellspacing }
|
|
105
|
+
assert_nothing_raised{ @table.cellspacing = 1 }
|
|
106
|
+
assert_raises(ArgumentError){ @table.cellspacing = -1 }
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
def test_char
|
|
110
|
-
assert_respond_to(@
|
|
111
|
-
assert_respond_to(@
|
|
112
|
-
assert_nothing_raised{ @
|
|
113
|
-
assert_nothing_raised{ @
|
|
114
|
-
assert_raises(ArgumentError){ @
|
|
110
|
+
assert_respond_to(@table, :char)
|
|
111
|
+
assert_respond_to(@table, :char=)
|
|
112
|
+
assert_nothing_raised{ @table.char }
|
|
113
|
+
assert_nothing_raised{ @table.char = 'x' }
|
|
114
|
+
assert_raises(ArgumentError){ @table.char = 'xx' }
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
def test_charoff
|
|
118
|
-
assert_respond_to(@
|
|
119
|
-
assert_respond_to(@
|
|
120
|
-
assert_nothing_raised{ @
|
|
121
|
-
assert_nothing_raised{ @
|
|
122
|
-
assert_raises(ArgumentError){ @
|
|
118
|
+
assert_respond_to(@table, :charoff)
|
|
119
|
+
assert_respond_to(@table, :charoff=)
|
|
120
|
+
assert_nothing_raised{ @table.charoff }
|
|
121
|
+
assert_nothing_raised{ @table.charoff = 1 }
|
|
122
|
+
assert_raises(ArgumentError){ @table.charoff = -1 }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def test_class
|
|
126
|
+
assert_respond_to(@table, :class_)
|
|
127
|
+
assert_respond_to(@table, :class_=)
|
|
128
|
+
assert_nothing_raised{ @table.class_ }
|
|
129
|
+
assert_nothing_raised{ @table.class_ = 'myclass' }
|
|
123
130
|
end
|
|
124
131
|
|
|
125
132
|
def test_col
|
|
126
|
-
assert_respond_to(@
|
|
127
|
-
assert_respond_to(@
|
|
128
|
-
assert_nothing_raised{ @
|
|
129
|
-
assert_nothing_raised{ @
|
|
130
|
-
assert_raises(ArgumentError){ @
|
|
133
|
+
assert_respond_to(@table, :col)
|
|
134
|
+
assert_respond_to(@table, :col=)
|
|
135
|
+
assert_nothing_raised{ @table.col }
|
|
136
|
+
assert_nothing_raised{ @table.col = 1 }
|
|
137
|
+
assert_raises(ArgumentError){ @table.col = -1 }
|
|
131
138
|
end
|
|
132
139
|
|
|
133
140
|
def test_colspan
|
|
134
|
-
assert_respond_to(@
|
|
135
|
-
assert_respond_to(@
|
|
136
|
-
assert_nothing_raised{ @
|
|
137
|
-
assert_nothing_raised{ @
|
|
138
|
-
assert_raises(ArgumentError){ @
|
|
141
|
+
assert_respond_to(@table, :colspan)
|
|
142
|
+
assert_respond_to(@table, :colspan=)
|
|
143
|
+
assert_nothing_raised{ @table.colspan }
|
|
144
|
+
assert_nothing_raised{ @table.colspan = 1 }
|
|
145
|
+
assert_raises(ArgumentError){ @table.colspan = -1 }
|
|
139
146
|
end
|
|
140
147
|
|
|
141
148
|
def test_configure
|
|
142
|
-
assert_respond_to(@
|
|
143
|
-
assert_nothing_raised{ @
|
|
144
|
-
assert_nothing_raised{ @
|
|
145
|
-
assert_raises(ArgumentError){ @
|
|
149
|
+
assert_respond_to(@table, :configure)
|
|
150
|
+
assert_nothing_raised{ @table.configure(0){} }
|
|
151
|
+
assert_nothing_raised{ @table.configure(0,0){} }
|
|
152
|
+
assert_raises(ArgumentError){ @table.configure(0,0,0){} }
|
|
146
153
|
end
|
|
147
154
|
|
|
148
155
|
########################################################################
|
|
@@ -150,110 +157,117 @@ class TC_AttributeHandler < Test::Unit::TestCase
|
|
|
150
157
|
# type that we want to add as content.
|
|
151
158
|
########################################################################
|
|
152
159
|
def test_content
|
|
153
|
-
assert_respond_to(@
|
|
154
|
-
assert_respond_to(@
|
|
155
|
-
assert_nothing_raised{ @
|
|
156
|
-
assert_nothing_raised{ @
|
|
157
|
-
assert_nothing_raised{ @
|
|
158
|
-
assert_nothing_raised{ @
|
|
159
|
-
assert_nothing_raised{ @
|
|
160
|
-
assert_nothing_raised{ @
|
|
161
|
-
assert_nothing_raised{ @
|
|
162
|
-
assert_nothing_raised{ @
|
|
163
|
-
assert_nothing_raised{ @
|
|
164
|
-
assert_nothing_raised{ @
|
|
160
|
+
assert_respond_to(@table, :content)
|
|
161
|
+
assert_respond_to(@table, :content=)
|
|
162
|
+
assert_nothing_raised{ @table.content = 'foo' }
|
|
163
|
+
assert_nothing_raised{ @table.content = 123 }
|
|
164
|
+
assert_nothing_raised{ @table.content = ['one',2,'three'] }
|
|
165
|
+
assert_nothing_raised{ @table.content = [['foo','bar'],[1,2,3]] }
|
|
166
|
+
assert_nothing_raised{ @table.content = Table::Row.new }
|
|
167
|
+
assert_nothing_raised{ @table.content = Table::Row::Data.new }
|
|
168
|
+
assert_nothing_raised{ @table.content = Table::Row::Header.new }
|
|
169
|
+
assert_nothing_raised{ @table.content = Table::Head.create }
|
|
170
|
+
assert_nothing_raised{ @table.content = Table::Foot.create }
|
|
171
|
+
assert_nothing_raised{ @table.content = Table::Body.new }
|
|
165
172
|
end
|
|
166
173
|
|
|
167
174
|
def test_frame
|
|
168
|
-
assert_respond_to(@
|
|
169
|
-
assert_respond_to(@
|
|
170
|
-
assert_nothing_raised{ @
|
|
171
|
-
assert_nothing_raised{ @
|
|
172
|
-
assert_raises(ArgumentError){ @
|
|
175
|
+
assert_respond_to(@table, :frame)
|
|
176
|
+
assert_respond_to(@table, :frame=)
|
|
177
|
+
assert_nothing_raised{ @table.frame }
|
|
178
|
+
assert_nothing_raised{ @table.frame = 'below' }
|
|
179
|
+
assert_raises(ArgumentError){ @table.frame = 'foo' }
|
|
173
180
|
end
|
|
174
181
|
|
|
175
182
|
def test_height
|
|
176
|
-
assert_respond_to(@
|
|
177
|
-
assert_respond_to(@
|
|
178
|
-
assert_nothing_raised{ @
|
|
179
|
-
assert_nothing_raised{ @
|
|
180
|
-
assert_raises(ArgumentError){ @
|
|
183
|
+
assert_respond_to(@table, :height)
|
|
184
|
+
assert_respond_to(@table, :height=)
|
|
185
|
+
assert_nothing_raised{ @table.height }
|
|
186
|
+
assert_nothing_raised{ @table.height = 1 }
|
|
187
|
+
assert_raises(ArgumentError){ @table.height = -1 }
|
|
181
188
|
end
|
|
182
189
|
|
|
183
190
|
def test_hspace
|
|
184
|
-
assert_respond_to(@
|
|
185
|
-
assert_respond_to(@
|
|
186
|
-
assert_nothing_raised{ @
|
|
187
|
-
assert_nothing_raised{ @
|
|
188
|
-
assert_raises(ArgumentError){ @
|
|
191
|
+
assert_respond_to(@table, :hspace)
|
|
192
|
+
assert_respond_to(@table, :hspace=)
|
|
193
|
+
assert_nothing_raised{ @table.hspace }
|
|
194
|
+
assert_nothing_raised{ @table.hspace = 1 }
|
|
195
|
+
assert_raises(ArgumentError){ @table.hspace = -1 }
|
|
189
196
|
end
|
|
190
197
|
|
|
191
198
|
def test_nowrap
|
|
192
|
-
assert_respond_to(@
|
|
193
|
-
assert_respond_to(@
|
|
194
|
-
assert_nothing_raised{ @
|
|
195
|
-
assert_nothing_raised{ @
|
|
196
|
-
assert_raises(TypeError){ @
|
|
199
|
+
assert_respond_to(@table, :nowrap)
|
|
200
|
+
assert_respond_to(@table, :nowrap=)
|
|
201
|
+
assert_nothing_raised{ @table.nowrap }
|
|
202
|
+
assert_nothing_raised{ @table.nowrap = false }
|
|
203
|
+
assert_raises(TypeError){ @table.nowrap = 'foo' }
|
|
197
204
|
end
|
|
198
205
|
|
|
199
206
|
def test_rowspan
|
|
200
|
-
assert_respond_to(@
|
|
201
|
-
assert_respond_to(@
|
|
202
|
-
assert_nothing_raised{ @
|
|
203
|
-
assert_nothing_raised{ @
|
|
204
|
-
assert_raises(ArgumentError){ @
|
|
207
|
+
assert_respond_to(@table, :rowspan)
|
|
208
|
+
assert_respond_to(@table, :rowspan=)
|
|
209
|
+
assert_nothing_raised{ @table.rowspan }
|
|
210
|
+
assert_nothing_raised{ @table.rowspan = 1 }
|
|
211
|
+
assert_raises(ArgumentError){ @table.rowspan = -1 }
|
|
205
212
|
end
|
|
206
213
|
|
|
207
214
|
def test_rules
|
|
208
|
-
assert_respond_to(@
|
|
209
|
-
assert_respond_to(@
|
|
210
|
-
assert_nothing_raised{ @
|
|
211
|
-
assert_nothing_raised{ @
|
|
212
|
-
assert_raises(ArgumentError){ @
|
|
215
|
+
assert_respond_to(@table, :rules)
|
|
216
|
+
assert_respond_to(@table, :rules=)
|
|
217
|
+
assert_nothing_raised{ @table.rules }
|
|
218
|
+
assert_nothing_raised{ @table.rules = 'all' }
|
|
219
|
+
assert_raises(ArgumentError){ @table.rules = 'foo' }
|
|
213
220
|
end
|
|
214
221
|
|
|
215
222
|
def test_span
|
|
216
|
-
assert_respond_to(@
|
|
217
|
-
assert_respond_to(@
|
|
218
|
-
assert_nothing_raised{ @
|
|
219
|
-
assert_nothing_raised{ @
|
|
220
|
-
assert_raises(ArgumentError){ @
|
|
223
|
+
assert_respond_to(@table, :span)
|
|
224
|
+
assert_respond_to(@table, :span=)
|
|
225
|
+
assert_nothing_raised{ @table.span }
|
|
226
|
+
assert_nothing_raised{ @table.span = 1 }
|
|
227
|
+
assert_raises(ArgumentError){ @table.span = -1 }
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def test_style
|
|
231
|
+
assert_respond_to(@table, :style)
|
|
232
|
+
assert_respond_to(@table, :style=)
|
|
233
|
+
assert_nothing_raised{ @table.style }
|
|
234
|
+
assert_nothing_raised{ @table.style = 'color: blue' }
|
|
221
235
|
end
|
|
222
236
|
|
|
223
237
|
def test_summary
|
|
224
|
-
assert_respond_to(@
|
|
225
|
-
assert_respond_to(@
|
|
226
|
-
assert_nothing_raised{ @
|
|
227
|
-
assert_nothing_raised{ @
|
|
228
|
-
assert_nothing_raised{ @
|
|
238
|
+
assert_respond_to(@table, :summary)
|
|
239
|
+
assert_respond_to(@table, :summary=)
|
|
240
|
+
assert_nothing_raised{ @table.summary }
|
|
241
|
+
assert_nothing_raised{ @table.summary = 'foo' }
|
|
242
|
+
assert_nothing_raised{ @table.summary = 1 }
|
|
229
243
|
end
|
|
230
244
|
|
|
231
245
|
def test_valign
|
|
232
|
-
assert_respond_to(@
|
|
233
|
-
assert_respond_to(@
|
|
234
|
-
assert_nothing_raised{ @
|
|
235
|
-
assert_nothing_raised{ @
|
|
236
|
-
assert_raises(ArgumentError){ @
|
|
246
|
+
assert_respond_to(@table, :valign)
|
|
247
|
+
assert_respond_to(@table, :valign=)
|
|
248
|
+
assert_nothing_raised{ @table.valign }
|
|
249
|
+
assert_nothing_raised{ @table.valign = 'center' }
|
|
250
|
+
assert_raises(ArgumentError){ @table.valign = 'foo' }
|
|
237
251
|
end
|
|
238
252
|
|
|
239
253
|
def test_vspace
|
|
240
|
-
assert_respond_to(@
|
|
241
|
-
assert_respond_to(@
|
|
242
|
-
assert_nothing_raised{ @
|
|
243
|
-
assert_nothing_raised{ @
|
|
244
|
-
assert_raises(ArgumentError){ @
|
|
254
|
+
assert_respond_to(@table, :vspace)
|
|
255
|
+
assert_respond_to(@table, :vspace=)
|
|
256
|
+
assert_nothing_raised{ @table.vspace }
|
|
257
|
+
assert_nothing_raised{ @table.vspace = 1 }
|
|
258
|
+
assert_raises(ArgumentError){ @table.vspace = -1 }
|
|
245
259
|
end
|
|
246
260
|
|
|
247
261
|
def test_width
|
|
248
|
-
assert_respond_to(@
|
|
249
|
-
assert_respond_to(@
|
|
250
|
-
assert_nothing_raised{ @
|
|
251
|
-
assert_nothing_raised{ @
|
|
252
|
-
assert_nothing_raised{ @
|
|
253
|
-
assert_raises(ArgumentError){ @
|
|
262
|
+
assert_respond_to(@table, :width)
|
|
263
|
+
assert_respond_to(@table, :width=)
|
|
264
|
+
assert_nothing_raised{ @table.width}
|
|
265
|
+
assert_nothing_raised{ @table.width = 10 }
|
|
266
|
+
assert_nothing_raised{ @table.width = '5%' }
|
|
267
|
+
assert_raises(ArgumentError){ @table.width = -1 }
|
|
254
268
|
end
|
|
255
269
|
|
|
256
270
|
def teardown
|
|
257
|
-
@
|
|
271
|
+
@table = nil
|
|
258
272
|
end
|
|
259
273
|
end
|