public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/josh/rails.git
Search Repo:
Made JavaScriptHelper tests pass regardless of hash order #1656 [Sam 
Stephenson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1794 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Sat Jul 09 22:11:23 -0700 2005
commit  383b6afd1c943096951ea845b3fc726f4d2193a6
tree    cd1caa23881042d662730030517ad52c0efa00d0
parent  c697be5b696fb3f49545aca12b35ac7feee05925
...
504
505
506
507
 
508
509
510
...
504
505
506
 
507
508
509
510
0
@@ -504,7 +504,7 @@ module ActionView
0
 
0
     private
0
       def options_for_javascript(options)
0
- '{' + options.map {|k, v| "#{k}:#{v}"}.join(', ') + '}'
0
+ '{' + options.map {|k, v| "#{k}:#{v}"}.sort.join(', ') + '}'
0
       end
0
       
0
       def options_for_ajax(options)
...
35
36
37
38
 
39
40
 
41
42
43
44
45
 
46
47
48
49
50
 
51
52
 
53
54
 
55
56
 
57
58
59
60
61
 
62
63
64
65
66
 
67
68
69
70
71
 
72
73
74
...
101
102
103
104
 
105
106
 
107
108
 
109
110
 
111
112
113
...
119
120
121
122
 
123
124
 
125
126
 
127
128
 
129
130
131
...
35
36
37
 
38
39
 
40
41
42
43
44
 
45
46
47
48
49
 
50
51
 
52
53
 
54
55
 
56
57
58
59
60
 
61
62
63
64
65
 
66
67
68
69
70
 
71
72
73
74
...
101
102
103
 
104
105
 
106
107
 
108
109
 
110
111
112
113
...
119
120
121
 
122
123
 
124
125
 
126
127
 
128
129
130
131
0
@@ -35,40 +35,40 @@ class JavaScriptHelperTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_link_to_remote
0
- assert_equal %(<a class=\"fine\" href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {evalScripts:true, asynchronous:true}); return false;\">Remote outpost</a>),
0
+ assert_equal %(<a class=\"fine\" href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outpost</a>),
0
       link_to_remote("Remote outpost", { :url => { :action => "whatnot" }}, { :class => "fine" })
0
- assert_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {onComplete:function(request){alert(request.reponseText)}, evalScripts:true, asynchronous:true}); return false;\">Remote outpost</a>),
0
+ assert_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>),
0
       link_to_remote("Remote outpost", :complete => "alert(request.reponseText)", :url => { :action => "whatnot" })
0
   end
0
   
0
   def test_periodically_call_remote
0
- assert_equal %(<script>new PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {evalScripts:true, asynchronous:true})}, 10)</script>),
0
+ assert_equal %(<script>new PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)</script>),
0
       periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })
0
   end
0
   
0
   def test_form_remote_tag
0
- assert_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {parameters:Form.serialize(this), evalScripts:true, asynchronous:true}); return false;\">),
0
+ assert_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;\">),
0
       form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast })
0
- assert_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer'}, 'http://www.example.com/fast', {parameters:Form.serialize(this), evalScripts:true, asynchronous:true}); return false;\">),
0
+ assert_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;\">),
0
       form_remote_tag(:update => { :success => "glass_of_beer" }, :url => { :action => :fast })
0
- assert_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({failure:'glass_of_water'}, 'http://www.example.com/fast', {parameters:Form.serialize(this), evalScripts:true, asynchronous:true}); return false;\">),
0
+ assert_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;\">),
0
       form_remote_tag(:update => { :failure => "glass_of_water" }, :url => { :action => :fast })
0
- assert_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', {parameters:Form.serialize(this), evalScripts:true, asynchronous:true}); return false;\">),
0
+ assert_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;\">),
0
       form_remote_tag(:update => { :success => 'glass_of_beer', :failure => "glass_of_water" }, :url => { :action => :fast })
0
   end
0
   
0
   def test_submit_to_remote
0
- assert_equal %(<input name=\"More beer!\" onclick=\"new Ajax.Updater('empty_bottle', 'http://www.example.com/', {parameters:Form.serialize(this.form), evalScripts:true, asynchronous:true}); return false;\" type=\"button\" value=\"1000000\" />),
0
+ assert_equal %(<input name=\"More beer!\" onclick=\"new Ajax.Updater('empty_bottle', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)}); return false;\" type=\"button\" value=\"1000000\" />),
0
       submit_to_remote("More beer!", 1_000_000, :update => "empty_bottle")
0
   end
0
   
0
   def test_observe_field
0
- assert_equal %(<script type=\"text/javascript\">new Form.Element.Observer('glass', 300, function(element, value) {new Ajax.Request('http://www.example.com/reorder_if_empty', {evalScripts:true, asynchronous:true})})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">new Form.Element.Observer('glass', 300, function(element, value) {new Ajax.Request('http://www.example.com/reorder_if_empty', {asynchronous:true, evalScripts:true})})</script>),
0
       observe_field("glass", :frequency => 5.minutes, :url => { :action => "reorder_if_empty" })
0
   end
0
   
0
   def test_observe_form
0
- assert_equal %(<script type=\"text/javascript\">new Form.Observer('cart', 2, function(element, value) {new Ajax.Request('http://www.example.com/cart_changed', {evalScripts:true, asynchronous:true})})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">new Form.Observer('cart', 2, function(element, value) {new Ajax.Request('http://www.example.com/cart_changed', {asynchronous:true, evalScripts:true})})</script>),
0
       observe_form("cart", :frequency => 2, :url => { :action => "cart_changed" })
0
   end
0
   
0
@@ -101,13 +101,13 @@ class JavaScriptHelperTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_sortable_element
0
- assert_equal %(<script type=\"text/javascript\">Sortable.create('mylist', {onUpdate:function(){new Ajax.Request('http://www.example.com/order', {parameters:Sortable.serialize('mylist'), evalScripts:true, asynchronous:true})}})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">Sortable.create('mylist', {onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('mylist')})}})</script>),
0
       sortable_element("mylist", :url => { :action => "order" })
0
- assert_equal %(<script type=\"text/javascript\">Sortable.create('mylist', {tag:'div', constraint:'horizontal', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {parameters:Sortable.serialize('mylist'), evalScripts:true, asynchronous:true})}})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">Sortable.create('mylist', {constraint:'horizontal', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('mylist')})}, tag:'div'})</script>),
0
       sortable_element("mylist", :tag => "div", :constraint => "horizontal", :url => { :action => "order" })
0
- assert_equal %|<script type=\"text/javascript\">Sortable.create('mylist', {constraint:'horizontal', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {parameters:Sortable.serialize('mylist'), evalScripts:true, asynchronous:true})}, containment:['list1','list2']})</script>|,
0
+ assert_equal %|<script type=\"text/javascript\">Sortable.create('mylist', {constraint:'horizontal', containment:['list1','list2'], onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('mylist')})}})</script>|,
0
       sortable_element("mylist", :containment => ['list1','list2'], :constraint => "horizontal", :url => { :action => "order" })
0
- assert_equal %(<script type=\"text/javascript\">Sortable.create('mylist', {constraint:'horizontal', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {parameters:Sortable.serialize('mylist'), evalScripts:true, asynchronous:true})}, containment:'list1'})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">Sortable.create('mylist', {constraint:'horizontal', containment:'list1', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('mylist')})}})</script>),
0
       sortable_element("mylist", :containment => 'list1', :constraint => "horizontal", :url => { :action => "order" })
0
   end
0
   
0
@@ -119,13 +119,13 @@ class JavaScriptHelperTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_drop_receiving_element
0
- assert_equal %(<script type=\"text/javascript\">Droppables.add('droptarget1', {onDrop:function(element){new Ajax.Request('http://www.example.com/', {parameters:'id=' + encodeURIComponent(element.id), evalScripts:true, asynchronous:true})}})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">Droppables.add('droptarget1', {onDrop:function(element){new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})</script>),
0
       drop_receiving_element('droptarget1')
0
- assert_equal %(<script type=\"text/javascript\">Droppables.add('droptarget1', {accept:'products', onDrop:function(element){new Ajax.Request('http://www.example.com/', {parameters:'id=' + encodeURIComponent(element.id), evalScripts:true, asynchronous:true})}})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">Droppables.add('droptarget1', {accept:'products', onDrop:function(element){new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})</script>),
0
       drop_receiving_element('droptarget1', :accept => 'products')
0
- assert_equal %(<script type=\"text/javascript\">Droppables.add('droptarget1', {accept:'products', onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {parameters:'id=' + encodeURIComponent(element.id), evalScripts:true, asynchronous:true})}})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">Droppables.add('droptarget1', {accept:'products', onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})</script>),
0
       drop_receiving_element('droptarget1', :accept => 'products', :update => 'infobox')
0
- assert_equal %(<script type=\"text/javascript\">Droppables.add('droptarget1', {accept:['tshirts','mugs'], onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {parameters:'id=' + encodeURIComponent(element.id), evalScripts:true, asynchronous:true})}})</script>),
0
+ assert_equal %(<script type=\"text/javascript\">Droppables.add('droptarget1', {accept:['tshirts','mugs'], onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})</script>),
0
       drop_receiving_element('droptarget1', :accept => ['tshirts','mugs'], :update => 'infobox')
0
   end
0
   

Comments

    No one has commented yet.