From 8b22725c782a65b2222f7a9ffed6d241c599f2e6 Mon Sep 17 00:00:00 2001 From: ta1kt0me Date: Sat, 28 Oct 2017 11:51:21 +0900 Subject: Enable to call Rails.ajax without beforeSend --- actionview/test/ujs/public/test/call-ajax.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 actionview/test/ujs/public/test/call-ajax.js (limited to 'actionview/test/ujs/public') diff --git a/actionview/test/ujs/public/test/call-ajax.js b/actionview/test/ujs/public/test/call-ajax.js new file mode 100644 index 0000000000..49e64cad5c --- /dev/null +++ b/actionview/test/ujs/public/test/call-ajax.js @@ -0,0 +1,27 @@ +(function() { + +module('call-ajax', { + setup: function() { + $('#qunit-fixture') + .append($('', { href: '#' })) + } +}) + +asyncTest('call ajax without "ajax:beforeSend"', 1, function() { + + var link = $('#qunit-fixture a') + link.bindNative('click', function() { + Rails.ajax({ + type: 'get', + url: '/', + success: function() { + ok(true, 'calling request in ajax:success') + } + }) + }) + + link.triggerNative('click') + setTimeout(function() { start() }, 13) +}) + +})() -- cgit v1.2.3