/usr/lib/ruby/vendor_ruby/capybara/spec/public/test.js is in ruby-capybara 2.10.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | var activeRequests = 0;
$(function() {
$('#change').text('I changed it');
$('#drag').draggable();
$('#drop').droppable({
drop: function(event, ui) {
ui.draggable.remove();
$(this).html('Dropped!');
}
});
$('#clickable').click(function() {
var link = $(this);
setTimeout(function() {
$(link).after('<a id="has-been-clicked" href="#">Has been clicked</a>');
$(link).after('<input type="submit" value="New Here">');
$(link).after('<input type="text" id="new_field">');
$('#change').remove();
}, 500);
return false;
});
$('#slow-click').click(function() {
var link = $(this);
setTimeout(function() {
$(link).after('<a id="slow-clicked" href="#">Slow link clicked</a>');
}, 4000);
return false;
});
$('#waiter').change(function() {
activeRequests = 1;
setTimeout(function() {
activeRequests = 0;
}, 500);
});
$('#with_focus_event').focus(function() {
$('body').append('<p id="focus_event_triggered">Focus Event triggered</p>');
});
$('#with_change_event').change(function() {
$('body').append($('<p class="change_event_triggered"></p>').text(this.value));
});
$('#checkbox_with_event').click(function() {
$('body').append('<p id="checkbox_event_triggered">Checkbox event triggered</p>');
});
$('#fire_ajax_request').click(function() {
$.ajax({url: "/slow_response", context: document.body, success: function() {
$('body').append('<p id="ajax_request_done">Ajax request done</p>');
}});
});
$('#reload-link').click(function() {
setTimeout(function() {
$('#reload-me').replaceWith('<div id="reload-me"><em><a>has been reloaded</a></em></div>');
}, 250)
});
$('#reload-list').click(function() {
setTimeout(function() {
$('#the-list').html('<li>Foo</li><li>Bar</li>');
}, 550)
});
$('#change-title').click(function() {
setTimeout(function() {
$('title').text('changed title')
}, 250)
});
$('#click-test').on({
dblclick: function() {
$(this).after('<a id="has-been-double-clicked" href="#">Has been double clicked</a>');
},
contextmenu: function(e) {
e.preventDefault();
$(this).after('<a id="has-been-right-clicked" href="#">Has been right clicked</a>');
}
});
$('#open-alert').click(function() {
alert('Alert opened [*Yay?*]');
$(this).attr('opened', 'true');
});
$('#open-delayed-alert').click(function() {
var link = this;
setTimeout(function() {
alert('Delayed alert opened');
$(link).attr('opened', 'true');
}, 250);
});
$('#open-slow-alert').click(function() {
var link = this;
setTimeout(function() {
alert('Delayed alert opened');
$(link).attr('opened', 'true');
}, 3000);
});
$('#open-confirm').click(function() {
if(confirm('Confirm opened')) {
$(this).attr('confirmed', 'true');
} else {
$(this).attr('confirmed', 'false');
}
});
$('#open-prompt').click(function() {
var response = prompt('Prompt opened');
if(response === null) {
$(this).attr('response', 'dismissed');
} else {
$(this).attr('response', response);
}
});
$('#open-twice').click(function() {
if (confirm('Are you sure?')) {
if (!confirm('Are you really sure?')) {
$(this).attr('confirmed', 'false');
}
}
})
$('#delayed-page-change').click(function() {
setTimeout(function() {
window.location.pathname = '/with_html'
}, 500)
})
$('#with-key-events').keydown(function(e){
$('#key-events-output').append('keydown:'+e.which+' ')
});
$('#disable-on-click').click(function(e){
var input = this
setTimeout(function() {
input.disabled = true;
}, 500)
})
});
|