aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorWoH <wolfgang.hobmaier@datapweb.de>2018-12-03 18:07:05 +0100
committerWoH <wolfgang.hobmaier@datapweb.de>2018-12-06 09:02:07 +0100
commit257a1a63739f43e59ec43580f969918fa80e290a (patch)
treeedd79384e18ad097de2526e67c92d6f4946a27b9 /actionview/test
parentb86f65a816546ff8eea39d25b62c995c7efc21dc (diff)
downloadrails-257a1a63739f43e59ec43580f969918fa80e290a.tar.gz
rails-257a1a63739f43e59ec43580f969918fa80e290a.tar.bz2
rails-257a1a63739f43e59ec43580f969918fa80e290a.zip
Do not disable previously disabled elements
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/ujs/public/test/data-disable-with.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/actionview/test/ujs/public/test/data-disable-with.js b/actionview/test/ujs/public/test/data-disable-with.js
index b5684e0938..a9a98fb420 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]')