Skip to content

Commit

Permalink
MDL-67827 behat: Pending JS improvements for dialogues
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Mar 6, 2020
1 parent ae8d60c commit 604887c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion enrol/manual/amd/build/quickenrolment.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion enrol/manual/amd/build/quickenrolment.min.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions enrol/manual/amd/src/quickenrolment.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ define(['core/templates',
'core/modal_factory',
'core/modal_events',
'core/fragment',
'core/pending',
],
function(Template, $, Str, Config, Notification, ModalFactory, ModalEvents, Fragment) {
function(Template, $, Str, Config, Notification, ModalFactory, ModalEvents, Fragment, Pending) {

/** @type {Object} The list of selectors for the quick enrolment modal. */
var SELECTORS = {
Expand Down Expand Up @@ -91,14 +92,16 @@ define(['core/templates',
});

modal.getRoot().on(ModalEvents.shown, function() {
var pendingPromise = new Pending('enrol_manual/quickenrolment:initModal:shown');
var bodyPromise = this.getBody();
bodyPromise.then(function(html) {
var stringIndex = $(html).find(SELECTORS.COHORTSELECT).length ? 0 : 1;
modal.setSaveButtonText(strings[stringIndex]);

return;
})
.fail(Notification.exception);
.then(pendingPromise.resolve)
.catch(Notification.exception);

modal.setBody(bodyPromise);
}.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion lib/amd/build/modal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/amd/build/modal.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/amd/build/modal_factory.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 604887c

Please sign in to comment.