htmlgrid 1.1.7 → 1.2.2
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.
- checksums.yaml +4 -4
- data/lib/htmlgrid/booleanvalue.rb +14 -14
- data/lib/htmlgrid/button.rb +9 -9
- data/lib/htmlgrid/centeredcomposite.rb +21 -20
- data/lib/htmlgrid/component.rb +214 -197
- data/lib/htmlgrid/composite.rb +332 -301
- data/lib/htmlgrid/datevalue.rb +12 -12
- data/lib/htmlgrid/div.rb +9 -9
- data/lib/htmlgrid/divcomposite.rb +44 -43
- data/lib/htmlgrid/divform.rb +8 -8
- data/lib/htmlgrid/divlist.rb +17 -19
- data/lib/htmlgrid/divtemplate.rb +6 -6
- data/lib/htmlgrid/dojotoolkit.rb +54 -48
- data/lib/htmlgrid/errormessage.rb +47 -43
- data/lib/htmlgrid/form.rb +70 -62
- data/lib/htmlgrid/formlist.rb +14 -14
- data/lib/htmlgrid/grid.rb +111 -67
- data/lib/htmlgrid/image.rb +17 -16
- data/lib/htmlgrid/infomessage.rb +15 -14
- data/lib/htmlgrid/input.rb +34 -32
- data/lib/htmlgrid/inputcheckbox.rb +13 -13
- data/lib/htmlgrid/inputcurrency.rb +9 -9
- data/lib/htmlgrid/inputdate.rb +11 -11
- data/lib/htmlgrid/inputfile.rb +13 -12
- data/lib/htmlgrid/inputradio.rb +9 -9
- data/lib/htmlgrid/inputtext.rb +10 -10
- data/lib/htmlgrid/javascript.rb +17 -16
- data/lib/htmlgrid/label.rb +53 -49
- data/lib/htmlgrid/labeltext.rb +8 -8
- data/lib/htmlgrid/link.rb +31 -27
- data/lib/htmlgrid/list.rb +121 -110
- data/lib/htmlgrid/namedcomponent.rb +28 -25
- data/lib/htmlgrid/pass.rb +11 -11
- data/lib/htmlgrid/passthru.rb +20 -17
- data/lib/htmlgrid/popuplink.rb +41 -39
- data/lib/htmlgrid/reset.rb +8 -8
- data/lib/htmlgrid/richtext.rb +22 -20
- data/lib/htmlgrid/select.rb +28 -26
- data/lib/htmlgrid/span.rb +9 -9
- data/lib/htmlgrid/spancomposite.rb +18 -18
- data/lib/htmlgrid/spanlist.rb +9 -9
- data/lib/htmlgrid/staticinput.rb +14 -13
- data/lib/htmlgrid/submit.rb +9 -9
- data/lib/htmlgrid/template.rb +121 -105
- data/lib/htmlgrid/text.rb +9 -9
- data/lib/htmlgrid/textarea.rb +19 -17
- data/lib/htmlgrid/ulcomposite.rb +22 -22
- data/lib/htmlgrid/ullist.rb +9 -9
- data/lib/htmlgrid/urllink.rb +38 -36
- data/lib/htmlgrid/value.rb +9 -9
- data/lib/htmlgrid/version.rb +2 -2
- data/test/stub/cgi.rb +10 -7
- data/test/suite.rb +3 -3
- data/test/test_add_row.rb +12 -13
- data/test/test_component.rb +141 -91
- data/test/test_composite.rb +85 -46
- data/test/test_datevalue.rb +28 -24
- data/test/test_divlist.rb +126 -0
- data/test/test_dojotoolkit.rb +41 -26
- data/test/test_form.rb +89 -73
- data/test/test_formlist.rb +77 -65
- data/test/test_grid.rb +256 -208
- data/test/test_input.rb +37 -31
- data/test/test_interaction_list.rb +106 -70
- data/test/test_label.rb +91 -77
- data/test/test_list.rb +110 -95
- data/test/test_select.rb +35 -30
- data/test/test_template.rb +66 -55
- data/test/test_text.rb +36 -31
- metadata +17 -4
- data/TooltipDialog.txt +0 -73
- data/interaction_no_inline.txt +0 -1216
data/test/test_datevalue.rb
CHANGED
@@ -21,40 +21,44 @@
|
|
21
21
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
22
22
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
23
23
|
#
|
24
|
-
# TestDateValue -- htmlgrid -- 10.03.2003 -- hwyss@ywesee.com
|
24
|
+
# TestDateValue -- htmlgrid -- 10.03.2003 -- hwyss@ywesee.com
|
25
25
|
|
26
26
|
$: << File.expand_path("../lib", File.dirname(__FILE__))
|
27
27
|
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
28
|
+
require "minitest/autorun"
|
29
|
+
require "htmlgrid/datevalue"
|
30
|
+
require "stub/cgi"
|
31
|
+
require "date"
|
32
32
|
|
33
33
|
class StubDateLookandfeel
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
def lookup(key)
|
35
|
+
"%d.%m.%Y"
|
36
|
+
end
|
37
|
+
|
38
|
+
def attributes(key)
|
39
|
+
{}
|
40
|
+
end
|
40
41
|
end
|
42
|
+
|
41
43
|
class StubDateSession
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
def lookandfeel
|
45
|
+
StubDateLookandfeel.new
|
46
|
+
end
|
45
47
|
end
|
48
|
+
|
46
49
|
class StubDateProvider
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
+
def date
|
51
|
+
Date.new(2002, 1, 1)
|
52
|
+
end
|
50
53
|
end
|
51
54
|
|
52
55
|
class TestDateValue < Minitest::Test
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
def setup
|
57
|
+
@component = HtmlGrid::DateValue.new(:date, StubDateProvider.new,
|
58
|
+
StubDateSession.new)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_formatted
|
62
|
+
assert_equal("01.01.2002", @component.to_html(CGI.new))
|
63
|
+
end
|
60
64
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
4
|
+
# Copyright (C) 2003 ywesee - intellectual capital connected
|
5
|
+
# Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
|
6
|
+
#
|
7
|
+
# This library is free software; you can redistribute it and/or
|
8
|
+
# modify it under the terms of the GNU Lesser General Public
|
9
|
+
# License as published by the Free Software Foundation; either
|
10
|
+
# version 2.1 of the License, or (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This library is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
# Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public
|
18
|
+
# License along with this library; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20
|
+
#
|
21
|
+
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
22
|
+
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
23
|
+
#
|
24
|
+
# TestList -- htmlgrid -- 03.03.2003 -- hwyss@ywesee.com
|
25
|
+
|
26
|
+
$: << File.dirname(__FILE__)
|
27
|
+
$: << File.expand_path("../lib", File.dirname(__FILE__))
|
28
|
+
|
29
|
+
require "minitest/autorun"
|
30
|
+
require "htmlgrid/divlist"
|
31
|
+
require "stub/cgi"
|
32
|
+
require "test_helper"
|
33
|
+
|
34
|
+
module HtmlGrid
|
35
|
+
class DivList < DivComposite
|
36
|
+
attr_reader :grid
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class StubDivList < HtmlGrid::DivList
|
41
|
+
attr_reader :model
|
42
|
+
COMPONENTS = {
|
43
|
+
[0, 0] => :jaguar,
|
44
|
+
[1, 0] => :panther
|
45
|
+
}
|
46
|
+
CSS_MAP = {
|
47
|
+
[0, 0] => "flecken",
|
48
|
+
[1, 0] => "schwarz"
|
49
|
+
}
|
50
|
+
SORT_HEADER = false
|
51
|
+
SORT_DEFAULT = :foo
|
52
|
+
end
|
53
|
+
|
54
|
+
class StubDivListLookandfeel
|
55
|
+
def lookup(key)
|
56
|
+
key
|
57
|
+
end
|
58
|
+
|
59
|
+
def attributes(key)
|
60
|
+
{}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class StubDivListSession
|
65
|
+
attr_accessor :event
|
66
|
+
def lookandfeel
|
67
|
+
StubDivListLookandfeel.new
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class StubDivListModel
|
72
|
+
attr_reader :foo
|
73
|
+
def initialize(foo)
|
74
|
+
@foo = foo
|
75
|
+
end
|
76
|
+
|
77
|
+
def jaguar
|
78
|
+
"Jaguar"
|
79
|
+
end
|
80
|
+
|
81
|
+
def panther
|
82
|
+
"Panther"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class StubDivListEmpty
|
87
|
+
attr_reader :foo
|
88
|
+
def initialize(foo)
|
89
|
+
@foo = foo
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
class TestDivList < Minitest::Test
|
94
|
+
def setup
|
95
|
+
model = [
|
96
|
+
StubDivListModel.new(3),
|
97
|
+
StubDivListModel.new(2),
|
98
|
+
StubDivListModel.new(4),
|
99
|
+
StubDivListModel.new(1),
|
100
|
+
StubDivListModel.new(nil)
|
101
|
+
]
|
102
|
+
@list = StubDivList.new(model, StubDivListSession.new)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_nil_robust
|
106
|
+
list = StubDivList.new(nil, StubDivListSession.new)
|
107
|
+
assert_equal("", list.to_html(CGI.new))
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_to_html
|
111
|
+
expected = "<DIV>JaguarPanther</DIV><DIV>JaguarPanther</DIV><DIV>JaguarPanther</DIV><DIV>JaguarPanther</DIV><DIV>JaguarPanther</DIV>"
|
112
|
+
assert_equal(expected, @list.to_html(CGI.new))
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_nil_robust_to_html
|
116
|
+
list = StubDivList.new([nil], StubDivListSession.new)
|
117
|
+
expected = "<DIV></DIV>"
|
118
|
+
assert_equal(expected, list.to_html(CGI.new))
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_nil_robust_to_html2
|
122
|
+
list = StubDivList.new([], StubDivListSession.new)
|
123
|
+
expected = ""
|
124
|
+
assert_equal(expected, list.to_html(CGI.new))
|
125
|
+
end
|
126
|
+
end
|
data/test/test_dojotoolkit.rb
CHANGED
@@ -22,93 +22,107 @@
|
|
22
22
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
23
23
|
#
|
24
24
|
|
25
|
-
$: << File.expand_path(
|
25
|
+
$: << File.expand_path("../lib", File.dirname(__FILE__))
|
26
26
|
$: << File.dirname(__FILE__)
|
27
27
|
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
28
|
+
require "minitest/autorun"
|
29
|
+
require "stub/cgi"
|
30
|
+
require "htmlgrid/template"
|
31
|
+
require "htmlgrid/dojotoolkit"
|
32
|
+
require "test_helper"
|
33
|
+
require "flexmock/minitest"
|
34
|
+
require "sbsm/lookandfeel"
|
34
35
|
|
35
36
|
class TestDojotoolkit < Minitest::Test
|
36
37
|
class StubAttributeComponent < HtmlGrid::Component
|
37
|
-
HTML_ATTRIBUTES = {
|
38
|
+
HTML_ATTRIBUTES = {"key" => "val"}
|
38
39
|
end
|
40
|
+
|
39
41
|
class StubInitComponent < HtmlGrid::Component
|
40
42
|
attr_reader :init_called
|
41
43
|
def init
|
42
44
|
@init_called = true
|
43
45
|
end
|
44
46
|
end
|
47
|
+
|
45
48
|
class StubLabelComponent < HtmlGrid::Component
|
46
49
|
LABEL = true
|
47
50
|
end
|
51
|
+
|
48
52
|
class StubContainer
|
49
53
|
attr_accessor :onsubmit
|
50
54
|
end
|
55
|
+
|
51
56
|
def setup
|
52
57
|
@component = HtmlGrid::Component.new(nil, nil)
|
53
|
-
@session = flexmock(
|
54
|
-
s.should_receive(:user_agent).and_return(
|
58
|
+
@session = flexmock("session") do |s|
|
59
|
+
s.should_receive(:user_agent).and_return("user_agent").by_default
|
55
60
|
end
|
56
61
|
@cgi = CGI.new
|
57
62
|
end
|
63
|
+
|
58
64
|
def test_dynamic_html
|
59
65
|
comp = HtmlGrid::Component.new("foo", @session)
|
60
|
-
comp.dojo_tooltip =
|
66
|
+
comp.dojo_tooltip = "my_tooltip"
|
61
67
|
assert_equal("foo", comp.model)
|
62
68
|
assert_equal(false, comp.label?)
|
63
|
-
result= comp.dynamic_html(@cgi)
|
69
|
+
result = comp.dynamic_html(@cgi)
|
64
70
|
assert(/href="my_tooltip"/.match(result))
|
65
71
|
end
|
72
|
+
|
66
73
|
def test_dynamic_html_with_msie
|
67
|
-
@session.should_receive(:user_agent).and_return(
|
74
|
+
@session.should_receive(:user_agent).and_return("MSIE 4")
|
68
75
|
comp = HtmlGrid::Component.new("foo", @session)
|
69
|
-
comp.dojo_tooltip =
|
76
|
+
comp.dojo_tooltip = "my_tooltip"
|
70
77
|
assert_equal("foo", comp.model)
|
71
78
|
assert_equal(false, comp.label?)
|
72
|
-
result= comp.dynamic_html(@cgi)
|
79
|
+
result = comp.dynamic_html(@cgi)
|
73
80
|
assert(/href="my_tooltip"/.match(result))
|
74
81
|
end
|
75
82
|
end
|
83
|
+
|
76
84
|
class StubTemplateLookandfeel < SBSM::Lookandfeel
|
77
85
|
RESOURCES = {
|
78
|
-
:
|
86
|
+
css: "test.css"
|
79
87
|
}
|
80
88
|
DICTIONARIES = {
|
81
89
|
"de" => {
|
82
|
-
:
|
90
|
+
html_title: "Test"
|
83
91
|
}
|
84
92
|
}
|
85
93
|
def lookandfeel
|
86
94
|
self
|
87
95
|
end
|
88
96
|
end
|
97
|
+
|
89
98
|
class StubTemplateSession
|
90
99
|
def flavor
|
91
100
|
"gcc"
|
92
101
|
end
|
102
|
+
|
93
103
|
def language
|
94
104
|
"de"
|
95
105
|
end
|
106
|
+
|
96
107
|
def http_protocol
|
97
|
-
|
108
|
+
"http"
|
98
109
|
end
|
110
|
+
|
99
111
|
def server_name
|
100
112
|
"testserver.com"
|
101
113
|
end
|
114
|
+
|
102
115
|
def server_port
|
103
|
-
|
116
|
+
"80"
|
104
117
|
end
|
105
|
-
|
118
|
+
alias_method :default_language, :language
|
106
119
|
end
|
120
|
+
|
107
121
|
class PublicTemplate < HtmlGrid::Template
|
108
122
|
include HtmlGrid::DojoToolkit::DojoTemplate
|
109
123
|
COMPONENTS = {}
|
110
124
|
def dynamic_html_headers(context)
|
111
|
-
|
125
|
+
_headers = super
|
112
126
|
end
|
113
127
|
end
|
114
128
|
|
@@ -117,16 +131,17 @@ class TestTemplate < Minitest::Test
|
|
117
131
|
lookandfeel = StubTemplateLookandfeel.new(StubTemplateSession.new)
|
118
132
|
@template = PublicTemplate.new(nil, lookandfeel, nil)
|
119
133
|
end
|
134
|
+
|
120
135
|
def test_dynamic_html_headers
|
121
136
|
@cgi = CGI.new
|
122
|
-
|
123
|
-
@session = flexmock(
|
137
|
+
_result = @template.to_html(@cgi)
|
138
|
+
@session = flexmock("session")
|
124
139
|
comp = HtmlGrid::Component.new("foo", @session)
|
125
|
-
comp.dojo_tooltip =
|
140
|
+
comp.dojo_tooltip = "my_tooltip"
|
126
141
|
assert_equal("foo", comp.model)
|
127
142
|
assert_equal(false, comp.label?)
|
128
|
-
result= comp.to_html(@cgi)
|
129
|
-
skip
|
143
|
+
result = comp.to_html(@cgi)
|
144
|
+
skip "tooltip test does not work"
|
130
145
|
assert(/href="my_tooltip"/.match(result))
|
131
146
|
end
|
132
147
|
end
|
data/test/test_form.rb
CHANGED
@@ -21,104 +21,120 @@
|
|
21
21
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
22
22
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
23
23
|
#
|
24
|
-
# TestForm -- htmlgrid -- 25.11.2002 -- hwyss@ywesee.com
|
24
|
+
# TestForm -- htmlgrid -- 25.11.2002 -- hwyss@ywesee.com
|
25
25
|
|
26
26
|
$: << File.dirname(__FILE__)
|
27
27
|
$: << File.expand_path("../lib", File.dirname(__FILE__))
|
28
28
|
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
29
|
+
require "minitest/autorun"
|
30
|
+
require "htmlgrid/form"
|
31
|
+
require "stub/cgi"
|
32
32
|
|
33
33
|
class StubFormModel; end
|
34
|
+
|
34
35
|
class StubFormLookandfeel
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
36
|
+
def attributes(key)
|
37
|
+
{}
|
38
|
+
end
|
39
|
+
|
40
|
+
def base_url
|
41
|
+
"http://test.oddb.org/de/gcc"
|
42
|
+
end
|
43
|
+
|
44
|
+
def flavor
|
45
|
+
"gcc"
|
46
|
+
end
|
47
|
+
|
48
|
+
def language
|
49
|
+
"de"
|
50
|
+
end
|
51
|
+
|
52
|
+
def lookup(key)
|
53
|
+
"Submit-Value"
|
54
|
+
end
|
55
|
+
|
56
|
+
def lookandfeel
|
57
|
+
self
|
58
|
+
end
|
59
|
+
|
60
|
+
def state
|
61
|
+
0
|
62
|
+
end
|
56
63
|
end
|
64
|
+
|
57
65
|
class StubFormComponent < HtmlGrid::Component
|
58
|
-
|
59
|
-
|
60
|
-
|
66
|
+
def init
|
67
|
+
self.onsubmit = "submitted"
|
68
|
+
end
|
61
69
|
end
|
70
|
+
|
62
71
|
class Form < HtmlGrid::Form
|
63
|
-
|
64
|
-
|
65
|
-
|
72
|
+
EVENT = :foo
|
73
|
+
COMPONENTS = {}
|
74
|
+
public :submit
|
66
75
|
end
|
76
|
+
|
67
77
|
class StubForm2 < HtmlGrid::Form
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
78
|
+
EVENT = :foo
|
79
|
+
COMPONENTS = {
|
80
|
+
[0, 0] => StubFormComponent
|
81
|
+
}
|
72
82
|
end
|
83
|
+
|
73
84
|
class StubFormMultiPart < HtmlGrid::Form
|
74
|
-
|
75
|
-
|
76
|
-
|
85
|
+
EVENT = :foo
|
86
|
+
COMPONENTS = {}
|
87
|
+
TAG_METHOD = :multipart_form
|
77
88
|
end
|
78
89
|
|
79
90
|
class TestForm < Minitest::Test
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
def setup
|
92
|
+
@model = StubFormModel.new
|
93
|
+
@lookandfeel = StubFormLookandfeel.new
|
94
|
+
@form = Form.new(@model, @lookandfeel)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_event
|
98
|
+
assert_equal(:foo, @form.event)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_multipart
|
102
|
+
form = StubFormMultiPart.new(@model, @lookandfeel)
|
103
|
+
result = form.to_html(CGI.new)
|
91
104
|
expected = '<FORM NAME="stdform" METHOD="POST" ACTION="http://test.oddb.org/de/gcc" ACCEPT-CHARSET="UTF-8" ENCTYPE="multipart/form-data">'
|
92
105
|
assert_equal(0, result.index(expected), "expected\n#{result}\nto start with\n#{expected}")
|
93
|
-
|
94
|
-
|
95
|
-
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_to_html
|
109
|
+
result = @form.to_html(CGI.new)
|
96
110
|
expected = [
|
97
111
|
'<INPUT TYPE="hidden" NAME="flavor" VALUE="gcc">',
|
98
112
|
'<INPUT TYPE="hidden" NAME="language" VALUE="de">',
|
99
113
|
'<INPUT NAME="event" ID="event" VALUE="foo" TYPE="hidden">',
|
100
|
-
'<INPUT TYPE="hidden" NAME="state_id" VALUE="1">'
|
114
|
+
'<INPUT TYPE="hidden" NAME="state_id" VALUE="1">'
|
101
115
|
]
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
116
|
+
expected.each_with_index { |line, idx|
|
117
|
+
assert(result.index(line), "#{idx}: missing #{line}\n in #{result}")
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_submit
|
107
122
|
html = @form.submit(@model, @lookandfeel).to_html(CGI.new)
|
108
123
|
expected = '<INPUT value="Submit-Value" type="submit" name="foo">'
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
+
assert_equal(expected, html)
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_onsubmit
|
128
|
+
@form.onsubmit = "submitted"
|
129
|
+
expected = 'onSubmit="submitted"'
|
130
|
+
result = /<FORM[^>]+>/.match(@form.to_html(CGI.new))[0]
|
131
|
+
assert(result.index(expected), "missing:\n#{expected}\nin:\n#{result}")
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_onsubmit_init
|
135
|
+
form = StubForm2.new(@model, @lookandfeel)
|
136
|
+
expected = 'onSubmit="submitted"'
|
137
|
+
result = /<FORM[^>]+>/.match(form.to_html(CGI.new))[0]
|
138
|
+
assert(result.index(expected), "missing:\n#{expected}\nin:\n#{result}")
|
139
|
+
end
|
124
140
|
end
|