Merge branch 'MDL-71500-311' of git://github.com/lameze/moodle into MOODLE_311_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2021-08-11 20:16:46 +02:00
8 changed files with 50 additions and 8 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
define ("core_calendar/calendar_threemonth",["jquery","core/notification","core_calendar/selectors","core_calendar/events","core/templates","core_calendar/view_manager"],function(a,b,c,d,e,f){var g=function(g){var h=a("body");h.on([d.monthChanged,d.dayChanged].join(" "),function(a,c,d,e,f){g.queue(function(g){return i(a,c,d,e,f).then(function(){return g()}).fail(b.exception)})});var i=function(b,d,e,h,i){var j=g.find("[data-year=\""+d+"\"][data-month=\""+e+"\"]"),k=j.closest(c.calendarPeriods.month),l=g.find(c.calendarPeriods.month),m=a(l[0]),n=a(l[2]),o=a("<span>");o.attr("data-template","core_calendar/threemonth_month");o.attr("data-includenavigation",!1);o.attr("data-mini",!0);var p=a("<div>");p.hide();p.append(o);var q,r,s;if(k.is(m)){p.insertBefore(m);q=m.data("previousYear");r=m.data("previousMonth");s=n}else if(k.is(n)){p.insertAfter(n);q=n.data("nextYear");r=n.data("nextMonth");s=m}else{return a.Deferred().resolve()}return f.refreshMonthContent(o,q,r,h,i,o).then(function(){var b=a.Deferred(),c=a.Deferred();s.slideUp("fast",function(){a(this).remove();b.resolve()});p.slideDown("fast",function(){c.resolve()});return a.when(b,c)})};g.on("click",c.links.miniDayLink,function(b){var d=a(b.target),e=d.data("year"),g=d.data("month"),h=d.text(),i=d.data("courseid"),j=d.data("categoryid"),k=a("body").find(c.calendarMain);f.refreshDayContent(k,e,g,h,i,j,k,"core_calendar/calendar_day");b.preventDefault();window.history.pushState({},"","?view=day")})};return{init:function init(b){b=a(b);g(b)}}});
define ("core_calendar/calendar_threemonth",["jquery","core/notification","core_calendar/selectors","core_calendar/events","core/templates","core_calendar/view_manager"],function(a,b,c,d,e,f){var g=function(g){var h=a("body");h.on([d.monthChanged,d.dayChanged].join(" "),function(a,c,d,e,f){g.queue(function(g){return i(a,c,d,e,f).then(function(){return g()}).fail(b.exception)})});var i=function(b,d,e,h,i){var j=g.find("[data-year=\""+d+"\"][data-month=\""+e+"\"]"),k=j.closest(c.calendarPeriods.month),l=g.find(c.calendarPeriods.month),m=a(l[0]),n=a(l[2]),o=a("<span>");o.attr("data-template","core_calendar/threemonth_month");o.attr("data-includenavigation",!1);o.attr("data-mini",!0);var p=a("<div>");p.hide();p.append(o);var q,r,s;if(k.is(m)){p.insertBefore(m);q=m.data("previousYear");r=m.data("previousMonth");s=n}else if(k.is(n)){p.insertAfter(n);q=n.data("nextYear");r=n.data("nextMonth");s=m}else{return a.Deferred().resolve()}return f.refreshMonthContent(o,q,r,h,i,o).then(function(){var b=a.Deferred(),c=a.Deferred();s.slideUp("fast",function(){a(this).remove();b.resolve()});p.slideDown("fast",function(){c.resolve()});return a.when(b,c)})};g.on("click",c.links.miniDayLink,function(b){var d=a(b.target),e=d.data("year"),g=d.data("month"),h=d.text(),i=d.data("courseid"),j=d.data("categoryid"),k=a("body").find(c.calendarMain);f.refreshDayContent(k,e,g,h,i,j,k.find("[id^=\"calendar-\"][data-template^=\"core_calendar/\"]"),"core_calendar/calendar_day");b.preventDefault();window.history.pushState({},"","?view=day")})};return{init:function init(b){b=a(b);g(b)}}});
//# sourceMappingURL=calendar_threemonth.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -130,7 +130,7 @@ function(
categoryId = miniDayLink.data('categoryid'),
calendarRoot = $('body').find(CalendarSelectors.calendarMain);
CalendarViewManager.refreshDayContent(calendarRoot, year, month, day, courseId, categoryId,
calendarRoot, 'core_calendar/calendar_day');
calendarRoot.find('[id^="calendar-"][data-template^="core_calendar/"]'), 'core_calendar/calendar_day');
e.preventDefault();
window.history.pushState({}, '', '?view=day');
});
+3 -1
View File
@@ -234,7 +234,9 @@ export const reloadCurrentMonth = (root, courseId = 0, categoryId = 0) => {
export const refreshDayContent = (root, year, month, day, courseId, categoryId, target = null, template = '') => {
startLoading(root);
target = target || root.find(CalendarSelectors.wrapper);
if (!target || target.length == 0){
target = root.find(CalendarSelectors.wrapper);
}
template = template || root.attr('data-template');
M.util.js_pending([root.get('id'), year, month, day, courseId, categoryId].join('-'));
const includenavigation = root.data('includenavigation');
+25 -2
View File
@@ -77,6 +77,30 @@ class behat_calendar extends behat_base {
}
}
/**
* Click a specific day in the calendar.
*
* @Given /^I click day "(?P<dayofmonth>\d+)" of this month in the calendar$/
* @param int $day The day of the current month
*/
public function i_click_day_of_this_month_in_calendar($day) {
$summarytitle = userdate(time(), get_string('strftimemonthyear'));
// The current month table.
$currentmonth = "table[descendant::*[self::caption[contains(concat(' ', normalize-space(.), ' '), ' {$summarytitle} ')]]]";
// Strings for the class cell match.
$cellclasses = "contains(concat(' ', normalize-space(@class), ' '), ' day ')";
$daycontains = "text()[contains(concat(' ', normalize-space(.), ' '), ' {$day} ')]";
$daycell = "td[{$cellclasses}]";
$dayofmonth = "a[{$daycontains}]";
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
$this->execute("behat_general::wait_until_the_page_is_ready");
$this->execute("behat_general::i_click_on", array($xpath, "xpath_element"));
$this->execute("behat_general::wait_until_the_page_is_ready");
}
/**
* Hover over a specific day in the calendar.
*
@@ -96,8 +120,7 @@ class behat_calendar extends behat_base {
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
$this->execute("behat_general::wait_until_the_page_is_ready");
$this->execute("behat_general::i_hover", array($xpath, "xpath_element"));
$this->execute("behat_general::i_hover", [$xpath, "xpath_element"]);
}
/**
+17
View File
@@ -36,6 +36,23 @@ Feature: Open calendar popup
And I should see "Event 1:1"
And I should see "Event 1:2"
@javascript
Scenario: I view a day event then another day event
Given I follow "This month"
And I create a calendar event:
| Type of event | site |
| Event title | Event 3:1 |
| timestart[day] | 3 |
And I create a calendar event:
| Type of event | site |
| Event title | Event 4:1 |
| timestart[day] | 4 |
And I reload the page
When I click day "3" of this month in the calendar
Then I should see "Event 3:1" in the ".eventlist" "css_element"
And I click day "4" of this month in the calendar
And I should see "Event 4:1" in the ".eventlist" "css_element"
@javascript
Scenario: I view calendar details for today
Given I follow "This month"