Skip to content

Commit

Permalink
MDL-72893 Behat: Fix Behat failures for Timeline block
Browse files Browse the repository at this point in the history
  • Loading branch information
HuongNV13 committed Nov 22, 2021
1 parent 7013bda commit f1c0c29
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion blocks/timeline/amd/build/event_list.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 blocks/timeline/amd/build/event_list.min.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions blocks/timeline/amd/src/event_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ define(
'core/templates',
'core/str',
'core/user_date',
'block_timeline/calendar_events_repository'
'block_timeline/calendar_events_repository',
'core/pending'
],
function(
$,
Notification,
Templates,
Str,
UserDate,
CalendarEventsRepository
CalendarEventsRepository,
Pending
) {

var SECONDS_IN_DAY = 60 * 60 * 24;
Expand Down Expand Up @@ -215,6 +217,7 @@ function(
* @param {object} additionalConfig Additional config options to pass to pagedContentFactory.
*/
var init = function(root, additionalConfig = {}) {
const pendingPromise = new Pending('block/timeline:event-init');
root = $(root);

courseview = !!additionalConfig.courseview;
Expand Down Expand Up @@ -286,6 +289,8 @@ function(
});

return html;
}).then(() => {
return pendingPromise.resolve();
})
.catch(Notification.exception);
};
Expand Down
4 changes: 2 additions & 2 deletions blocks/timeline/tests/behat/block_timeline_courses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Feature: The timeline block allows users to see upcoming courses
And I click on "Next 30 days" "link" in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
When I click on "Sort by courses" "link" in the "Timeline" "block"
Then I should see "Course 1" in the "Timeline" "block"
And I should see "Course 2" in the "Timeline" "block"
Then I should see "Course 1" in the ".block_timeline [data-region='view-courses']" "css_element"
And I should see "Course 2" in the ".block_timeline [data-region='view-courses']" "css_element"
And I should see "Show more courses" in the "Timeline" "block"
And "Test choice 1" "link" should exist in the "Timeline" "block"
And I should see "Choice closes" in the "Timeline" "block"
Expand Down

0 comments on commit f1c0c29

Please sign in to comment.