Ticket #7904: prototype_helper_test.with_degradation.diff
| File prototype_helper_test.with_degradation.diff, 4.5 kB (added by chuyeow, 1 year ago) |
|---|
-
prototype_helper_test.rb
old new 40 40 include BaseTest 41 41 42 42 def test_link_to_remote 43 assert_dom_equal %(<a class=\"fine\" href=\" #\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outpost</a>),43 assert_dom_equal %(<a class=\"fine\" href=\"http://www.example.com/whatnot\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outpost</a>), 44 44 link_to_remote("Remote outpost", { :url => { :action => "whatnot" }}, { :class => "fine" }) 45 assert_dom_equal %(<a href=\" #\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onComplete:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>),45 assert_dom_equal %(<a href=\"http://www.example.com/whatnot\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onComplete:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>), 46 46 link_to_remote("Remote outpost", :complete => "alert(request.reponseText)", :url => { :action => "whatnot" }) 47 assert_dom_equal %(<a href=\" #\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onSuccess:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>),47 assert_dom_equal %(<a href=\"http://www.example.com/whatnot\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onSuccess:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>), 48 48 link_to_remote("Remote outpost", :success => "alert(request.reponseText)", :url => { :action => "whatnot" }) 49 assert_dom_equal %(<a href=\" #\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>),49 assert_dom_equal %(<a href=\"http://www.example.com/whatnot\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>), 50 50 link_to_remote("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot" }) 51 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.reponseText)}}); return false;\">Remote outpost</a>),51 assert_dom_equal %(<a href=\"http://www.example.com/whatnot?a=10&b=20\" onclick=\"new Ajax.Request('http://www.example.com/whatnot?a=10&b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>), 52 52 link_to_remote("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot", :a => '10', :b => '20' }) 53 53 end 54 54 55 def test_link_to_remote_with_href_wont_attempt_degradation 56 assert_dom_equal %(<a href=\"http://www.example.com/fallback\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outpost</a>), 57 link_to_remote("Remote outpost", { :url => { :action => "whatnot" }}, { :href => "http://www.example.com/fallback" }) 58 assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outpost</a>), 59 link_to_remote("Remote outpost", { :url => { :action => "whatnot" }}, { :href => "#" }) 60 assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outpost</a>), 61 link_to_remote("Remote outpost", { :url => { :action => "whatnot" }}, { :href => nil }) 62 end 63 55 64 def test_periodically_call_remote 56 65 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>), 57 66 periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })