aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/form_options_helper_test.rb1
-rw-r--r--actionview/test/template/lookup_context_test.rb12
-rw-r--r--actionview/test/ujs/public/test/data-disable-with.js21
3 files changed, 27 insertions, 7 deletions
diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb
index a2d1474a94..4ccd3ae336 100644
--- a/actionview/test/template/form_options_helper_test.rb
+++ b/actionview/test/template/form_options_helper_test.rb
@@ -36,6 +36,7 @@ class FormOptionsHelperTest < ActionView::TestCase
module FakeZones
FakeZone = Struct.new(:name) do
def to_s; name; end
+ def =~(_re); end
end
module ClassMethods
diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb
index 38469cbe3d..68e151f154 100644
--- a/actionview/test/template/lookup_context_test.rb
+++ b/actionview/test/template/lookup_context_test.rb
@@ -14,14 +14,12 @@ class LookupContextTest < ActiveSupport::TestCase
end
test "allows to override default_formats with ActionView::Base.default_formats" do
- begin
- formats = ActionView::Base.default_formats
- ActionView::Base.default_formats = [:foo, :bar]
+ formats = ActionView::Base.default_formats
+ ActionView::Base.default_formats = [:foo, :bar]
- assert_equal [:foo, :bar], ActionView::LookupContext.new([]).default_formats
- ensure
- ActionView::Base.default_formats = formats
- end
+ assert_equal [:foo, :bar], ActionView::LookupContext.new([]).default_formats
+ ensure
+ ActionView::Base.default_formats = formats
end
test "process view paths on initialization" do
diff --git a/actionview/test/ujs/public/test/data-disable-with.js b/actionview/test/ujs/public/test/data-disable-with.js
index 0654484711..10b8870171 100644
--- a/actionview/test/ujs/public/test/data-disable-with.js
+++ b/actionview/test/ujs/public/test/data-disable-with.js
@@ -95,6 +95,27 @@ asyncTest('form button with "data-disable-with" attribute', 6, function() {
App.checkDisabledState(button, 'submitting ...')
})
+asyncTest('a[data-remote][data-disable-with] within a form disables and re-enables', 6, function() {
+ var form = $('form:not([data-remote])'),
+ link = $('<a data-remote="true" data-disable-with="clicking...">Click me</a>')
+ form.append(link)
+
+ App.checkEnabledState(link, 'Click me')
+
+ link
+ .bindNative('ajax:beforeSend', function() {
+ App.checkDisabledState(link, 'clicking...')
+ })
+ .bindNative('ajax:complete', function() {
+ setTimeout( function() {
+ App.checkEnabledState(link, 'Click me')
+ link.remove()
+ start()
+ }, 15)
+ })
+ .triggerNative('click')
+})
+
asyncTest('form input[type=submit][data-disable-with] disables', 6, function() {
var form = $('form:not([data-remote])'), input = form.find('input[type=submit]')