Skip to content

Commit

Permalink
Use miqObserveRequest to force dialog submit to wait for auto refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
eclarizio committed Oct 13, 2017
1 parent b02c131 commit c2701cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/dialog_field_refresh.js
@@ -1,4 +1,4 @@
/* global miqInitSelectPicker miqSelectPickerEvent miqSparkle miqSparkleOn */
/* global miqInitSelectPicker miqObserveRequest miqSelectPickerEvent miqSparkle miqSparkleOn */

var dialogFieldRefresh = {
unbindAllPreviousListeners: function() {
Expand Down Expand Up @@ -238,7 +238,7 @@ var dialogFieldRefresh = {
},

sendRefreshRequest: function(url, data, doneFunction) {
miqJqueryRequest(url, {
miqObserveRequest(url, {
data: data,
dataType: 'json',
beforeSend: true,
Expand Down
17 changes: 17 additions & 0 deletions spec/javascripts/dialog_field_refresh_spec.js
Expand Up @@ -923,4 +923,21 @@ describe('dialogFieldRefresh', function() {
});
});
});

describe('#sendRefreshRequest', function() {
beforeEach(function() {
spyOn(window, 'miqObserveRequest');
});

it('delegates to miqObserveRequest', function() {
dialogFieldRefresh.sendRefreshRequest('the url', 'the data', 'the done function');
expect(window.miqObserveRequest).toHaveBeenCalledWith('the url', {
data: 'the data',
dataType: 'json',
beforeSend: true,
complete: true,
done: 'the done function'
});
});
});
});

0 comments on commit c2701cc

Please sign in to comment.