diff options
author | Javan Makhmali <javan@javan.us> | 2018-12-18 10:54:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 10:54:12 -0500 |
commit | 2f6456cbe1da73c13b37e23720caa8716df85e78 (patch) | |
tree | 23a464b21860cc9011374f77cd8352590d5afbdc /actionview/test/ujs | |
parent | d99984d48c6eeb105c5edd1c142834a5c770f499 (diff) | |
parent | 257a1a63739f43e59ec43580f969918fa80e290a (diff) | |
download | rails-2f6456cbe1da73c13b37e23720caa8716df85e78.tar.gz rails-2f6456cbe1da73c13b37e23720caa8716df85e78.tar.bz2 rails-2f6456cbe1da73c13b37e23720caa8716df85e78.zip |
Merge pull request #34635 from WoH/data-disable-forever
UJS: Do not disable previously disabled elements
Diffstat (limited to 'actionview/test/ujs')
-rw-r--r-- | actionview/test/ujs/public/test/data-disable-with.js | 21 |
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 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]') |