MDL-71500 calendar_threemonth: clicking in a diff day should refresh day view
Clicking in a day in the three month block replaces the div with id starting with calendar- so we can do so repeatedly and successfully and test that it does (with behat).
This commit is contained in:
+1
-1
@@ -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
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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');
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user