Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rails.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

$.rails = rails = {
// Link elements bound by jquery-ujs
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with], a[data-disable]',
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',

// Button elements bound by jquery-ujs
buttonClickSelector: 'button[data-remote]:not(form button), button[data-confirm]:not(form button)',
Expand Down
19 changes: 19 additions & 0 deletions test/public/test/data-remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ module('data-remote', {
'data-remote': 'true',
method: 'post'
}))
.append($('<a />', {
href: '/echo',
'data-remote': 'true',
disabled: 'disabled',
text: 'Disabed link'
}))
.find('form').append($('<input type="text" name="user_name" value="john">'));

}
Expand Down Expand Up @@ -84,6 +90,19 @@ asyncTest('clicking on a link with data-remote attribute', 5, function() {
.trigger('click');
});

asyncTest('clicking on a link with disabled attribute', 0, function() {
$('a[disabled]')
.bind("ajax:before", function(e, data, status, xhr) {
App.assertCallbackNotInvoked('ajax:success')
})
.bind('ajax:complete', function() { start() })
.trigger('click')

setTimeout(function() {
start();
}, 13);
});

asyncTest('clicking on a button with data-remote attribute', 5, function() {
$('button[data-remote]')
.bind('ajax:success', function(e, data, status, xhr) {
Expand Down