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/spec/body_spec.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
############################################
|
2
|
+
# body_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the HTML::Table::Body class.
|
5
|
+
############################################
|
6
|
+
require 'rspec'
|
7
|
+
require 'html/table'
|
8
|
+
|
9
|
+
RSpec.describe HTML::Table::Body do
|
10
|
+
before do
|
11
|
+
@table = HTML::Table.new
|
12
|
+
@tbody = HTML::Table::Body.new
|
13
|
+
end
|
14
|
+
|
15
|
+
example "constructor" do
|
16
|
+
expect{ HTML::Table::Body.new }.not_to raise_error
|
17
|
+
expect{ HTML::Table::Body.new("foo") }.not_to raise_error
|
18
|
+
expect{ HTML::Table::Body.new(1) }.not_to raise_error
|
19
|
+
expect{ HTML::Table::Body.new(%w/foo bar baz/) }.not_to raise_error
|
20
|
+
expect{ HTML::Table::Body.new([1,2,3]) }.not_to raise_error
|
21
|
+
expect{ HTML::Table::Body.new([[1,2,3],["foo","bar"]]) }.not_to raise_error
|
22
|
+
end
|
23
|
+
|
24
|
+
example "basic" do
|
25
|
+
html = "<tbody></tbody>"
|
26
|
+
expect(@tbody.html.gsub(/\s{2,}|\n/, '')).to eq(html)
|
27
|
+
end
|
28
|
+
|
29
|
+
example "with_attributes" do
|
30
|
+
html = "<tbody align='left' char='x'></tbody>"
|
31
|
+
@tbody.align = "left"
|
32
|
+
@tbody.char = 'x'
|
33
|
+
expect(@tbody.html.gsub(/\s{2,}|\n/, '')).to eq(html)
|
34
|
+
end
|
35
|
+
|
36
|
+
example "push_single_row" do
|
37
|
+
html = "<tbody><tr><td>test</td></tr></tbody>"
|
38
|
+
@tbody.push HTML::Table::Row.new{|r| r.content = "test" }
|
39
|
+
expect(@tbody.html.gsub(/\s{2,}|\n/, '')).to eq(html)
|
40
|
+
end
|
41
|
+
|
42
|
+
example "push_multiple_rows" do
|
43
|
+
html = "<tbody><tr><td>test</td></tr><tr><td>foo</td></tr></tbody>"
|
44
|
+
r1 = HTML::Table::Row.new{|r| r.content = "test" }
|
45
|
+
r2 = HTML::Table::Row.new{|r| r.content = "foo" }
|
46
|
+
@tbody.push r1, r2
|
47
|
+
expect(@tbody.html.gsub(/\s{2,}|\n/, '')).to eq(html)
|
48
|
+
end
|
49
|
+
|
50
|
+
example "add_content_directly" do
|
51
|
+
html = "<tbody><tr><td>hello</td><td>world</td></tr></tbody>"
|
52
|
+
@tbody.content = "hello","world"
|
53
|
+
expect(@tbody.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
54
|
+
end
|
55
|
+
|
56
|
+
example "add_content_in_constructor" do
|
57
|
+
html = "<tbody><tr><td>hello</td><td>world</td></tr></tbody>"
|
58
|
+
tb = HTML::Table::Body.new(%w/hello world/)
|
59
|
+
expect(tb.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
60
|
+
end
|
61
|
+
|
62
|
+
example "configure_column" do
|
63
|
+
html = "<tbody><tr><td>hello</td><td abbr='test' width=3 nowrap>world"
|
64
|
+
html += "</td></tr></tbody>"
|
65
|
+
@tbody.content = "hello","world"
|
66
|
+
@tbody.configure(0,1){ |data|
|
67
|
+
data.abbr = 'test'
|
68
|
+
data.width = 3
|
69
|
+
data.nowrap = true
|
70
|
+
}
|
71
|
+
expect(@tbody.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
72
|
+
end
|
73
|
+
|
74
|
+
example "end_tags" do
|
75
|
+
expect(HTML::Table::Body).to respond_to(:end_tags?)
|
76
|
+
expect(HTML::Table::Body).to respond_to(:end_tags=)
|
77
|
+
expect{ HTML::Table::Body.end_tags = "foo" }.to raise_error(ArgumentTypeError)
|
78
|
+
expect{ HTML::Table::Body.end_tags = 1 }.to raise_error(ArgumentTypeError)
|
79
|
+
expect{ HTML::Table::Body.end_tags = true }.not_to raise_error
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
###################################################
|
2
|
+
# caption_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the HTML::Table::Caption class.
|
5
|
+
###################################################
|
6
|
+
require 'rspec'
|
7
|
+
require 'html/table'
|
8
|
+
|
9
|
+
RSpec.describe HTML::Table::Caption do
|
10
|
+
before do
|
11
|
+
@table = HTML::Table.new
|
12
|
+
@tcaption = HTML::Table::Caption.new
|
13
|
+
end
|
14
|
+
|
15
|
+
example "constructor" do
|
16
|
+
expect{ HTML::Table::Caption.new }.not_to raise_error
|
17
|
+
expect{ HTML::Table::Caption.new("foo") }.not_to raise_error
|
18
|
+
expect{ HTML::Table::Caption.new(1) }.not_to raise_error
|
19
|
+
expect{ HTML::Table::Caption.new(%w/foo bar baz/) }.not_to raise_error
|
20
|
+
expect{ HTML::Table::Caption.new([1,2,3]) }.not_to raise_error
|
21
|
+
expect{ HTML::Table::Caption.new([[1,2,3],["foo","bar"]]) }.not_to raise_error
|
22
|
+
end
|
23
|
+
|
24
|
+
example "basic" do
|
25
|
+
html = "<caption></caption>"
|
26
|
+
expect(@tcaption.html.gsub(/\s+/, '')).to eq(html)
|
27
|
+
end
|
28
|
+
|
29
|
+
example "with_attributes" do
|
30
|
+
html = "<caption align='left' valign='top'></caption>"
|
31
|
+
@tcaption.align = "left"
|
32
|
+
@tcaption.valign = "top"
|
33
|
+
expect(@tcaption.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
34
|
+
end
|
35
|
+
|
36
|
+
example "configure_not_allowed" do
|
37
|
+
expect{ @tcaption.configure }.to raise_error(NoMethodError)
|
38
|
+
end
|
39
|
+
|
40
|
+
example "add_content" do
|
41
|
+
html = "<caption>hello world</caption>"
|
42
|
+
@tcaption.content = "hello world"
|
43
|
+
expect(@tcaption.html.gsub(/\s{2,}/, '')).to eq(html)
|
44
|
+
end
|
45
|
+
|
46
|
+
example "add_multiple_content_items" do
|
47
|
+
html = "<caption>hello world</caption>"
|
48
|
+
@tcaption.content = "hello"," world"
|
49
|
+
expect(@tcaption.html.gsub(/\s{2,}/, '')).to eq(html)
|
50
|
+
end
|
51
|
+
|
52
|
+
example "add_content_in_constructor" do
|
53
|
+
html = "<caption>hello world</caption>"
|
54
|
+
@tcaption = HTML::Table::Caption.new("hello world")
|
55
|
+
expect(@tcaption.html.gsub(/\s{2,}/, '')).to eq(html)
|
56
|
+
end
|
57
|
+
|
58
|
+
example "indent_level" do
|
59
|
+
expect(HTML::Table::Caption).to respond_to(:indent_level)
|
60
|
+
expect(HTML::Table::Caption).to respond_to(:indent_level=)
|
61
|
+
expect{ HTML::Table::Caption.indent_level = "foo" }.to raise_error(ArgumentTypeError)
|
62
|
+
expect{ HTML::Table::Caption.indent_level = 3 }.not_to raise_error
|
63
|
+
end
|
64
|
+
|
65
|
+
example "only_row_zero_allowed" do
|
66
|
+
expect{ @table[1] = @tcaption }.to raise_error(ArgumentError)
|
67
|
+
end
|
68
|
+
|
69
|
+
example "automatically_set_to_row_zero" do
|
70
|
+
@table.content = "hello","world"
|
71
|
+
@table.push(@tcaption)
|
72
|
+
expect(@table[0]).to be_kind_of(HTML::Table::Caption)
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
##################################################
|
2
|
+
# colgroup_col_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Table::ColGroup::Col class
|
5
|
+
##################################################
|
6
|
+
require 'rspec'
|
7
|
+
require 'html/table'
|
8
|
+
|
9
|
+
RSpec.describe HTML::Table::ColGroup::Col do
|
10
|
+
before do
|
11
|
+
@col = described_class.new
|
12
|
+
end
|
13
|
+
|
14
|
+
example "basic" do
|
15
|
+
html = "<col>"
|
16
|
+
expect(@col.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
17
|
+
end
|
18
|
+
|
19
|
+
example "no_configure" do
|
20
|
+
expect{ @col.configure }.to raise_error(NoMethodError)
|
21
|
+
end
|
22
|
+
|
23
|
+
example "no_content_allowed" do
|
24
|
+
expect{ @col.content }.to raise_error(NoMethodError)
|
25
|
+
expect{ @col.content = "foo" }.to raise_error(NoMethodError)
|
26
|
+
end
|
27
|
+
|
28
|
+
example "indent_level" do
|
29
|
+
expect(described_class).to respond_to(:indent_level)
|
30
|
+
expect(described_class).to respond_to(:indent_level=)
|
31
|
+
expect{ described_class.indent_level = "foo" }.to raise_error(ArgumentTypeError)
|
32
|
+
expect{ described_class.indent_level = 6 }.not_to raise_error
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
##################################################
|
2
|
+
# colgroup_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the HTML::Table::ColGroup class.
|
5
|
+
##################################################
|
6
|
+
require 'rspec'
|
7
|
+
require 'html/table'
|
8
|
+
|
9
|
+
RSpec.describe HTML::Table::ColGroup do
|
10
|
+
before do
|
11
|
+
@cgroup = HTML::Table::ColGroup.new
|
12
|
+
@col = HTML::Table::ColGroup::Col.new
|
13
|
+
end
|
14
|
+
|
15
|
+
example "constructor" do
|
16
|
+
expect{ HTML::Table::ColGroup.new }.not_to raise_error
|
17
|
+
expect{ HTML::Table::ColGroup.new(@col) }.not_to raise_error
|
18
|
+
expect{ HTML::Table::ColGroup.new("foo") }.to raise_error(TypeError)
|
19
|
+
end
|
20
|
+
|
21
|
+
example "basic" do
|
22
|
+
html = "<colgroup></colgroup>"
|
23
|
+
expect(@cgroup.html.gsub(/\s+/, '')).to eq(html)
|
24
|
+
end
|
25
|
+
|
26
|
+
example "with_attributes" do
|
27
|
+
html = "<colgroup align='center' width='20%'></colgroup>"
|
28
|
+
@cgroup.align = "center"
|
29
|
+
@cgroup.width = "20%"
|
30
|
+
expect(@cgroup.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
31
|
+
end
|
32
|
+
|
33
|
+
example "push_single_col_element" do
|
34
|
+
html = "<colgroup><col></colgroup>"
|
35
|
+
@cgroup.push(@col)
|
36
|
+
expect(@cgroup.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
37
|
+
end
|
38
|
+
|
39
|
+
example "index_assignment_constraints" do
|
40
|
+
expect{ @cgroup[0] = "foo" }.to raise_error(ArgumentTypeError)
|
41
|
+
expect{ @cgroup[0] = 1 }.to raise_error(ArgumentTypeError)
|
42
|
+
expect{ @cgroup[1] = HTML::Table::Row.new }.to raise_error(ArgumentTypeError)
|
43
|
+
expect{ @cgroup[0] = HTML::Table::ColGroup::Col.new }.not_to raise_error
|
44
|
+
end
|
45
|
+
|
46
|
+
example "push_constraints" do
|
47
|
+
expect{ @cgroup.push(7) }.to raise_error(TypeError)
|
48
|
+
expect{ @cgroup.push("hello") }.to raise_error(TypeError)
|
49
|
+
expect{ @cgroup.push(HTML::Table::Row.new) }.to raise_error(TypeError)
|
50
|
+
expect{ @cgroup.push(HTML::Table::ColGroup::Col.new) }.not_to raise_error
|
51
|
+
end
|
52
|
+
|
53
|
+
example "double_arrow_constraints" do
|
54
|
+
expect{ @cgroup << 7 }.to raise_error(TypeError)
|
55
|
+
expect{ @cgroup << "hello" }.to raise_error(TypeError)
|
56
|
+
expect{ @cgroup << HTML::Table::Row.new }.to raise_error(TypeError)
|
57
|
+
expect{ @cgroup << HTML::Table::ColGroup::Col.new }.not_to raise_error
|
58
|
+
end
|
59
|
+
|
60
|
+
example "configure_error" do
|
61
|
+
expect{ @cgroup.configure(0,0){ }.to raise_error(ArgumentError) }
|
62
|
+
end
|
63
|
+
|
64
|
+
example "content_error" do
|
65
|
+
expect{ @cgroup.content }.to raise_error(NoMethodError)
|
66
|
+
expect{ @cgroup.content = 'blah' }.to raise_error(NoMethodError)
|
67
|
+
end
|
68
|
+
|
69
|
+
example "indent_level" do
|
70
|
+
expect(HTML::Table::ColGroup).to respond_to(:indent_level)
|
71
|
+
expect(HTML::Table::ColGroup).to respond_to(:indent_level=)
|
72
|
+
expect{ HTML::Table::ColGroup.indent_level = "foo" }.to raise_error(ArgumentTypeError)
|
73
|
+
expect{ HTML::Table::ColGroup.indent_level = 6 }.not_to raise_error
|
74
|
+
end
|
75
|
+
|
76
|
+
example "end_tags" do
|
77
|
+
expect(HTML::Table::ColGroup).to respond_to(:end_tags?)
|
78
|
+
expect(HTML::Table::ColGroup).to respond_to(:end_tags=)
|
79
|
+
expect{ HTML::Table::ColGroup.end_tags = "foo" }.to raise_error(ArgumentTypeError)
|
80
|
+
expect{ HTML::Table::ColGroup.end_tags = 1 }.to raise_error(ArgumentTypeError)
|
81
|
+
expect{ HTML::Table::ColGroup.end_tags = true }.not_to raise_error
|
82
|
+
end
|
83
|
+
end
|
data/spec/data_spec.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
###################################################
|
2
|
+
# data_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the HTML::Table::Row::Data class.
|
5
|
+
###################################################
|
6
|
+
require 'rspec'
|
7
|
+
require 'html/table'
|
8
|
+
|
9
|
+
RSpec.describe HTML::Table::Row::Data do
|
10
|
+
before do
|
11
|
+
@tdata = described_class.new
|
12
|
+
end
|
13
|
+
|
14
|
+
example "constructor" do
|
15
|
+
expect{ described_class.new }.not_to raise_error
|
16
|
+
expect{ described_class.new("foo") }.not_to raise_error
|
17
|
+
expect{ described_class.new(1) }.not_to raise_error
|
18
|
+
expect{ described_class.new(%w/foo bar baz/) }.not_to raise_error
|
19
|
+
expect{ described_class.new([1,2,3]) }.not_to raise_error
|
20
|
+
expect{ described_class.new([[1,2,3],["foo","bar"]]) }.not_to raise_error
|
21
|
+
end
|
22
|
+
|
23
|
+
example "basic" do
|
24
|
+
html = "<td></td>"
|
25
|
+
expect(@tdata.html.gsub(/\s+/, '')).to eq(html)
|
26
|
+
end
|
27
|
+
|
28
|
+
example "with_attributes" do
|
29
|
+
html = "<td align='left' width=3 nowrap></td>"
|
30
|
+
@tdata.align = 'left'
|
31
|
+
@tdata.width = 3
|
32
|
+
@tdata.nowrap = true
|
33
|
+
expect(@tdata.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
34
|
+
end
|
35
|
+
|
36
|
+
example "configure_not_allowed" do
|
37
|
+
expect{ @tdata.configure }.to raise_error(NoMethodError)
|
38
|
+
end
|
39
|
+
|
40
|
+
example "add_content" do
|
41
|
+
html = "<td>hello world</td>"
|
42
|
+
@tdata.content = "hello world"
|
43
|
+
expect(@tdata.html.gsub(/\s{2,}/, '')).to eq(html)
|
44
|
+
end
|
45
|
+
|
46
|
+
example "add_content_in_constructor" do
|
47
|
+
html = "<td>hello world</td>"
|
48
|
+
td = described_class.new("hello world")
|
49
|
+
expect(td.html.gsub(/\s{2,}/, '')).to eq(html)
|
50
|
+
end
|
51
|
+
|
52
|
+
example "add_multiple_content_items" do
|
53
|
+
html = "<td>hello world</td>"
|
54
|
+
@tdata.content = "hello"," world"
|
55
|
+
expect(@tdata.html.gsub(/\s{2,}/, '')).to eq(html)
|
56
|
+
end
|
57
|
+
|
58
|
+
example "indent_level" do
|
59
|
+
expect(described_class).to respond_to(:indent_level)
|
60
|
+
expect(described_class).to respond_to(:indent_level=)
|
61
|
+
expect{ described_class.indent_level = "foo" }.to raise_error(ArgumentTypeError)
|
62
|
+
expect{ described_class.indent_level = 6 }.not_to raise_error
|
63
|
+
end
|
64
|
+
|
65
|
+
example "end_tags" do
|
66
|
+
expect(described_class).to respond_to(:end_tags?)
|
67
|
+
expect(described_class).to respond_to(:end_tags=)
|
68
|
+
expect{ described_class.end_tags = "foo" }.to raise_error(ArgumentTypeError)
|
69
|
+
expect{ described_class.end_tags = 1 }.to raise_error(ArgumentTypeError)
|
70
|
+
expect{ described_class.end_tags = true }.not_to raise_error
|
71
|
+
end
|
72
|
+
end
|
data/spec/foot_spec.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# foot_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the HTML::Table::Foot class. The 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 'rspec'
|
9
|
+
require 'html/table'
|
10
|
+
|
11
|
+
class HTML::Table::Foot
|
12
|
+
private
|
13
|
+
def refresh
|
14
|
+
@@foot = nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
RSpec.describe HTML::Table::Foot do
|
19
|
+
before do
|
20
|
+
@table = HTML::Table.new
|
21
|
+
@tfoot = described_class.create
|
22
|
+
end
|
23
|
+
|
24
|
+
example "new_not_allowed" do
|
25
|
+
expect{ described_class.new }.to raise_error(NoMethodError)
|
26
|
+
end
|
27
|
+
|
28
|
+
example "constructor" do
|
29
|
+
expect{ described_class.create }.not_to raise_error
|
30
|
+
expect{ described_class.create("foo") }.not_to raise_error
|
31
|
+
expect{ described_class.create(1) }.not_to raise_error
|
32
|
+
expect{ described_class.create(%w/foo bar baz/) }.not_to raise_error
|
33
|
+
expect{ described_class.create([1,2,3]) }.not_to raise_error
|
34
|
+
expect{ described_class.create([[1,2,3], ["foo","bar"]]) }.not_to raise_error
|
35
|
+
end
|
36
|
+
|
37
|
+
example "basic" do
|
38
|
+
html = "<tfoot></tfoot>"
|
39
|
+
expect(@tfoot.html.gsub(/\s{2,}|\n/, '')).to eq(html)
|
40
|
+
end
|
41
|
+
|
42
|
+
example "end_tags" do
|
43
|
+
expect(described_class).to respond_to(:end_tags?)
|
44
|
+
expect(described_class).to respond_to(:end_tags=)
|
45
|
+
expect{ described_class.end_tags? }.not_to raise_error
|
46
|
+
expect{ described_class.end_tags = true }.not_to raise_error
|
47
|
+
end
|
48
|
+
|
49
|
+
example "end_tags_expected_errors" do
|
50
|
+
expect{ described_class.end_tags = "foo" }.to raise_error(HTML::Mixin::StrongTyping::ArgumentTypeError)
|
51
|
+
end
|
52
|
+
|
53
|
+
example "with_attributes" do
|
54
|
+
html = "<tfoot align='left' char='x'></tfoot>"
|
55
|
+
@tfoot.align = "left"
|
56
|
+
@tfoot.char = 'x'
|
57
|
+
expect(@tfoot.html.gsub(/\s{2,}|\n/, '')).to eq(html)
|
58
|
+
end
|
59
|
+
|
60
|
+
example "push_single_row" do
|
61
|
+
html = "<tfoot><tr><td>test</td></tr></tfoot>"
|
62
|
+
@tfoot.push Table::Row.new{|r| r.content = "test"}
|
63
|
+
expect(@tfoot.html.gsub(/\s{2,}|\n/, '')).to eq(html)
|
64
|
+
end
|
65
|
+
|
66
|
+
example "push_multiple_rows" do
|
67
|
+
html = "<tfoot><tr><td>test</td></tr><tr><td>foo</td></tr></tfoot>"
|
68
|
+
r1 = Table::Row.new{|r| r.content = "test"}
|
69
|
+
r2 = Table::Row.new{|r| r.content = "foo"}
|
70
|
+
@tfoot.push r1, r2
|
71
|
+
expect(@tfoot.html.gsub(/\s{2,}|\n/, '')).to eq(html)
|
72
|
+
end
|
73
|
+
|
74
|
+
example "add_content_directly" do
|
75
|
+
html = "<tfoot><tr><td>hello</td><td>world</td></tr></tfoot>"
|
76
|
+
@tfoot.content = "hello","world"
|
77
|
+
expect(@tfoot.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
78
|
+
end
|
79
|
+
|
80
|
+
example "add_content_in_constructor" do
|
81
|
+
html = "<tfoot><tr><td>hello</td><td>world</td></tr></tfoot>"
|
82
|
+
@tfoot.send(:refresh)
|
83
|
+
@tfoot = described_class.create(["hello","world"])
|
84
|
+
expect(@tfoot.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
85
|
+
end
|
86
|
+
|
87
|
+
example "configure_column" do
|
88
|
+
html = "<tfoot><tr><td>hello</td><td abbr='test' width=3 nowrap>world"
|
89
|
+
html += "</td></tr></tfoot>"
|
90
|
+
@tfoot.content = "hello","world"
|
91
|
+
@tfoot.configure(0,1){ |data|
|
92
|
+
data.abbr = 'test'
|
93
|
+
data.width = 3
|
94
|
+
data.nowrap = true
|
95
|
+
}
|
96
|
+
expect(@tfoot.html.gsub(/\s{2,}|\n+/, '')).to eq(html)
|
97
|
+
end
|
98
|
+
|
99
|
+
after do
|
100
|
+
@table = nil
|
101
|
+
@tfoot.send(:refresh)
|
102
|
+
@tfoot = nil
|
103
|
+
end
|
104
|
+
end
|