Class: PrototypeHelperTest
- Inherits:
-
ActionView::TestCase
- Object
- ActionView::TestCase
- PrototypeHelperTest
- Defined in:
- lib/prototype_legacy_helper/test/test_prototype_helper.rb
Instance Attribute Summary collapse
-
#formats ⇒ Object
Returns the value of attribute formats.
-
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
-
#template_format ⇒ Object
Returns the value of attribute template_format.
Instance Method Summary collapse
- #_evaluate_assigns_and_ivars ⇒ Object
- #reset_formats(format) ⇒ Object
- #setup ⇒ Object
- #test_button_to_remote ⇒ Object
- #test_form_remote_tag ⇒ Object
- #test_form_remote_tag_with_block_in_erb ⇒ Object
- #test_form_remote_tag_with_method ⇒ Object
- #test_link_to_remote ⇒ Object
- #test_link_to_remote_html_options ⇒ Object
- #test_link_to_remote_url_quote_escaping ⇒ Object
- #test_observe_field ⇒ Object
- #test_observe_field_using_function_for_callback ⇒ Object
- #test_observe_field_using_json_in_with_option ⇒ Object
- #test_observe_field_using_with_option ⇒ Object
- #test_observe_field_without_frequency ⇒ Object
- #test_observe_form ⇒ Object
- #test_observe_form_using_function_for_callback ⇒ Object
- #test_on_callbacks ⇒ Object
- #test_periodically_call_remote ⇒ Object
- #test_periodically_call_remote_with_frequency ⇒ Object
- #test_remote_form_for_with_existing_object_in_list ⇒ Object
- #test_remote_form_for_with_new_object_in_list ⇒ Object
- #test_remote_form_for_with_record_identification_with_existing_record ⇒ Object
- #test_remote_form_for_with_record_identification_with_new_record ⇒ Object
- #test_remote_form_for_with_record_identification_without_html_options ⇒ Object
- #test_submit_to_remote ⇒ Object
Instance Attribute Details
#formats ⇒ Object
Returns the value of attribute formats.
43 44 45 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 43 def formats @formats end |
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
43 44 45 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 43 def output_buffer @output_buffer end |
#template_format ⇒ Object
Returns the value of attribute template_format.
43 44 45 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 43 def template_format @template_format end |
Instance Method Details
#_evaluate_assigns_and_ivars ⇒ Object
45 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 45 def _evaluate_assigns_and_ivars() end |
#reset_formats(format) ⇒ Object
47 48 49 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 47 def reset_formats(format) @format = format end |
#setup ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 51 def setup @record = @author = Author.new @article = Article.new super @template = self @controller = Class.new do def url_for() if .is_a?(String) else url = "http://www.example.com/" url << [:action].to_s if and [:action] url << "?a=#{[:a]}" if && [:a] url << "&b=#{[:b]}" if && [:a] && [:b] url end end end.new end |
#test_button_to_remote ⇒ Object
222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 222 def assert_dom_equal %(<input class=\"fine\" type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true});\" />), ("Remote outpost", { :url => { :action => "whatnot" }}, { :class => "fine" }) assert_dom_equal %(<input type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onComplete:function(request){alert(request.reponseText)}});\" />), ("Remote outpost", :complete => "alert(request.reponseText)", :url => { :action => "whatnot" }) assert_dom_equal %(<input type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onSuccess:function(request){alert(request.reponseText)}});\" />), ("Remote outpost", :success => "alert(request.reponseText)", :url => { :action => "whatnot" }) assert_dom_equal %(<input type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}});\" />), ("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot" }) assert_dom_equal %(<input type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot?a=10&b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}});\" />), ("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot", :a => '10', :b => '20' }) end |
#test_form_remote_tag ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 122 def test_form_remote_tag assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">), form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }) assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">), form_remote_tag(:update => { :success => "glass_of_beer" }, :url => { :action => :fast }) assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({failure:'glass_of_water'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">), form_remote_tag(:update => { :failure => "glass_of_water" }, :url => { :action => :fast }) assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer',failure:'glass_of_water'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">), form_remote_tag(:update => { :success => 'glass_of_beer', :failure => "glass_of_water" }, :url => { :action => :fast }) end |
#test_form_remote_tag_with_block_in_erb ⇒ Object
138 139 140 141 142 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 138 def test_form_remote_tag_with_block_in_erb __in_erb_template = '' form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }) { concat "Hello world!" } assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">Hello world!</form>), output_buffer end |
#test_form_remote_tag_with_method ⇒ Object
133 134 135 136 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 133 def test_form_remote_tag_with_method assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"><div style='margin:0;padding:0;display:inline'><input name='_method' type='hidden' value='put' /></div>), form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, :html => { :method => :put }) end |
#test_link_to_remote ⇒ Object
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 241 def test_link_to_remote assert_dom_equal %(<a class=\"fine\" href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outauthor</a>), link_to_remote("Remote outauthor", { :url => { :action => "whatnot" }}, { :class => "fine" }) assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onComplete:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>), link_to_remote("Remote outauthor", :complete => "alert(request.responseText)", :url => { :action => "whatnot" }) assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onSuccess:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>), link_to_remote("Remote outauthor", :success => "alert(request.responseText)", :url => { :action => "whatnot" }) assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>), link_to_remote("Remote outauthor", :failure => "alert(request.responseText)", :url => { :action => "whatnot" }) assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot?a=10&b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>), link_to_remote("Remote outauthor", :failure => "alert(request.responseText)", :url => { :action => "whatnot", :a => '10', :b => '20' }) assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:false, evalScripts:true}); return false;\">Remote outauthor</a>), link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :type => :synchronous) assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, insertion:'bottom'}); return false;\">Remote outauthor</a>), link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :position => :bottom) end |
#test_link_to_remote_html_options ⇒ Object
258 259 260 261 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 258 def assert_dom_equal %(<a class=\"fine\" href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outauthor</a>), link_to_remote("Remote outauthor", { :url => { :action => "whatnot" }, :html => { :class => "fine" } }) end |
#test_link_to_remote_url_quote_escaping ⇒ Object
263 264 265 266 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 263 def test_link_to_remote_url_quote_escaping assert_dom_equal %(<a href="#" onclick="new Ajax.Request('http://www.example.com/whatnot\\\'s', {asynchronous:true, evalScripts:true}); return false;">Remote</a>), link_to_remote("Remote", { :url => { :action => "whatnot's" } }) end |
#test_observe_field ⇒ Object
82 83 84 85 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 82 def test_observe_field assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.Observer('glass', 300, function(element, value) {new Ajax.Request('http://www.example.com/reorder_if_empty', {asynchronous:true, evalScripts:true, parameters:value})})\n//]]>\n</script>), observe_field("glass", :frequency => 5.minutes, :url => { :action => "reorder_if_empty" }) end |
#test_observe_field_using_function_for_callback ⇒ Object
98 99 100 101 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 98 def test_observe_field_using_function_for_callback assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.Observer('glass', 300, function(element, value) {alert('Element changed')})\n//]]>\n</script>), observe_field("glass", :frequency => 5.minutes, :function => "alert('Element changed')") end |
#test_observe_field_using_json_in_with_option ⇒ Object
93 94 95 96 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 93 def test_observe_field_using_json_in_with_option expected = %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.Observer('glass', 300, function(element, value) {new Ajax.Request('http://www.example.com/check_value', {asynchronous:true, evalScripts:true, parameters:{'id':value}})})\n//]]>\n</script>) assert_dom_equal expected, observe_field("glass", :frequency => 5.minutes, :url => { :action => "check_value" }, :with => "{'id':value}") end |
#test_observe_field_using_with_option ⇒ Object
87 88 89 90 91 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 87 def test_observe_field_using_with_option expected = %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.Observer('glass', 300, function(element, value) {new Ajax.Request('http://www.example.com/check_value', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(value)})})\n//]]>\n</script>) assert_dom_equal expected, observe_field("glass", :frequency => 5.minutes, :url => { :action => "check_value" }, :with => 'id') assert_dom_equal expected, observe_field("glass", :frequency => 5.minutes, :url => { :action => "check_value" }, :with => "'id=' + encodeURIComponent(value)") end |
#test_observe_field_without_frequency ⇒ Object
103 104 105 106 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 103 def test_observe_field_without_frequency assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.EventObserver('glass', function(element, value) {new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:value})})\n//]]>\n</script>), observe_field("glass") end |
#test_observe_form ⇒ Object
72 73 74 75 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 72 def test_observe_form assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Observer('cart', 2, function(element, value) {new Ajax.Request('http://www.example.com/cart_changed', {asynchronous:true, evalScripts:true, parameters:value})})\n//]]>\n</script>), observe_form("cart", :frequency => 2, :url => { :action => "cart_changed" }) end |
#test_observe_form_using_function_for_callback ⇒ Object
77 78 79 80 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 77 def test_observe_form_using_function_for_callback assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Observer('cart', 2, function(element, value) {alert('Form changed')})\n//]]>\n</script>), observe_form("cart", :frequency => 2, :function => "alert('Form changed')") end |
#test_on_callbacks ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 144 def test_on_callbacks callbacks = [:uninitialized, :loading, :loaded, :interactive, :complete, :success, :failure] callbacks.each do |callback| assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">), form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, callback=>"monkeys();") assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">), form_remote_tag(:update => { :success => "glass_of_beer" }, :url => { :action => :fast }, callback=>"monkeys();") assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({failure:'glass_of_beer'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">), form_remote_tag(:update => { :failure => "glass_of_beer" }, :url => { :action => :fast }, callback=>"monkeys();") assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer',failure:'glass_of_water'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">), form_remote_tag(:update => { :success => "glass_of_beer", :failure => "glass_of_water" }, :url => { :action => :fast }, callback=>"monkeys();") end #HTTP status codes 200 up to 599 have callbacks #these should work 100.upto(599) do |callback| assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">), form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, callback=>"monkeys();") end #test 200 and 404 assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on200:function(request){monkeys();}, on404:function(request){bananas();}, parameters:Form.serialize(this)}); return false;">), form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, 200=>"monkeys();", 404=>"bananas();") #these shouldn't 1.upto(99) do |callback| assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">), form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, callback=>"monkeys();") end 600.upto(999) do |callback| assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">), form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, callback=>"monkeys();") end #test ultimate combo assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on200:function(request){monkeys();}, on404:function(request){bananas();}, onComplete:function(request){c();}, onFailure:function(request){f();}, onLoading:function(request){c1()}, onSuccess:function(request){s()}, parameters:Form.serialize(this)}); return false;\">), form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, :loading => "c1()", :success => "s()", :failure => "f();", :complete => "c();", 200=>"monkeys();", 404=>"bananas();") end |
#test_periodically_call_remote ⇒ Object
109 110 111 112 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 109 def test_periodically_call_remote assert_dom_equal %(<script type="text/javascript">\n//<![CDATA[\nnew PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)\n//]]>\n</script>), periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" }) end |
#test_periodically_call_remote_with_frequency ⇒ Object
114 115 116 117 118 119 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 114 def test_periodically_call_remote_with_frequency assert_dom_equal( "<script type=\"text/javascript\">\n//<![CDATA[\nnew PeriodicalExecuter(function() {new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true})}, 2)\n//]]>\n</script>", periodically_call_remote(:frequency => 2) ) end |
#test_remote_form_for_with_existing_object_in_list ⇒ Object
212 213 214 215 216 217 218 219 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 212 def test_remote_form_for_with_existing_object_in_list @author.save @article.save remote_form_for([@author, @article]) {} expected = %(<form action='#{(@author, @article)}' id='edit_article_1' method='post' onsubmit="new Ajax.Request('#{(@author, @article)}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='edit_article'><div style='margin:0;padding:0;display:inline'><input name='_method' type='hidden' value='put' /></div></form>) assert_dom_equal expected, output_buffer end |
#test_remote_form_for_with_new_object_in_list ⇒ Object
205 206 207 208 209 210 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 205 def test_remote_form_for_with_new_object_in_list remote_form_for([@author, @article]) {} expected = %(<form action='#{(@author)}' onsubmit="new Ajax.Request('#{(@author)}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='new_article' method='post' id='new_article'></form>) assert_dom_equal expected, output_buffer end |
#test_remote_form_for_with_record_identification_with_existing_record ⇒ Object
197 198 199 200 201 202 203 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 197 def test_remote_form_for_with_record_identification_with_existing_record @record.save remote_form_for(@record) {} expected = %(<form action='#{(@record)}' id='edit_author_1' method='post' onsubmit="new Ajax.Request('#{(@record)}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='edit_author'><div style='margin:0;padding:0;display:inline'><input name='_method' type='hidden' value='put' /></div></form>) assert_dom_equal expected, output_buffer end |
#test_remote_form_for_with_record_identification_with_new_record ⇒ Object
183 184 185 186 187 188 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 183 def test_remote_form_for_with_record_identification_with_new_record remote_form_for(@record, {:html => { :id => 'create-author' }}) {} expected = %(<form action='#{}' onsubmit="new Ajax.Request('#{}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='new_author' id='create-author' method='post'></form>) assert_dom_equal expected, output_buffer end |
#test_remote_form_for_with_record_identification_without_html_options ⇒ Object
190 191 192 193 194 195 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 190 def remote_form_for(@record) {} expected = %(<form action='#{}' onsubmit="new Ajax.Request('#{}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='new_author' method='post' id='new_author'></form>) assert_dom_equal expected, output_buffer end |
#test_submit_to_remote ⇒ Object
235 236 237 238 |
# File 'lib/prototype_legacy_helper/test/test_prototype_helper.rb', line 235 def test_submit_to_remote assert_dom_equal %(<input name=\"More beer!\" onclick=\"new Ajax.Updater('empty_bottle', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)});\" type=\"button\" value=\"1000000\" />), submit_to_remote("More beer!", 1_000_000, :update => "empty_bottle") end |