From 257a1a63739f43e59ec43580f969918fa80e290a Mon Sep 17 00:00:00 2001 From: WoH Date: Mon, 3 Dec 2018 18:07:05 +0100 Subject: Do not disable previously disabled elements --- .../test/ujs/public/test/data-disable-with.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'actionview/test/ujs') 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 = $('Click me') + 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]') -- cgit v1.2.3