aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorSudara <sudara@alonetone.com>2019-06-06 22:06:14 +0200
committerSudara <sudara@alonetone.com>2019-06-13 19:59:17 +0200
commitab4ed8c78681e0bda514bf6343d54914841a0e72 (patch)
treefd8cf381494ffdc2f1ed472ef416656c3a710313 /actionview/test
parentcb9c1da6952628801cfc7323ca5b8193bda5b294 (diff)
downloadrails-ab4ed8c78681e0bda514bf6343d54914841a0e72.tar.gz
rails-ab4ed8c78681e0bda514bf6343d54914841a0e72.tar.bz2
rails-ab4ed8c78681e0bda514bf6343d54914841a0e72.zip
Ensure non-mouse/programmatic clicks work with data-remote
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/ujs/public/test/data-remote.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionview/test/ujs/public/test/data-remote.js b/actionview/test/ujs/public/test/data-remote.js
index 9e41067549..16ea114f3b 100644
--- a/actionview/test/ujs/public/test/data-remote.js
+++ b/actionview/test/ujs/public/test/data-remote.js
@@ -82,6 +82,20 @@ asyncTest('right/mouse-wheel-clicking on a link does not fire ajaxyness', 0, fun
setTimeout(function() { start() }, 13)
})
+asyncTest('clicking on a link via a non-mouse Event (such as from js) works', 1, function() {
+ var link = $('a[data-remote]')
+
+ link
+ .removeAttr('data-params')
+ .bindNative('ajax:beforeSend', function() {
+ ok(true, 'ajax should be triggered')
+ })
+
+ Rails.fire(link[0], 'click')
+
+ setTimeout(function() { start() }, 13)
+})
+
asyncTest('ctrl-clicking on a link still fires ajax for non-GET links and for links with "data-params"', 2, function() {
var link = $('a[data-remote]')