html-table 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +13 -0
- data/MANIFEST +13 -13
- data/README +27 -26
- data/Rakefile +120 -2
- data/examples/advanced.rb +128 -0
- data/examples/intermediate1.rb +72 -0
- data/examples/intermediate2.rb +62 -0
- data/examples/intermediate3.rb +46 -0
- data/examples/simple1.rb +39 -0
- data/examples/simple2.rb +47 -0
- data/examples/simple3.rb +41 -0
- data/html-table.gemspec +5 -3
- data/lib/html/attribute_handler.rb +8 -16
- data/lib/html/table.rb +11 -4
- data/lib/html/tag_handler.rb +1 -3
- data/test/{tc_attribute_handler.rb → test_attribute_handler.rb} +110 -9
- data/test/{tc_body.rb → test_body.rb} +31 -28
- data/test/{tc_caption.rb → test_caption.rb} +26 -23
- data/test/{tc_col.rb → test_col.rb} +13 -10
- data/test/{tc_colgroup.rb → test_colgroup.rb} +29 -26
- data/test/{tc_data.rb → test_data.rb} +18 -15
- data/test/{tc_foot.rb → test_foot.rb} +34 -28
- data/test/{tc_head.rb → test_head.rb} +27 -24
- data/test/{tc_header.rb → test_header.rb} +20 -17
- data/test/test_html_handler.rb +40 -0
- data/test/test_row.rb +144 -0
- data/test/{tc_table.rb → test_table.rb} +47 -44
- data/test/{tc_tablesection.rb → test_tablesection.rb} +14 -11
- data/test/test_tag_handler.rb +93 -0
- metadata +61 -37
- data/html-table-1.3.2.gem +0 -0
- data/test/tc_html_handler.rb +0 -37
- data/test/tc_row.rb +0 -141
- data/test/tc_tag_handler.rb +0 -82
@@ -1,16 +1,19 @@
|
|
1
1
|
################################################
|
2
|
-
#
|
2
|
+
# test_tablesection.rb
|
3
3
|
#
|
4
4
|
# Test suite for the Table::TableSection class
|
5
5
|
################################################
|
6
|
+
require 'rubygems'
|
7
|
+
gem 'test-unit'
|
8
|
+
|
6
9
|
require "test/unit"
|
7
10
|
require "html/table"
|
8
11
|
include HTML
|
9
12
|
|
10
13
|
class TC_HTML_Table_TableSection < Test::Unit::TestCase
|
11
14
|
def setup
|
12
|
-
@
|
13
|
-
@
|
15
|
+
@table = Table.new
|
16
|
+
@tsection = Table::TableSection.new
|
14
17
|
end
|
15
18
|
|
16
19
|
def test_indent_level
|
@@ -21,22 +24,22 @@ class TC_HTML_Table_TableSection < Test::Unit::TestCase
|
|
21
24
|
end
|
22
25
|
|
23
26
|
def test_indices
|
24
|
-
assert_raises(ArgumentTypeError){ @
|
25
|
-
assert_nothing_raised{ @
|
27
|
+
assert_raises(ArgumentTypeError){ @tsection[0] = "foo" }
|
28
|
+
assert_nothing_raised{ @tsection[0] = Table::Row.new }
|
26
29
|
end
|
27
30
|
|
28
31
|
def test_push
|
29
|
-
assert_raises(ArgumentTypeError){ @
|
30
|
-
assert_nothing_raised{ @
|
32
|
+
assert_raises(ArgumentTypeError){ @tsection.push("foo") }
|
33
|
+
assert_nothing_raised{ @tsection.push(Table::Row.new) }
|
31
34
|
end
|
32
35
|
|
33
36
|
def test_unshift
|
34
|
-
assert_raises(ArgumentTypeError){ @
|
35
|
-
assert_nothing_raised{ @
|
37
|
+
assert_raises(ArgumentTypeError){ @tsection.unshift("foo") }
|
38
|
+
assert_nothing_raised{ @tsection.unshift(Table::Row.new) }
|
36
39
|
end
|
37
40
|
|
38
41
|
def teardown
|
39
|
-
@
|
40
|
-
@
|
42
|
+
@table = nil
|
43
|
+
@tsection = nil
|
41
44
|
end
|
42
45
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
############################################################################
|
2
|
+
# test_tag_handler.rb
|
3
|
+
#
|
4
|
+
# Test suite for the TagHandler module. For these tests, we'll use an
|
5
|
+
# instance of the Table class where the module has been mixed in.
|
6
|
+
############################################################################
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'test-unit'
|
9
|
+
|
10
|
+
require 'test/unit'
|
11
|
+
require 'html/table'
|
12
|
+
include HTML
|
13
|
+
|
14
|
+
class TC_TagHandler < Test::Unit::TestCase
|
15
|
+
def self.startup
|
16
|
+
BlinkWarning.disable
|
17
|
+
end
|
18
|
+
|
19
|
+
def setup
|
20
|
+
@tcontent = Table::Content.new('test')
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_bold
|
24
|
+
assert_respond_to(@tcontent, :bold)
|
25
|
+
assert_respond_to(@tcontent, :bold=)
|
26
|
+
assert_nothing_raised{ @tcontent.bold }
|
27
|
+
assert_nothing_raised{ @tcontent.bold = true }
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_big
|
31
|
+
assert_respond_to(@tcontent, :big)
|
32
|
+
assert_respond_to(@tcontent, :big=)
|
33
|
+
assert_nothing_raised{ @tcontent.big }
|
34
|
+
assert_nothing_raised{ @tcontent.big = true }
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_blink
|
38
|
+
assert_respond_to(@tcontent, :blink)
|
39
|
+
assert_respond_to(@tcontent, :blink=)
|
40
|
+
assert_nothing_raised{ @tcontent.blink }
|
41
|
+
assert_nothing_raised{ @tcontent.blink = true }
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_italic
|
45
|
+
assert_respond_to(@tcontent, :italic)
|
46
|
+
assert_respond_to(@tcontent, :italic=)
|
47
|
+
assert_nothing_raised{ @tcontent.italic }
|
48
|
+
assert_nothing_raised{ @tcontent.italic = true }
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_strike
|
52
|
+
assert_respond_to(@tcontent, :strike)
|
53
|
+
assert_respond_to(@tcontent, :strike=)
|
54
|
+
assert_nothing_raised{ @tcontent.strike }
|
55
|
+
assert_nothing_raised{ @tcontent.strike = true }
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_sub
|
59
|
+
assert_respond_to(@tcontent, :sub)
|
60
|
+
assert_respond_to(@tcontent, :sub)
|
61
|
+
assert_nothing_raised{ @tcontent.sub }
|
62
|
+
assert_nothing_raised{ @tcontent.sub = true }
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_sup
|
66
|
+
assert_respond_to(@tcontent, :sup)
|
67
|
+
assert_respond_to(@tcontent, :sup)
|
68
|
+
assert_nothing_raised{ @tcontent.sup }
|
69
|
+
assert_nothing_raised{ @tcontent.sup = true }
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_tt
|
73
|
+
assert_respond_to(@tcontent, :tt)
|
74
|
+
assert_respond_to(@tcontent, :tt)
|
75
|
+
assert_nothing_raised{ @tcontent.tt }
|
76
|
+
assert_nothing_raised{ @tcontent.tt = true }
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_underline
|
80
|
+
assert_respond_to(@tcontent, :underline)
|
81
|
+
assert_respond_to(@tcontent, :underline)
|
82
|
+
assert_nothing_raised{ @tcontent.underline }
|
83
|
+
assert_nothing_raised{ @tcontent.underline = true }
|
84
|
+
end
|
85
|
+
|
86
|
+
def teardown
|
87
|
+
@tcontent = nil
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.shutdown
|
91
|
+
BlinkWarning.enable
|
92
|
+
end
|
93
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-02-05 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,26 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: test-unit
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: structured_warnings
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
25
45
|
description: A Ruby interface for generating HTML tables
|
26
46
|
email: djberg96@gmail.com
|
27
47
|
executables: []
|
@@ -50,7 +70,6 @@ files:
|
|
50
70
|
- lib/html/col.rb
|
51
71
|
- lib/html/colgroup.rb
|
52
72
|
- lib/html/content.rb
|
53
|
-
- lib/html/CVS
|
54
73
|
- lib/html/data.rb
|
55
74
|
- lib/html/foot.rb
|
56
75
|
- lib/html/head.rb
|
@@ -61,33 +80,36 @@ files:
|
|
61
80
|
- lib/html/tablesection.rb
|
62
81
|
- lib/html/tag_handler.rb
|
63
82
|
- CHANGES
|
64
|
-
- CVS
|
65
83
|
- doc
|
66
84
|
- examples
|
67
|
-
- html-table-1.3.2.gem
|
68
85
|
- html-table.gemspec
|
69
86
|
- lib
|
70
87
|
- MANIFEST
|
71
88
|
- Rakefile
|
72
89
|
- README
|
73
90
|
- test
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
81
|
-
- test/
|
82
|
-
- test/
|
83
|
-
- test/
|
84
|
-
- test/
|
85
|
-
- test/
|
86
|
-
- test/
|
87
|
-
- test/
|
88
|
-
- test/
|
91
|
+
- examples/advanced.rb
|
92
|
+
- examples/intermediate1.rb
|
93
|
+
- examples/intermediate2.rb
|
94
|
+
- examples/intermediate3.rb
|
95
|
+
- examples/simple1.rb
|
96
|
+
- examples/simple2.rb
|
97
|
+
- examples/simple3.rb
|
98
|
+
- test/test_attribute_handler.rb
|
99
|
+
- test/test_body.rb
|
100
|
+
- test/test_caption.rb
|
101
|
+
- test/test_col.rb
|
102
|
+
- test/test_colgroup.rb
|
103
|
+
- test/test_data.rb
|
104
|
+
- test/test_foot.rb
|
105
|
+
- test/test_head.rb
|
106
|
+
- test/test_header.rb
|
107
|
+
- test/test_html_handler.rb
|
108
|
+
- test/test_row.rb
|
109
|
+
- test/test_table.rb
|
110
|
+
- test/test_tablesection.rb
|
111
|
+
- test/test_tag_handler.rb
|
89
112
|
- doc/attributes.rdoc
|
90
|
-
- doc/CVS
|
91
113
|
- doc/table.rdoc
|
92
114
|
- doc/table_body.rdoc
|
93
115
|
- doc/table_caption.rdoc
|
@@ -101,6 +123,8 @@ files:
|
|
101
123
|
- doc/table_row_header.rdoc
|
102
124
|
has_rdoc: true
|
103
125
|
homepage: http://shards.rubyforge.org
|
126
|
+
licenses: []
|
127
|
+
|
104
128
|
post_install_message:
|
105
129
|
rdoc_options: []
|
106
130
|
|
@@ -121,22 +145,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
145
|
requirements: []
|
122
146
|
|
123
147
|
rubyforge_project: shards
|
124
|
-
rubygems_version: 1.
|
148
|
+
rubygems_version: 1.3.1
|
125
149
|
signing_key:
|
126
|
-
specification_version:
|
150
|
+
specification_version: 3
|
127
151
|
summary: A Ruby interface for generating HTML tables
|
128
152
|
test_files:
|
129
|
-
- test/
|
130
|
-
- test/
|
131
|
-
- test/
|
132
|
-
- test/
|
133
|
-
- test/
|
134
|
-
- test/
|
135
|
-
- test/
|
136
|
-
- test/
|
137
|
-
- test/
|
138
|
-
- test/
|
139
|
-
- test/
|
140
|
-
- test/
|
141
|
-
- test/
|
142
|
-
- test/
|
153
|
+
- test/test_attribute_handler.rb
|
154
|
+
- test/test_body.rb
|
155
|
+
- test/test_caption.rb
|
156
|
+
- test/test_col.rb
|
157
|
+
- test/test_colgroup.rb
|
158
|
+
- test/test_data.rb
|
159
|
+
- test/test_foot.rb
|
160
|
+
- test/test_head.rb
|
161
|
+
- test/test_header.rb
|
162
|
+
- test/test_html_handler.rb
|
163
|
+
- test/test_row.rb
|
164
|
+
- test/test_table.rb
|
165
|
+
- test/test_tablesection.rb
|
166
|
+
- test/test_tag_handler.rb
|
data/html-table-1.3.2.gem
DELETED
File without changes
|
data/test/tc_html_handler.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
############################################################################
|
2
|
-
# tc_html_handler.rb
|
3
|
-
#
|
4
|
-
# Test suite for the HtmlHandler module. For these tests, we'll use an
|
5
|
-
# instance of the Table class where the module has been mixed in.
|
6
|
-
############################################################################
|
7
|
-
require "test/unit"
|
8
|
-
require "html/table"
|
9
|
-
include HTML
|
10
|
-
|
11
|
-
class TC_HtmlHandler < Test::Unit::TestCase
|
12
|
-
def setup
|
13
|
-
@t = Table.new(["foo",1,"bar"])
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_html
|
17
|
-
assert_respond_to(@t, :html)
|
18
|
-
assert_nothing_raised{ @t.html }
|
19
|
-
assert_raises(NoMethodError){ @t.html = "foo" }
|
20
|
-
assert_kind_of(String,@t.html)
|
21
|
-
assert_equal(true,@t.html.length > 0)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_modify_html
|
25
|
-
assert_raises(ArgumentError){ @t.send(:modify_html) }
|
26
|
-
assert_nothing_raised{ @t.send(:modify_html,"nowrap") }
|
27
|
-
assert_nothing_raised{ @t.send(:modify_html,"align","top") }
|
28
|
-
assert_nothing_raised{
|
29
|
-
@t.send(:modify_html,"align","top")
|
30
|
-
@t.send(:modify_html,"align","top")
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
def teardown
|
35
|
-
@t = nil
|
36
|
-
end
|
37
|
-
end
|
data/test/tc_row.rb
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
############################################
|
2
|
-
# tc_row.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Table::Row class
|
5
|
-
############################################
|
6
|
-
require "test/unit"
|
7
|
-
require "html/table"
|
8
|
-
include HTML
|
9
|
-
|
10
|
-
class TC_HTML_Table_Row < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@tr = Table::Row.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_constructor
|
16
|
-
assert_nothing_raised{ Table::Row.new }
|
17
|
-
assert_nothing_raised{ Table::Row.new("foo") }
|
18
|
-
assert_nothing_raised{ Table::Row.new(1) }
|
19
|
-
assert_nothing_raised{ Table::Row.new([1,2,3]) }
|
20
|
-
assert_nothing_raised{ Table::Row.new([[1,2,3],["foo","bar"]]) }
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_basic
|
24
|
-
html = "<tr></tr>"
|
25
|
-
assert_equal(html,@tr.html.gsub(/\s+/,''))
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_header
|
29
|
-
assert_respond_to(@tr, :header?)
|
30
|
-
assert_respond_to(@tr, :header=)
|
31
|
-
assert_nothing_raised{ @tr.header? }
|
32
|
-
assert_nothing_raised{ @tr.header = true }
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_with_attributes
|
36
|
-
html = "<tr align='center'></tr>"
|
37
|
-
@tr.align = "center"
|
38
|
-
assert_equal(html,@tr.html.gsub(/\s{2,}|\n+/,''))
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_index_assignment_constraints
|
42
|
-
assert_raises(ArgumentTypeError){ @tr[0] = "foo" }
|
43
|
-
assert_raises(ArgumentTypeError){ @tr[0] = 1 }
|
44
|
-
assert_raises(ArgumentTypeError){ @tr[0] = Table::Caption.new }
|
45
|
-
assert_nothing_raised{ @tr[0] = Table::Row::Data.new }
|
46
|
-
assert_nothing_raised{ @tr[0] = Table::Row::Header.new }
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_push_constraints
|
50
|
-
assert_raises(ArgumentTypeError){ @tr.push(Table::Caption.new) }
|
51
|
-
assert_raises(ArgumentTypeError){ @tr.push(nil) }
|
52
|
-
assert_nothing_raised{ @tr.push("test") }
|
53
|
-
assert_nothing_raised{ @tr.push(7) }
|
54
|
-
assert_nothing_raised{ @tr.push(Table::Row::Data.new) }
|
55
|
-
assert_nothing_raised{ @tr.push(Table::Row::Header.new) }
|
56
|
-
end
|
57
|
-
|
58
|
-
# Test the '<<' method
|
59
|
-
def test_doubl_arrow_constraints
|
60
|
-
assert_raises(ArgumentTypeError){ @tr << Table::Caption.new }
|
61
|
-
assert_nothing_raised{ @tr << "test" }
|
62
|
-
assert_nothing_raised{ @tr << "test" << "foo" }
|
63
|
-
assert_nothing_raised{ @tr << Table::Row::Data.new }
|
64
|
-
assert_nothing_raised{ @tr << Table::Row::Header.new }
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_header_in_constructor
|
68
|
-
assert_nothing_raised{ @tr = Table::Row.new('test', true) }
|
69
|
-
html = "<tr><th>test</th></tr>"
|
70
|
-
assert_equal(html, @tr.html.gsub(/\s+/,''))
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_push_single_data_element
|
74
|
-
html = "<tr><td>hello</td></tr>"
|
75
|
-
@tr.push Table::Row::Data.new{ |d| d.content = "hello" }
|
76
|
-
assert_equal(html,@tr.html.gsub(/\s{2,}|\n+/,''))
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_push_multiple_data_element
|
80
|
-
html = "<tr><td>hello</td><td>world</td></tr>"
|
81
|
-
d1 = Table::Row::Data.new{ |d| d.content = "hello" }
|
82
|
-
d2 = Table::Row::Data.new{ |d| d.content = "world" }
|
83
|
-
@tr.push d1, d2
|
84
|
-
assert_equal(html,@tr.html.gsub(/\s{2,}|\n+/,''))
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_add_content_directly
|
88
|
-
html = "<tr><td>hello</td><td>world</td></tr>"
|
89
|
-
@tr.content = "hello","world"
|
90
|
-
assert_equal(html,@tr.html.gsub(/\s{2,}|\n+/,''))
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_add_content_in_constructor
|
94
|
-
html = "<tr><td>hello</td><td>world</td></tr>"
|
95
|
-
tr = Table::Row.new(%w/hello world/)
|
96
|
-
assert_equal(html,tr.html.gsub(/\s{2,}|\n+/,''))
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_configure_column
|
100
|
-
html = "<tr><td>hello</td><td abbr='test' width=3 nowrap>world</td></tr>"
|
101
|
-
@tr.content = "hello","world"
|
102
|
-
@tr.configure(1){ |d|
|
103
|
-
d.abbr = 'test'
|
104
|
-
d.width = 3
|
105
|
-
d.nowrap = true
|
106
|
-
}
|
107
|
-
assert_equal(html,@tr.html.gsub(/\s{2,}|\n+/,''))
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_unshift_constraints
|
111
|
-
assert_raises(ArgumentTypeError){ @tr.unshift(Table::Caption.new) }
|
112
|
-
assert_raises(ArgumentTypeError){ @tr.unshift(nil) }
|
113
|
-
assert_nothing_raised{ @tr.unshift("test") }
|
114
|
-
assert_nothing_raised{ @tr.unshift(7) }
|
115
|
-
assert_nothing_raised{ @tr.unshift(Table::Row::Data.new) }
|
116
|
-
assert_nothing_raised{ @tr.unshift(Table::Row::Header.new) }
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_configure_error
|
120
|
-
assert_raises(ArgumentError){ @tr.configure(0,0){ } }
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_indent_level
|
124
|
-
assert_respond_to(Table::Row,:indent_level)
|
125
|
-
assert_respond_to(Table::Row,:indent_level=)
|
126
|
-
assert_raises(ArgumentTypeError){ Table::Row.indent_level = "foo" }
|
127
|
-
assert_nothing_raised{ Table::Row.indent_level = 3 }
|
128
|
-
end
|
129
|
-
|
130
|
-
def test_end_tags
|
131
|
-
assert_respond_to(Table::Row,:end_tags?)
|
132
|
-
assert_respond_to(Table::Row,:end_tags=)
|
133
|
-
assert_raises(ArgumentTypeError){ Table::Row.end_tags = "foo" }
|
134
|
-
assert_raises(ArgumentTypeError){ Table::Row.end_tags = 1 }
|
135
|
-
assert_nothing_raised{ Table::Row.end_tags = true }
|
136
|
-
end
|
137
|
-
|
138
|
-
def teardown
|
139
|
-
@tr = nil
|
140
|
-
end
|
141
|
-
end
|