html-table 1.6.3 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES.rdoc +4 -0
- data/Gemfile +7 -0
- data/MANIFEST.rdoc +18 -17
- data/Rakefile +117 -146
- data/html-table.gemspec +4 -4
- data/lib/html/mixin/attribute_handler.rb +2 -2
- data/lib/html/table.rb +1 -1
- data/spec/attribute_handler_spec.rb +360 -0
- data/spec/body_spec.rb +81 -0
- data/spec/caption_spec.rb +74 -0
- data/spec/colgroup_col_spec.rb +34 -0
- data/spec/colgroup_spec.rb +83 -0
- data/spec/data_spec.rb +72 -0
- data/spec/foot_spec.rb +104 -0
- data/spec/head_spec.rb +101 -0
- data/spec/header_spec.rb +72 -0
- data/spec/html_handler_spec.rb +32 -0
- data/spec/row_spec.rb +136 -0
- data/spec/table_spec.rb +152 -0
- data/spec/tablesection_spec.rb +36 -0
- data/spec/tag_handler_spec.rb +85 -0
- metadata +43 -42
- metadata.gz.sig +0 -0
- data/test/test_attribute_handler.rb +0 -361
- data/test/test_body.rb +0 -87
- data/test/test_caption.rb +0 -80
- data/test/test_col.rb +0 -40
- data/test/test_colgroup.rb +0 -89
- data/test/test_data.rb +0 -77
- data/test/test_foot.rb +0 -111
- data/test/test_head.rb +0 -104
- data/test/test_header.rb +0 -77
- data/test/test_html_handler.rb +0 -37
- data/test/test_row.rb +0 -141
- data/test/test_table.rb +0 -159
- data/test/test_tablesection.rb +0 -42
- data/test/test_tag_handler.rb +0 -90
data/test/test_body.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
############################################
|
2
|
-
# test_body.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Table::Body class
|
5
|
-
############################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'html/table'
|
8
|
-
include HTML
|
9
|
-
|
10
|
-
class TC_HTML_Table_Body < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@table = Table.new
|
13
|
-
@tbody = Table::Body.new
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_constructor
|
17
|
-
assert_nothing_raised{ Table::Body.new }
|
18
|
-
assert_nothing_raised{ Table::Body.new("foo") }
|
19
|
-
assert_nothing_raised{ Table::Body.new(1) }
|
20
|
-
assert_nothing_raised{ Table::Body.new(%w/foo bar baz/) }
|
21
|
-
assert_nothing_raised{ Table::Body.new([1,2,3]) }
|
22
|
-
assert_nothing_raised{ Table::Body.new([[1,2,3],["foo","bar"]]) }
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_basic
|
26
|
-
html = "<tbody></tbody>"
|
27
|
-
assert_equal(html, @tbody.html.gsub(/\s{2,}|\n/,''))
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_with_attributes
|
31
|
-
html = "<tbody align='left' char='x'></tbody>"
|
32
|
-
@tbody.align = "left"
|
33
|
-
@tbody.char = 'x'
|
34
|
-
assert_equal(html, @tbody.html.gsub(/\s{2,}|\n/,''))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_push_single_row
|
38
|
-
html = "<tbody><tr><td>test</td></tr></tbody>"
|
39
|
-
@tbody.push Table::Row.new{|r| r.content = "test" }
|
40
|
-
assert_equal(html, @tbody.html.gsub(/\s{2,}|\n/,''))
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_push_multiple_rows
|
44
|
-
html = "<tbody><tr><td>test</td></tr><tr><td>foo</td></tr></tbody>"
|
45
|
-
r1 = Table::Row.new{|r| r.content = "test" }
|
46
|
-
r2 = Table::Row.new{|r| r.content = "foo" }
|
47
|
-
@tbody.push r1, r2
|
48
|
-
assert_equal(html, @tbody.html.gsub(/\s{2,}|\n/,''))
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_add_content_directly
|
52
|
-
html = "<tbody><tr><td>hello</td><td>world</td></tr></tbody>"
|
53
|
-
@tbody.content = "hello","world"
|
54
|
-
assert_equal(html, @tbody.html.gsub(/\s{2,}|\n+/,''))
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_add_content_in_constructor
|
58
|
-
html = "<tbody><tr><td>hello</td><td>world</td></tr></tbody>"
|
59
|
-
tb = Table::Body.new(%w/hello world/)
|
60
|
-
assert_equal(html, tb.html.gsub(/\s{2,}|\n+/,''))
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_configure_column
|
64
|
-
html = "<tbody><tr><td>hello</td><td abbr='test' width=3 nowrap>world"
|
65
|
-
html += "</td></tr></tbody>"
|
66
|
-
@tbody.content = "hello","world"
|
67
|
-
@tbody.configure(0,1){ |data|
|
68
|
-
data.abbr = 'test'
|
69
|
-
data.width = 3
|
70
|
-
data.nowrap = true
|
71
|
-
}
|
72
|
-
assert_equal(html, @tbody.html.gsub(/\s{2,}|\n+/,''))
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_end_tags
|
76
|
-
assert_respond_to(Table::Body, :end_tags?)
|
77
|
-
assert_respond_to(Table::Body, :end_tags=)
|
78
|
-
assert_raises(ArgumentTypeError){ Table::Body.end_tags = "foo" }
|
79
|
-
assert_raises(ArgumentTypeError){ Table::Body.end_tags = 1 }
|
80
|
-
assert_nothing_raised{ Table::Body.end_tags = true }
|
81
|
-
end
|
82
|
-
|
83
|
-
def teardown
|
84
|
-
@table = nil
|
85
|
-
@tbody = nil
|
86
|
-
end
|
87
|
-
end
|
data/test/test_caption.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
################################################
|
2
|
-
# test_caption.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Table::Caption class
|
5
|
-
################################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'html/table'
|
8
|
-
include HTML
|
9
|
-
|
10
|
-
class TC_HTML_Table_Caption < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@table = Table.new
|
13
|
-
@tcaption = Table::Caption.new
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_constructor
|
17
|
-
assert_nothing_raised{ Table::Caption.new }
|
18
|
-
assert_nothing_raised{ Table::Caption.new("foo") }
|
19
|
-
assert_nothing_raised{ Table::Caption.new(1) }
|
20
|
-
assert_nothing_raised{ Table::Caption.new(%w/foo bar baz/) }
|
21
|
-
assert_nothing_raised{ Table::Caption.new([1,2,3]) }
|
22
|
-
assert_nothing_raised{ Table::Caption.new([[1,2,3],["foo","bar"]]) }
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_basic
|
26
|
-
html = "<caption></caption>"
|
27
|
-
assert_equal(html, @tcaption.html.gsub(/\s+/,''))
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_with_attributes
|
31
|
-
html = "<caption align='left' valign='top'></caption>"
|
32
|
-
@tcaption.align = "left"
|
33
|
-
@tcaption.valign = "top"
|
34
|
-
assert_equal(html, @tcaption.html.gsub(/\s{2,}|\n+/,''))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_configure_not_allowed
|
38
|
-
assert_raises(NoMethodError){ @tcaption.configure }
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_add_content
|
42
|
-
html = "<caption>hello world</caption>"
|
43
|
-
@tcaption.content = "hello world"
|
44
|
-
assert_equal(html,@tcaption.html.gsub(/\s{2,}/,''))
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_add_multiple_content_items
|
48
|
-
html = "<caption>hello world</caption>"
|
49
|
-
@tcaption.content = "hello"," world"
|
50
|
-
assert_equal(html,@tcaption.html.gsub(/\s{2,}/,''))
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_add_content_in_constructor
|
54
|
-
html = "<caption>hello world</caption>"
|
55
|
-
@tcaption = Table::Caption.new("hello world")
|
56
|
-
assert_equal(html, @tcaption.html.gsub(/\s{2,}/,''))
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_indent_level
|
60
|
-
assert_respond_to(Table::Caption,:indent_level)
|
61
|
-
assert_respond_to(Table::Caption,:indent_level=)
|
62
|
-
assert_raises(ArgumentTypeError){ Table::Caption.indent_level = "foo" }
|
63
|
-
assert_nothing_raised{ Table::Caption.indent_level = 3 }
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_only_row_zero_allowed
|
67
|
-
assert_raises(ArgumentError){ @table[1] = @tcaption }
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_automatically_set_to_row_zero
|
71
|
-
@table.content = "hello","world"
|
72
|
-
@table.push(@tcaption)
|
73
|
-
assert_equal(true, @table[0].kind_of?(Table::Caption))
|
74
|
-
end
|
75
|
-
|
76
|
-
def teardown
|
77
|
-
@table = nil
|
78
|
-
@tcaption = nil
|
79
|
-
end
|
80
|
-
end
|
data/test/test_col.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
##################################################
|
2
|
-
# test_col.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Table::ColGroup::Col class
|
5
|
-
##################################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'html/table'
|
8
|
-
include HTML
|
9
|
-
|
10
|
-
class TC_HTML_Table_Col < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@col = Table::ColGroup::Col.new
|
13
|
-
@cgroup = Table::ColGroup.new
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_basic
|
17
|
-
html = "<col>"
|
18
|
-
assert_equal(html, @col.html.gsub(/\s{2,}|\n+/,''))
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_no_configure
|
22
|
-
assert_raises(NoMethodError){ @col.configure }
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_no_content_allowed
|
26
|
-
assert_raises(NoMethodError){ @col.content }
|
27
|
-
assert_raises(NoMethodError){ @col.content = "foo" }
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_indent_level
|
31
|
-
assert_respond_to(Table::ColGroup::Col,:indent_level)
|
32
|
-
assert_respond_to(Table::ColGroup::Col,:indent_level=)
|
33
|
-
assert_raises(ArgumentTypeError){ Table::ColGroup::Col.indent_level = "foo" }
|
34
|
-
assert_nothing_raised{ Table::ColGroup::Col.indent_level = 6 }
|
35
|
-
end
|
36
|
-
|
37
|
-
def teardown
|
38
|
-
@col = nil
|
39
|
-
end
|
40
|
-
end
|
data/test/test_colgroup.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
############################################
|
2
|
-
# test_colgroup.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Table::ColGroup class
|
5
|
-
############################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'html/table'
|
8
|
-
include HTML
|
9
|
-
|
10
|
-
class TC_HTML_Table_ColGroup < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@cgroup = Table::ColGroup.new
|
13
|
-
@col = Table::ColGroup::Col.new
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_constructor
|
17
|
-
assert_nothing_raised{ Table::ColGroup.new }
|
18
|
-
assert_nothing_raised{ Table::ColGroup.new(@col) }
|
19
|
-
assert_raises(TypeError){ Table::ColGroup.new("foo") }
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_basic
|
23
|
-
html = "<colgroup></colgroup>"
|
24
|
-
assert_equal(html,@cgroup.html.gsub(/\s+/,''))
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_with_attributes
|
28
|
-
html = "<colgroup align='center' width='20%'></colgroup>"
|
29
|
-
@cgroup.align = "center"
|
30
|
-
@cgroup.width = "20%"
|
31
|
-
assert_equal(html,@cgroup.html.gsub(/\s{2,}|\n+/,''))
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_push_single_col_element
|
35
|
-
html = "<colgroup><col></colgroup>"
|
36
|
-
@cgroup.push(@col)
|
37
|
-
assert_equal(html,@cgroup.html.gsub(/\s{2,}|\n+/,''))
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_index_assignment_constraints
|
41
|
-
assert_raises(ArgumentTypeError){ @cgroup[0] = "foo" }
|
42
|
-
assert_raises(ArgumentTypeError){ @cgroup[0] = 1 }
|
43
|
-
assert_raises(ArgumentTypeError){ @cgroup[1] = Table::Row.new }
|
44
|
-
assert_nothing_raised{ @cgroup[0] = Table::ColGroup::Col.new }
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_push_constraints
|
48
|
-
assert_raises(TypeError){ @cgroup.push(7) }
|
49
|
-
assert_raises(TypeError){ @cgroup.push("hello") }
|
50
|
-
assert_raises(TypeError){ @cgroup.push(Table::Row.new) }
|
51
|
-
assert_nothing_raised{ @cgroup.push(Table::ColGroup::Col.new) }
|
52
|
-
end
|
53
|
-
|
54
|
-
# Test '<<'
|
55
|
-
def test_double_arrow_constraints
|
56
|
-
assert_raises(TypeError){ @cgroup << 7 }
|
57
|
-
assert_raises(TypeError){ @cgroup << "hello" }
|
58
|
-
assert_raises(TypeError){ @cgroup << Table::Row.new }
|
59
|
-
assert_nothing_raised{ @cgroup << Table::ColGroup::Col.new }
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_configure_error
|
63
|
-
assert_raises(ArgumentError){ @cgroup.configure(0,0){ } }
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_content_error
|
67
|
-
assert_raises(NoMethodError){ @cgroup.content }
|
68
|
-
assert_raises(NoMethodError){ @cgroup.content = 'blah' }
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_indent_level
|
72
|
-
assert_respond_to(Table::ColGroup,:indent_level)
|
73
|
-
assert_respond_to(Table::ColGroup,:indent_level=)
|
74
|
-
assert_raises(ArgumentTypeError){ Table::ColGroup.indent_level = "foo" }
|
75
|
-
assert_nothing_raised{ Table::ColGroup.indent_level = 6 }
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_end_tags
|
79
|
-
assert_respond_to(Table::ColGroup,:end_tags?)
|
80
|
-
assert_respond_to(Table::ColGroup,:end_tags=)
|
81
|
-
assert_raises(ArgumentTypeError){ Table::ColGroup.end_tags = "foo" }
|
82
|
-
assert_raises(ArgumentTypeError){ Table::ColGroup.end_tags = 1 }
|
83
|
-
assert_nothing_raised{ Table::ColGroup.end_tags = true }
|
84
|
-
end
|
85
|
-
|
86
|
-
def teardown
|
87
|
-
@cgroup = nil
|
88
|
-
end
|
89
|
-
end
|
data/test/test_data.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
##############################################
|
2
|
-
# test_data.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Table::Row::Data class
|
5
|
-
##############################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'html/table'
|
8
|
-
include HTML
|
9
|
-
|
10
|
-
class TC_HTML_Table_Row_Data < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@tdata = Table::Row::Data.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_constructor
|
16
|
-
assert_nothing_raised{ Table::Row::Data.new }
|
17
|
-
assert_nothing_raised{ Table::Row::Data.new("foo") }
|
18
|
-
assert_nothing_raised{ Table::Row::Data.new(1) }
|
19
|
-
assert_nothing_raised{ Table::Row::Data.new(%w/foo bar baz/) }
|
20
|
-
assert_nothing_raised{ Table::Row::Data.new([1,2,3]) }
|
21
|
-
assert_nothing_raised{ Table::Row::Data.new([[1,2,3],["foo","bar"]]) }
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_basic
|
25
|
-
html = "<td></td>"
|
26
|
-
assert_equal(html,@tdata.html.gsub(/\s+/,''))
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_with_attributes
|
30
|
-
html = "<td align='left' width=3 nowrap></td>"
|
31
|
-
@tdata.align = 'left'
|
32
|
-
@tdata.width = 3
|
33
|
-
@tdata.nowrap = true
|
34
|
-
assert_equal(html,@tdata.html.gsub(/\s{2,}|\n+/,''))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_configure_not_allowed
|
38
|
-
assert_raises(NoMethodError){ @tdata.configure }
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_add_content
|
42
|
-
html = "<td>hello world</td>"
|
43
|
-
@tdata.content = "hello world"
|
44
|
-
assert_equal(html,@tdata.html.gsub(/\s{2,}/,''))
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_add_content_in_constructor
|
48
|
-
html = "<td>hello world</td>"
|
49
|
-
td = Table::Row::Data.new("hello world")
|
50
|
-
assert_equal(html,td.html.gsub(/\s{2,}/,''))
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_add_multiple_content_items
|
54
|
-
html = "<td>hello world</td>"
|
55
|
-
@tdata.content = "hello"," world"
|
56
|
-
assert_equal(html,@tdata.html.gsub(/\s{2,}/,''))
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_indent_level
|
60
|
-
assert_respond_to(Table::Row::Data,:indent_level)
|
61
|
-
assert_respond_to(Table::Row::Data,:indent_level=)
|
62
|
-
assert_raises(ArgumentTypeError){ Table::Row::Data.indent_level = "foo" }
|
63
|
-
assert_nothing_raised{ Table::Row::Data.indent_level = 6 }
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_end_tags
|
67
|
-
assert_respond_to(Table::Row::Data,:end_tags?)
|
68
|
-
assert_respond_to(Table::Row::Data,:end_tags=)
|
69
|
-
assert_raises(ArgumentTypeError){ Table::Row::Data.end_tags = "foo" }
|
70
|
-
assert_raises(ArgumentTypeError){ Table::Row::Data.end_tags = 1 }
|
71
|
-
assert_nothing_raised{ Table::Row::Data.end_tags = true }
|
72
|
-
end
|
73
|
-
|
74
|
-
def teardown
|
75
|
-
@tdata = nil
|
76
|
-
end
|
77
|
-
end
|
data/test/test_foot.rb
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
###############################################################################
|
2
|
-
# test_foot.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Table::Foot class. The Table::Foot class is a singleton
|
5
|
-
# class, so we have to take extra measures to ensure that a fresh instance
|
6
|
-
# is created between tests.
|
7
|
-
###############################################################################
|
8
|
-
require 'test-unit'
|
9
|
-
require 'html/table'
|
10
|
-
include HTML
|
11
|
-
|
12
|
-
#####################################################################
|
13
|
-
# Ensure that a fresh instance of Table::Foot is used between tests
|
14
|
-
# by calling 'refresh' in the 'teardown' method.
|
15
|
-
#####################################################################
|
16
|
-
class Table::Foot
|
17
|
-
private
|
18
|
-
def refresh
|
19
|
-
@@foot = nil
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class TC_HTML_Table_Foot < Test::Unit::TestCase
|
24
|
-
def setup
|
25
|
-
@table = Table.new
|
26
|
-
@tfoot = Table::Foot.create
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_new_not_allowed
|
30
|
-
assert_raises(NoMethodError){ Table::Foot.new }
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_constructor
|
34
|
-
assert_nothing_raised{ Table::Foot.create }
|
35
|
-
assert_nothing_raised{ Table::Foot.create("foo") }
|
36
|
-
assert_nothing_raised{ Table::Foot.create(1) }
|
37
|
-
assert_nothing_raised{ Table::Foot.create(%w/foo bar baz/) }
|
38
|
-
assert_nothing_raised{ Table::Foot.create([1,2,3]) }
|
39
|
-
assert_nothing_raised{ Table::Foot.create([[1,2,3], ["foo","bar"]]) }
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_basic
|
43
|
-
html = "<tfoot></tfoot>"
|
44
|
-
assert_equal(html, @tfoot.html.gsub(/\s{2,}|\n/,''))
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_end_tags
|
48
|
-
assert_respond_to(Table::Foot, :end_tags?)
|
49
|
-
assert_respond_to(Table::Foot, :end_tags=)
|
50
|
-
assert_nothing_raised{ Table::Foot.end_tags? }
|
51
|
-
assert_nothing_raised{ Table::Foot.end_tags = true }
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_end_tags_expected_errors
|
55
|
-
assert_raises(StrongTyping::ArgumentTypeError){
|
56
|
-
Table::Foot.end_tags = "foo"
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_with_attributes
|
61
|
-
html = "<tfoot align='left' char='x'></tfoot>"
|
62
|
-
@tfoot.align = "left"
|
63
|
-
@tfoot.char = 'x'
|
64
|
-
assert_equal(html, @tfoot.html.gsub(/\s{2,}|\n/,''))
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_push_single_row
|
68
|
-
html = "<tfoot><tr><td>test</td></tr></tfoot>"
|
69
|
-
@tfoot.push Table::Row.new{|r| r.content = "test"}
|
70
|
-
assert_equal(html, @tfoot.html.gsub(/\s{2,}|\n/,''))
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_push_multiple_rows
|
74
|
-
html = "<tfoot><tr><td>test</td></tr><tr><td>foo</td></tr></tfoot>"
|
75
|
-
r1 = Table::Row.new{|r| r.content = "test"}
|
76
|
-
r2 = Table::Row.new{|r| r.content = "foo"}
|
77
|
-
@tfoot.push r1, r2
|
78
|
-
assert_equal(html, @tfoot.html.gsub(/\s{2,}|\n/,''))
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_add_content_directly
|
82
|
-
html = "<tfoot><tr><td>hello</td><td>world</td></tr></tfoot>"
|
83
|
-
@tfoot.content = "hello","world"
|
84
|
-
assert_equal(html, @tfoot.html.gsub(/\s{2,}|\n+/,''))
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_add_content_in_constructor
|
88
|
-
html = "<tfoot><tr><td>hello</td><td>world</td></tr></tfoot>"
|
89
|
-
@tfoot.send(:refresh)
|
90
|
-
@tfoot = Table::Foot.create(["hello","world"])
|
91
|
-
assert_equal(html, @tfoot.html.gsub(/\s{2,}|\n+/,''))
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_configure_column
|
95
|
-
html = "<tfoot><tr><td>hello</td><td abbr='test' width=3 nowrap>world"
|
96
|
-
html += "</td></tr></tfoot>"
|
97
|
-
@tfoot.content = "hello","world"
|
98
|
-
@tfoot.configure(0,1){ |data|
|
99
|
-
data.abbr = 'test'
|
100
|
-
data.width = 3
|
101
|
-
data.nowrap = true
|
102
|
-
}
|
103
|
-
assert_equal(html, @tfoot.html.gsub(/\s{2,}|\n+/,''))
|
104
|
-
end
|
105
|
-
|
106
|
-
def teardown
|
107
|
-
@table = nil
|
108
|
-
@tfoot.send(:refresh)
|
109
|
-
@tfoot = nil
|
110
|
-
end
|
111
|
-
end
|