prototype-rails 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/{README → README.md} +12 -0
  4. data/Rakefile +2 -0
  5. data/lib/prototype-rails/on_load_action_view.rb +5 -3
  6. metadata +15 -46
  7. data/test/assert_select_test.rb +0 -457
  8. data/test/controller/caching_test.rb +0 -43
  9. data/test/controller/content_type_test.rb +0 -16
  10. data/test/controller/mime_responds_test.rb +0 -213
  11. data/test/controller/new_base/content_type_test.rb +0 -19
  12. data/test/controller/new_base/render_rjs_test.rb +0 -71
  13. data/test/controller/render_js_test.rb +0 -22
  14. data/test/fixtures/functional_caching/_partial.erb +0 -3
  15. data/test/fixtures/functional_caching/formatted_fragment_cached.js.rjs +0 -6
  16. data/test/fixtures/functional_caching/js_fragment_cached_with_partial.js.rjs +0 -1
  17. data/test/fixtures/old_content_type/render_default_for_rjs.rjs +0 -1
  18. data/test/fixtures/respond_to/all_types_with_layout.js.rjs +0 -1
  19. data/test/fixtures/respond_to/layouts/standard.html.erb +0 -1
  20. data/test/fixtures/respond_to/using_defaults.js.rjs +0 -1
  21. data/test/fixtures/respond_to/using_defaults_with_type_list.js.rjs +0 -1
  22. data/test/fixtures/respond_with/using_resource.js.rjs +0 -1
  23. data/test/fixtures/test/_one.html.erb +0 -1
  24. data/test/fixtures/test/_partial.html.erb +0 -1
  25. data/test/fixtures/test/_partial.js.erb +0 -1
  26. data/test/fixtures/test/_two.html.erb +0 -1
  27. data/test/fixtures/test/delete_with_js.rjs +0 -2
  28. data/test/fixtures/test/enum_rjs_test.rjs +0 -6
  29. data/test/fixtures/test/greeting.js.rjs +0 -1
  30. data/test/fixtures/test/render_explicit_html_template.js.rjs +0 -1
  31. data/test/fixtures/test/render_implicit_html_template.js.rjs +0 -1
  32. data/test/javascript_helper_test.rb +0 -61
  33. data/test/lib/abstract_unit.rb +0 -225
  34. data/test/lib/controller/fake_models.rb +0 -29
  35. data/test/render_other_test.rb +0 -256
  36. data/test/template/prototype_helper_test.rb +0 -476
  37. data/test/template/render_test.rb +0 -24
  38. data/test/template/scriptaculous_helper_test.rb +0 -86
@@ -1,24 +0,0 @@
1
- require 'abstract_unit'
2
-
3
- class TestController < ActionController::Base
4
- end
5
-
6
- module RenderTestCases
7
- def setup_view(paths)
8
- @assigns = { :secret => 'in the sauce' }
9
- @view = ActionView::Base.new(paths, @assigns)
10
- @controller_view = TestController.new.view_context
11
-
12
- # Reload and register danish language for testing
13
- I18n.reload!
14
- I18n.backend.store_translations 'da', {}
15
- I18n.backend.store_translations 'pt-BR', {}
16
-
17
- # Ensure original are still the same since we are reindexing view paths
18
- assert_equal ORIGINAL_LOCALES, I18n.available_locales.map {|l| l.to_s }.sort
19
- end
20
-
21
- def test_render_update
22
- assert_equal 'alert("Hello, World!");', @view.render(:update) { |page| page.alert('Hello, World!') }
23
- end
24
- end
@@ -1,86 +0,0 @@
1
- require 'abstract_unit'
2
-
3
- class ScriptaculousHelperTest < ActionView::TestCase
4
- tests ActionView::Helpers::ScriptaculousHelper
5
-
6
- def url_for(options)
7
- url = "http://www.example.com/"
8
- url << options[:action].to_s if options and options[:action]
9
- url
10
- end
11
-
12
- def test_effect
13
- assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect(:highlight, "posts")
14
- assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect("highlight", :posts)
15
- assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect(:highlight, :posts)
16
- assert_equal "new Effect.Fade(\"fademe\",{duration:4.0});", visual_effect(:fade, "fademe", :duration => 4.0)
17
- assert_equal "new Effect.Shake(element,{});", visual_effect(:shake)
18
- assert_equal "new Effect.DropOut(\"dropme\",{queue:'end'});", visual_effect(:drop_out, 'dropme', :queue => :end)
19
- assert_equal "new Effect.Highlight(\"status\",{endcolor:'#EEEEEE'});", visual_effect(:highlight, 'status', :endcolor => '#EEEEEE')
20
- assert_equal "new Effect.Highlight(\"status\",{restorecolor:'#500000', startcolor:'#FEFEFE'});", visual_effect(:highlight, 'status', :restorecolor => '#500000', :startcolor => '#FEFEFE')
21
-
22
- # chop the queue params into a comma separated list
23
- beginning, ending = 'new Effect.DropOut("dropme",{queue:{', '}});'
24
- ve = [
25
- visual_effect(:drop_out, 'dropme', :queue => {:position => "end", :scope => "test", :limit => 2}),
26
- visual_effect(:drop_out, 'dropme', :queue => {:scope => :list, :limit => 2}),
27
- visual_effect(:drop_out, 'dropme', :queue => {:position => :end, :scope => :test, :limit => 2})
28
- ].collect { |v| v[beginning.length..-ending.length-1].split(',') }
29
-
30
- assert ve[0].include?("limit:2")
31
- assert ve[0].include?("scope:'test'")
32
- assert ve[0].include?("position:'end'")
33
-
34
- assert ve[1].include?("limit:2")
35
- assert ve[1].include?("scope:'list'")
36
-
37
- assert ve[2].include?("limit:2")
38
- assert ve[2].include?("scope:'test'")
39
- assert ve[2].include?("position:'end'")
40
- end
41
-
42
- def test_toggle_effects
43
- assert_equal "Effect.toggle(\"posts\",'appear',{});", visual_effect(:toggle_appear, "posts")
44
- assert_equal "Effect.toggle(\"posts\",'slide',{});", visual_effect(:toggle_slide, "posts")
45
- assert_equal "Effect.toggle(\"posts\",'blind',{});", visual_effect(:toggle_blind, "posts")
46
- assert_equal "Effect.toggle(\"posts\",'appear',{});", visual_effect("toggle_appear", "posts")
47
- assert_equal "Effect.toggle(\"posts\",'slide',{});", visual_effect("toggle_slide", "posts")
48
- assert_equal "Effect.toggle(\"posts\",'blind',{});", visual_effect("toggle_blind", "posts")
49
- end
50
-
51
-
52
- def test_sortable_element
53
- assert_dom_equal %(<script>\n//<![CDATA[\nSortable.create(\"mylist\", {onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(\"mylist\")})}})\n//]]>\n</script>),
54
- sortable_element("mylist", :url => { :action => "order" })
55
- assert_equal %(<script>\n//<![CDATA[\nSortable.create(\"mylist\", {constraint:'horizontal', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(\"mylist\")})}, tag:'div'})\n//]]>\n</script>),
56
- sortable_element("mylist", :tag => "div", :constraint => "horizontal", :url => { :action => "order" })
57
- assert_dom_equal %|<script>\n//<![CDATA[\nSortable.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\")})}})\n//]]>\n</script>|,
58
- sortable_element("mylist", :containment => ['list1','list2'], :constraint => "horizontal", :url => { :action => "order" })
59
- assert_dom_equal %(<script>\n//<![CDATA[\nSortable.create(\"mylist\", {constraint:'horizontal', containment:'list1', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(\"mylist\")})}})\n//]]>\n</script>),
60
- sortable_element("mylist", :containment => 'list1', :constraint => "horizontal", :url => { :action => "order" })
61
- end
62
-
63
- def test_draggable_element
64
- assert_dom_equal %(<script>\n//<![CDATA[\nnew Draggable(\"product_13\", {})\n//]]>\n</script>),
65
- draggable_element("product_13")
66
- assert_equal %(<script>\n//<![CDATA[\nnew Draggable(\"product_13\", {revert:true})\n//]]>\n</script>),
67
- draggable_element("product_13", :revert => true)
68
- end
69
-
70
- def test_drop_receiving_element
71
- assert_dom_equal %(<script>\n//<![CDATA[\nDroppables.add(\"droptarget1\", {onDrop:function(element){new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>),
72
- drop_receiving_element("droptarget1")
73
- assert_dom_equal %(<script>\n//<![CDATA[\nDroppables.add(\"droptarget1\", {accept:'products', onDrop:function(element){new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>),
74
- drop_receiving_element("droptarget1", :accept => 'products')
75
- assert_dom_equal %(<script>\n//<![CDATA[\nDroppables.add(\"droptarget1\", {accept:'products', onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>),
76
- drop_receiving_element("droptarget1", :accept => 'products', :update => 'infobox')
77
- assert_dom_equal %(<script>\n//<![CDATA[\nDroppables.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)})}})\n//]]>\n</script>),
78
- drop_receiving_element("droptarget1", :accept => ['tshirts','mugs'], :update => 'infobox')
79
- assert_dom_equal %(<script>\n//<![CDATA[\nDroppables.add("droptarget1", {hoverclass:'dropready', onDrop:function(element){if (confirm('Are you sure?')) { new Ajax.Request('http://www.example.com/update_drop', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)}); }}})\n//]]>\n</script>),
80
- drop_receiving_element('droptarget1', :hoverclass=>'dropready', :url=>{:action=>'update_drop'}, :confirm => 'Are you sure?')
81
-
82
- end
83
- def protect_against_forgery?
84
- false
85
- end
86
- end