mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-66226 core_message: wrap promise chains in pending for behat
Fixes random failures by forcing behat to wait for the pane to render.
This commit is contained in:
parent
545e8988c3
commit
c11baac4b4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -27,6 +27,7 @@ define(
|
||||
'core/notification',
|
||||
'core/pubsub',
|
||||
'core/str',
|
||||
'core/pending',
|
||||
'core/templates',
|
||||
'core/user_date',
|
||||
'core_message/message_repository',
|
||||
@ -42,6 +43,7 @@ function(
|
||||
Notification,
|
||||
PubSub,
|
||||
Str,
|
||||
Pending,
|
||||
Templates,
|
||||
UserDate,
|
||||
MessageRepository,
|
||||
@ -204,6 +206,7 @@ function(
|
||||
// Helper to format the last message for rendering.
|
||||
// Returns a promise which resolves to either a string, or null
|
||||
// (such as in the event of an empty personal space).
|
||||
var pending = new Pending();
|
||||
var formatMessagePreview = function(lastMessage) {
|
||||
if (!lastMessage) {
|
||||
return new Promise(function(resolve) {
|
||||
@ -309,7 +312,13 @@ function(
|
||||
});
|
||||
|
||||
return Templates.render(TEMPLATES.CONVERSATIONS_LIST, {conversations: formattedConversations});
|
||||
}).catch(Notification.exception);
|
||||
}).then(function(html, js) {
|
||||
pending.resolve();
|
||||
return $.Deferred().resolve(html, js);
|
||||
}).catch(function(error) {
|
||||
pending.resolve();
|
||||
Notification.exception(error);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user