Merge pull request #4961 from betagouv/remove-wait-for-ajax

Tests : suppression du helper inutilisé `wait-for-ajax`
This commit is contained in:
Pierre de La Morinerie 2020-03-31 13:00:13 +02:00 committed by GitHub
commit 0f6f447a6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 23 deletions

View file

@ -62,7 +62,6 @@ export function ajax(options) {
}
export function getJSON(url, data, method = 'get') {
incrementActiveRequestsCount();
data = method !== 'get' ? JSON.stringify(data) : data;
return Promise.resolve(
$.ajax({
@ -72,7 +71,7 @@ export function getJSON(url, data, method = 'get') {
contentType: 'application/json',
dataType: 'json'
})
).finally(decrementActiveRequestsCount);
);
}
export function scrollTo(container, scrollTo) {
@ -115,15 +114,3 @@ export function timeoutable(promise, timeoutDelay) {
});
return Promise.race([promise, timeoutPromise]);
}
const DATA_ACTIVE_REQUESTS_COUNT = 'data-active-requests-count';
function incrementActiveRequestsCount() {
const count = document.body.getAttribute(DATA_ACTIVE_REQUESTS_COUNT) || '0';
document.body.setAttribute(DATA_ACTIVE_REQUESTS_COUNT, parseInt(count) + 1);
}
function decrementActiveRequestsCount() {
const count = document.body.getAttribute(DATA_ACTIVE_REQUESTS_COUNT) || '0';
document.body.setAttribute(DATA_ACTIVE_REQUESTS_COUNT, parseInt(count) - 1);
}

View file

@ -1,9 +0,0 @@
module WaitForAjax
def wait_for_ajax
expect(page).to have_selector('body[data-active-requests-count="0"]')
end
end
RSpec.configure do |config|
config.include WaitForAjax, type: :feature
end