Class: InPlaceEditingTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- InPlaceEditingTest
show all
- Includes:
- ActionView::Helpers::CaptureHelper, ActionView::Helpers::FormHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::UrlHelper, InPlaceEditing, InPlaceMacrosHelper
- Defined in:
- lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb
Instance Method Summary
collapse
#in_place_editor, #in_place_editor_field
included
Instance Method Details
73
74
75
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 73
def form_authenticity_token
"authenticity token"
end
|
#protect_against_forgery? ⇒ Boolean
25
26
27
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 25
def protect_against_forgery?
@protect_against_forgery
end
|
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 13
def setup
@controller = Class.new do
def url_for(options)
url = "http://www.example.com/"
url << options[:action].to_s if options and options[:action]
url
end
end
@controller = @controller.new
@protect_against_forgery = false
end
|
#test_in_place_editor_cols_no_rows ⇒ Object
39
40
41
42
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 39
def test_in_place_editor_cols_no_rows
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {cols:4})\n//]]>\n</script>),
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :cols => 4})
end
|
#test_in_place_editor_cols_with_rows ⇒ Object
44
45
46
47
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 44
def test_in_place_editor_cols_with_rows
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {cols:40, rows:5})\n//]]>\n</script>),
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :rows => 5, :cols => 40})
end
|
#test_in_place_editor_external_control ⇒ Object
29
30
31
32
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 29
def test_in_place_editor_external_control
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {externalControl:'blah'})\n//]]>\n</script>),
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :external_control => 'blah'})
end
|
#test_in_place_editor_html_response ⇒ Object
66
67
68
69
70
71
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 66
def test_in_place_editor_html_response
assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {htmlResponse:false})",
in_place_editor( 'id-goes-here',
:url => { :action => "action_to_set_value" },
:script => true )
end
|
#test_in_place_editor_load_text_url ⇒ Object
59
60
61
62
63
64
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 59
def test_in_place_editor_load_text_url
assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {loadTextURL:'http://www.example.com/action_to_get_value'})",
in_place_editor( 'id-goes-here',
:url => { :action => "action_to_set_value" },
:load_text_url => { :action => "action_to_get_value" })
end
|
#test_in_place_editor_size ⇒ Object
34
35
36
37
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 34
def test_in_place_editor_size
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {size:4})\n//]]>\n</script>),
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :size => 4})
end
|
#test_in_place_editor_text_between_controls ⇒ Object
83
84
85
86
87
88
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 83
def test_in_place_editor_text_between_controls
assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {textBetweenControls:'or'})",
in_place_editor( 'id-goes-here',
:url => { :action => "action_to_set_value" },
:text_between_controls => "or" )
end
|
#test_in_place_editor_url ⇒ Object
54
55
56
57
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 54
def test_in_place_editor_url
assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value')",
in_place_editor( 'id-goes-here', :url => { :action => "action_to_set_value" })
end
|
#test_in_place_editor_with_forgery_protection ⇒ Object
77
78
79
80
81
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 77
def test_in_place_editor_with_forgery_protection
@protect_against_forgery = true
assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {callback:function(form) { return Form.serialize(form) + '&authenticity_token=' + encodeURIComponent('authenticity token') }})",
in_place_editor( 'id-goes-here', :url => { :action => "action_to_set_value" })
end
|
#test_inplace_editor_loading_text ⇒ Object
49
50
51
52
|
# File 'lib/six-updater-web/vendor/plugins/in_place_editing/test/in_place_editing_test.rb', line 49
def test_inplace_editor_loading_text
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {loadingText:'Why are we waiting?'})\n//]]>\n</script>),
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :loading_text => 'Why are we waiting?'})
end
|