[FIX] web: fix calendar view tests after revamp
This commit fixes breaking calendar view tests after the revamp done in task-3455051 and task-3389317. task-3455051 task-3389317 Part-of: odoo/odoo#138670
This commit is contained in:
@@ -217,6 +217,7 @@ export class CalendarCommonRenderer extends Component {
|
||||
onEventRender(info) {
|
||||
const { el, event } = info;
|
||||
el.dataset.eventId = event.id;
|
||||
el.classList.add("o_event");
|
||||
const record = this.props.model.records[event.id];
|
||||
|
||||
if (record) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</t>
|
||||
<div class="o_calendar_container d-flex d-lg-grid flex-column h-100 bg-view">
|
||||
<div class="o_calendar_header d-flex align-items-center gap-1 p-2 border-bottom">
|
||||
<div class="o_calendar_navigation_buttons btn-group">
|
||||
<div t-if="!env.isSmall" class="o_calendar_navigation_buttons btn-group">
|
||||
<button
|
||||
class="o_calendar_button_prev btn btn-secondary d-none d-md-block"
|
||||
title="Previous"
|
||||
|
||||
@@ -145,6 +145,7 @@ export class CalendarYearRenderer extends Component {
|
||||
onEventRender(info) {
|
||||
const { el, event } = info;
|
||||
el.dataset.eventId = event.id;
|
||||
el.classList.add("o_event");
|
||||
const record = this.props.model.records[event.id];
|
||||
if (record) {
|
||||
const color = getColor(record.colorIndex);
|
||||
|
||||
@@ -95,7 +95,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
await click(target, ".o_calendar_container .o_other_calendar_panel");
|
||||
assert.isVisible(
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container button.o_calendar_button_today"
|
||||
".o_calendar_container .o_calendar_header button.o_calendar_button_today"
|
||||
),
|
||||
"today button should be visible"
|
||||
);
|
||||
@@ -103,45 +103,41 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
// Test all views
|
||||
// displays month mode by default
|
||||
assert.equal(
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container .dropdown-toggle"
|
||||
).textContent,
|
||||
target.querySelector(".o_calendar_container .o_calendar_header .dropdown-toggle")
|
||||
.textContent,
|
||||
"Week",
|
||||
"should display the current week"
|
||||
);
|
||||
|
||||
// switch to day mode
|
||||
await click(target, ".o_calendar_sidebar_container .dropdown-toggle");
|
||||
await click(target, ".o_calendar_sidebar_container .o_scale_button_day");
|
||||
await click(target, ".o_calendar_container .o_calendar_header .dropdown-toggle");
|
||||
await click(target, ".o_calendar_container .o_calendar_header .o_scale_button_day");
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container .dropdown-toggle"
|
||||
).textContent,
|
||||
target.querySelector(".o_calendar_container .o_calendar_header .dropdown-toggle")
|
||||
.textContent,
|
||||
"Day",
|
||||
"should display the current day"
|
||||
);
|
||||
|
||||
// switch to month mode
|
||||
await click(target, ".o_calendar_sidebar_container .dropdown-toggle");
|
||||
await click(target, ".o_calendar_sidebar_container .o_scale_button_month");
|
||||
await click(target, ".o_calendar_container .o_calendar_header .dropdown-toggle");
|
||||
await click(target, ".o_calendar_container .o_calendar_header .o_scale_button_month");
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container .dropdown-toggle"
|
||||
).textContent,
|
||||
target.querySelector(".o_calendar_container .o_calendar_header .dropdown-toggle")
|
||||
.textContent,
|
||||
"Month",
|
||||
"should display the current month"
|
||||
);
|
||||
|
||||
// switch to year mode
|
||||
await click(target, ".o_calendar_sidebar_container .dropdown-toggle");
|
||||
await click(target, ".o_calendar_sidebar_container .o_scale_button_year");
|
||||
await click(target, ".o_calendar_container .o_calendar_header .dropdown-toggle");
|
||||
await click(target, ".o_calendar_container .o_calendar_header .o_scale_button_year");
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container .dropdown-toggle"
|
||||
).textContent,
|
||||
target.querySelector(".o_calendar_container .o_calendar_header .dropdown-toggle")
|
||||
.textContent,
|
||||
"Year",
|
||||
"should display the current year"
|
||||
);
|
||||
@@ -200,18 +196,21 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
</calendar>`,
|
||||
});
|
||||
|
||||
assert.containsOnce(target, ".o_calendar_renderer");
|
||||
assert.containsOnce(target, ".o_other_calendar_panel");
|
||||
await click(target, ".o_other_calendar_panel");
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".o_calendar_filter_items_checkall",
|
||||
"should contain one filter to check all"
|
||||
);
|
||||
assert.containsN(
|
||||
target,
|
||||
".o_other_calendar_panel .o_filter > *",
|
||||
3,
|
||||
"should contains 3 child nodes -> 1 label (USER) + 2 resources (user 1/2)"
|
||||
".o_calendar_filter_item",
|
||||
2,
|
||||
"should contain 2 child nodes -> 2 resources"
|
||||
);
|
||||
assert.containsNone(target, ".o_calendar_sidebar");
|
||||
assert.containsOnce(target, ".o_calendar_renderer");
|
||||
|
||||
// Toggle the other calendar panel should hide the calendar view and show the sidebar
|
||||
await click(target, ".o_other_calendar_panel");
|
||||
assert.containsOnce(target, ".o_calendar_sidebar");
|
||||
assert.containsNone(target, ".o_calendar_renderer");
|
||||
assert.containsOnce(target, ".o_calendar_filter");
|
||||
@@ -222,8 +221,8 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
assert.containsN(
|
||||
target,
|
||||
".o_other_calendar_panel .o_filter > *",
|
||||
1,
|
||||
"should contains 1 child node -> 1 label (USER)"
|
||||
0,
|
||||
"should contain 0 child nodes -> no filters selected"
|
||||
);
|
||||
|
||||
// Toggle again the other calendar panel should hide the sidebar and show the calendar view
|
||||
@@ -368,11 +367,12 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
assert.equal(target.querySelector(".fc-day-header[data-date]").dataset.date, "2016-02-05");
|
||||
|
||||
// Change scale to month
|
||||
await click(target, ".o_calendar_container .o_other_calendar_panel");
|
||||
await changeScale(target, "month");
|
||||
assert.containsOnce(target, ".currentDate");
|
||||
assert.strictEqual(document.querySelector(".currentDate").textContent, " - February 2016");
|
||||
await click(target, ".o_calendar_container .o_other_calendar_panel");
|
||||
assert.containsOnce(target, ".o_calendar_container .o_calendar_header h5");
|
||||
assert.strictEqual(
|
||||
document.querySelector(".o_calendar_container .o_calendar_header h5").textContent,
|
||||
"February 2016"
|
||||
);
|
||||
assert.containsNone(target, ".fc-timeGridDay-view");
|
||||
assert.containsOnce(target, ".fc-dayGridMonth-view");
|
||||
|
||||
@@ -380,7 +380,10 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
await tap(target, ".fc-day-top[data-date='2016-02-10']");
|
||||
await nextTick(); // await reload & render
|
||||
await nextTick(); // await breadcrumb update
|
||||
assert.strictEqual(document.querySelector(".currentDate").textContent, "");
|
||||
assert.strictEqual(
|
||||
document.querySelector(".o_calendar_container .o_calendar_header h5").textContent,
|
||||
"10 February 2016"
|
||||
);
|
||||
assert.containsNone(target, ".fc-dayGridMonth-view");
|
||||
assert.containsOnce(target, ".fc-timeGridDay-view");
|
||||
assert.equal(target.querySelector(".fc-day-header[data-date]").dataset.date, "2016-02-10");
|
||||
|
||||
@@ -62,7 +62,7 @@ QUnit.module("CalendarView - CommonPopover", ({ beforeEach }) => {
|
||||
});
|
||||
const dateTimeGroup = target.querySelector(`.list-group`);
|
||||
const dateTimeLabels = dateTimeGroup.textContent.replace(/\s+/g, " ").trim();
|
||||
assert.strictEqual(dateTimeLabels, "July 16, 2021 (All day)");
|
||||
assert.strictEqual(dateTimeLabels, "July 16, 2021");
|
||||
});
|
||||
|
||||
QUnit.test("date duration: is all day and two days duration", async (assert) => {
|
||||
@@ -77,7 +77,7 @@ QUnit.module("CalendarView - CommonPopover", ({ beforeEach }) => {
|
||||
});
|
||||
const dateTimeGroup = target.querySelector(`.list-group`);
|
||||
const dateTimeLabels = dateTimeGroup.textContent.replace(/\s+/g, " ").trim();
|
||||
assert.strictEqual(dateTimeLabels, "July 16-17, 2021 (2 days)");
|
||||
assert.strictEqual(dateTimeLabels, "July 16-17, 2021 2 days");
|
||||
});
|
||||
|
||||
QUnit.test("time duration: 1 hour diff", async (assert) => {
|
||||
@@ -152,10 +152,7 @@ QUnit.module("CalendarView - CommonPopover", ({ beforeEach }) => {
|
||||
});
|
||||
const dateTimeGroup = target.querySelector(`.list-group`);
|
||||
const dateTimeLabels = dateTimeGroup.textContent.replace(/\s+/g, " ").trim();
|
||||
assert.strictEqual(
|
||||
dateTimeLabels,
|
||||
"July 16, 2021 08:00 - 11:15 (3 hours, 15 minutes)"
|
||||
);
|
||||
assert.strictEqual(dateTimeLabels, "July 16, 2021 08:00 - 11:15 (3 hours, 15 minutes)");
|
||||
});
|
||||
|
||||
QUnit.test("isTimeHidden is true", async (assert) => {
|
||||
@@ -177,10 +174,7 @@ QUnit.module("CalendarView - CommonPopover", ({ beforeEach }) => {
|
||||
});
|
||||
const dateTimeGroup = target.querySelector(`.list-group`);
|
||||
const dateTimeLabels = dateTimeGroup.textContent.replace(/\s+/g, " ").trim();
|
||||
assert.strictEqual(
|
||||
dateTimeLabels,
|
||||
"July 16, 2021 08:00 - 11:15 (3 hours, 15 minutes)"
|
||||
);
|
||||
assert.strictEqual(dateTimeLabels, "July 16, 2021 08:00 - 11:15 (3 hours, 15 minutes)");
|
||||
});
|
||||
|
||||
QUnit.test("canDelete is true", async (assert) => {
|
||||
|
||||
@@ -67,7 +67,9 @@ QUnit.module("CalendarView - CommonRenderer", ({ beforeEach }) => {
|
||||
QUnit.test("Day: check date", async (assert) => {
|
||||
await start({ model: { scale: "day" } });
|
||||
assert.containsOnce(target, ".fc-day-header");
|
||||
assert.strictEqual(target.querySelector(".fc-day-header").textContent, "Fri 16");
|
||||
const dayHeader = target.querySelector(".fc-day-header");
|
||||
assert.strictEqual(dayHeader.querySelector(".o_cw_day_name").textContent, "Friday");
|
||||
assert.strictEqual(dayHeader.querySelector(".o_cw_day_number").textContent, "16");
|
||||
});
|
||||
|
||||
QUnit.test("Day: click all day slot", async (assert) => {
|
||||
@@ -152,11 +154,13 @@ QUnit.module("CalendarView - CommonRenderer", ({ beforeEach }) => {
|
||||
await start({ model: { scale: "week" } });
|
||||
assert.containsN(target, ".fc-day-header", 7);
|
||||
|
||||
const dates = ["Sun 11", "Mon 12", "Tue 13", "Wed 14", "Thu 15", "Fri 16", "Sat 17"];
|
||||
const dateNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||
const dates = ["11", "12", "13", "14", "15", "16", "17"];
|
||||
|
||||
const els = target.querySelectorAll(".fc-day-header");
|
||||
for (let i = 0; i < els.length; i++) {
|
||||
assert.strictEqual(els[i].textContent, dates[i]);
|
||||
assert.strictEqual(els[i].querySelector(".o_cw_day_name").textContent, dateNames[i]);
|
||||
assert.strictEqual(els[i].querySelector(".o_cw_day_number").textContent, dates[i]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -928,7 +928,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
);
|
||||
assert.strictEqual(
|
||||
popoverDescription.children[2].textContent,
|
||||
"(2 days)",
|
||||
"2 days",
|
||||
"The popover description should indicate 2 days"
|
||||
);
|
||||
await click(target, ".o_cw_popover_close");
|
||||
@@ -1185,15 +1185,15 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header");
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header .o_cw_day_name");
|
||||
assert.strictEqual(
|
||||
dayHeaders[0].textContent,
|
||||
"Sun 11",
|
||||
"Sun",
|
||||
"The first day of the week should be Sunday"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dayHeaders[dayHeaders.length - 1].textContent,
|
||||
"Sat 17",
|
||||
"Sat",
|
||||
"The last day of the week should be Saturday"
|
||||
);
|
||||
});
|
||||
@@ -1226,15 +1226,15 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header");
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header .o_cw_day_name");
|
||||
assert.strictEqual(
|
||||
dayHeaders[0].textContent,
|
||||
"Mon 12",
|
||||
"Mon",
|
||||
"The first day of the week should be Monday"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dayHeaders[dayHeaders.length - 1].textContent,
|
||||
"Sun 18",
|
||||
"Sun",
|
||||
"The last day of the week should be Sunday"
|
||||
);
|
||||
});
|
||||
@@ -1293,7 +1293,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
"popover should have a close button"
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_cw_popover .list-group-item b.text-capitalize").textContent,
|
||||
target.querySelector(".o_cw_popover .list-group-item span.fw-bold").textContent,
|
||||
"December 14, 2016",
|
||||
"should display date 'December 14, 2016'"
|
||||
);
|
||||
@@ -1309,8 +1309,8 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
);
|
||||
assert.containsOnce(groups[0], ".o_field_char", "should apply char widget");
|
||||
assert.strictEqual(
|
||||
groups[0].querySelector("strong").textContent,
|
||||
"Custom Name: ",
|
||||
groups[0].querySelector("span.fw-bold").textContent,
|
||||
"Custom Name",
|
||||
"label should be a 'Custom Name'"
|
||||
);
|
||||
assert.strictEqual(
|
||||
@@ -1320,8 +1320,8 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
);
|
||||
assert.containsOnce(groups[1], ".o_form_uri", "should apply m20 widget");
|
||||
assert.strictEqual(
|
||||
groups[1].querySelector("strong").textContent,
|
||||
"user: ",
|
||||
groups[1].querySelector("span.fw-bold").textContent,
|
||||
"user",
|
||||
"label should be a 'user'"
|
||||
);
|
||||
assert.strictEqual(
|
||||
@@ -1666,15 +1666,15 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const headers = target.querySelectorAll(".fc-day-header");
|
||||
const headers = target.querySelectorAll(".fc-day-header .o_cw_day_number");
|
||||
assert.strictEqual(
|
||||
headers[0].textContent,
|
||||
"Sun 11",
|
||||
"11",
|
||||
"The calendar start date should be 2016-12-11"
|
||||
);
|
||||
assert.strictEqual(
|
||||
headers[headers.length - 1].textContent,
|
||||
"Sat 17",
|
||||
"17",
|
||||
"The calendar start date should be 2016-12-17"
|
||||
);
|
||||
});
|
||||
@@ -3467,7 +3467,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
await clickEvent(target, 1);
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_cw_popover .list-group-item").textContent,
|
||||
"December 14, 2016 (All day)"
|
||||
"December 14, 2016 "
|
||||
);
|
||||
});
|
||||
|
||||
@@ -3963,13 +3963,18 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
arch: `<calendar date_start="start" date_stop="stop" mode="week"/>`,
|
||||
});
|
||||
assert.deepEqual(
|
||||
[...target.querySelectorAll(".fc-day-header")].map((el) => el.textContent),
|
||||
[...target.querySelectorAll(".fc-day-header")].map((el) =>
|
||||
[
|
||||
el.querySelector(".o_cw_day_name").textContent,
|
||||
el.querySelector(".o_cw_day_number").textContent,
|
||||
].join(" ")
|
||||
),
|
||||
["dim. 11", "lun. 12", "mar. 13", "mer. 14", "jeu. 15", "ven. 16", "sam. 17"]
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(`initial_date given in the context`, async (assert) => {
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
serverData.views = {
|
||||
"event,1,calendar": `<calendar date_start="start" date_stop="stop" mode="day"/>`,
|
||||
"event,false,search": `<search />`,
|
||||
@@ -3993,8 +3998,14 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
"should display name passed in the context"
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_calendar_renderer .fc-day-header").textContent,
|
||||
"Sat 30",
|
||||
target.querySelector(".o_calendar_renderer .fc-day-header .o_cw_day_name").textContent,
|
||||
"Saturday",
|
||||
"should display day passed in the context"
|
||||
);
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_calendar_renderer .fc-day-header .o_cw_day_number")
|
||||
.textContent,
|
||||
"30",
|
||||
"should display day passed in the context"
|
||||
);
|
||||
});
|
||||
@@ -4027,15 +4038,15 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header");
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header .o_cw_day_name");
|
||||
assert.strictEqual(
|
||||
dayHeaders[0].textContent,
|
||||
"Sun 1",
|
||||
"Sun",
|
||||
"The first day of the week should be Sunday"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dayHeaders[dayHeaders.length - 1].textContent,
|
||||
"Sat 7",
|
||||
"Sat",
|
||||
"The last day of the week should be Saturday"
|
||||
);
|
||||
|
||||
@@ -4082,15 +4093,15 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header");
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header .o_cw_day_name");
|
||||
assert.strictEqual(
|
||||
dayHeaders[0].textContent,
|
||||
"Mon 26",
|
||||
"Mon",
|
||||
"The first day of the week should be Monday"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dayHeaders[dayHeaders.length - 1].textContent,
|
||||
"Sun 1",
|
||||
"Sun",
|
||||
"The last day of the week should be Sunday"
|
||||
);
|
||||
|
||||
@@ -4137,14 +4148,17 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header");
|
||||
const dayNameHeaders = target.querySelectorAll(".fc-day-header .o_cw_day_name");
|
||||
const dayNumberHeaders = target.querySelectorAll(".fc-day-header .o_cw_day_number");
|
||||
assert.strictEqual(
|
||||
dayHeaders[0].textContent,
|
||||
`${dayNameHeaders[0].textContent} ${dayNumberHeaders[0].textContent}`,
|
||||
"Mon 9",
|
||||
"The first day of the week should be Monday the 9th"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dayHeaders[dayHeaders.length - 1].textContent,
|
||||
`${dayNameHeaders[dayNameHeaders.length - 1].textContent} ${
|
||||
dayNumberHeaders[dayNumberHeaders.length - 1].textContent
|
||||
}`,
|
||||
"Sun 15",
|
||||
"The last day of the week should be Sunday the 15th"
|
||||
);
|
||||
@@ -4179,14 +4193,17 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const dayHeaders = target.querySelectorAll(".fc-day-header");
|
||||
const dayNameHeaders = target.querySelectorAll(".fc-day-header .o_cw_day_name");
|
||||
const dayNumberHeaders = target.querySelectorAll(".fc-day-header .o_cw_day_number");
|
||||
assert.strictEqual(
|
||||
dayHeaders[0].textContent,
|
||||
`${dayNameHeaders[0].textContent} ${dayNumberHeaders[0].textContent}`,
|
||||
"Sat 7",
|
||||
"The first day of the week should be Saturday the 7th"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dayHeaders[dayHeaders.length - 1].textContent,
|
||||
`${dayNameHeaders[dayNameHeaders.length - 1].textContent} ${
|
||||
dayNumberHeaders[dayNumberHeaders.length - 1].textContent
|
||||
}`,
|
||||
"Fri 13",
|
||||
"The last day of the week should be Friday the 13th"
|
||||
);
|
||||
@@ -4398,7 +4415,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
assert.containsN(target, ".fc-month", 12);
|
||||
assert.strictEqual(
|
||||
target.querySelector(".fc-month .fc-header-toolbar").textContent,
|
||||
"Jan 2016"
|
||||
"January 2016"
|
||||
);
|
||||
assert.containsN(
|
||||
target,
|
||||
@@ -4445,7 +4462,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
.querySelector(".o_popover")
|
||||
.textContent.replace(/\s{2,}/g, " ")
|
||||
.trim();
|
||||
assert.strictEqual(popoverText, "December 12, 201611:55 event 216:55 event 3");
|
||||
assert.strictEqual(popoverText, "December 12, 201611:55event 216:55event 3");
|
||||
await click(target, ".o_cw_popover_close");
|
||||
assert.containsNone(target, ".o_popover");
|
||||
|
||||
@@ -4577,7 +4594,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_cw_popover .o_cw_popover_fields_secondary").textContent,
|
||||
"user: name: event 4"
|
||||
"usernameevent 4"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -90,18 +90,18 @@ QUnit.module("CalendarView - YearPopover", ({ beforeEach }) => {
|
||||
QUnit.test("group records", async (assert) => {
|
||||
await start({});
|
||||
|
||||
assert.containsN(target, ".o_cw_body > div", 5);
|
||||
assert.containsN(target, ".o_cw_body > a", 5);
|
||||
assert.containsN(target, ".o_cw_body > div", 4);
|
||||
assert.containsN(target, ".o_cw_body > a", 1);
|
||||
|
||||
const sectionTitles = target.querySelectorAll(".o_cw_body > div");
|
||||
assert.strictEqual(sectionTitles[0].textContent.trim(), "July 16, 2021");
|
||||
assert.strictEqual(sectionTitles[1].textContent.trim(), "July 13-17, 2021");
|
||||
assert.strictEqual(sectionTitles[2].textContent.trim(), "July 15-17, 2021");
|
||||
assert.strictEqual(sectionTitles[3].textContent.trim(), "July 15-19, 2021");
|
||||
assert.strictEqual(sectionTitles[0].textContent.trim(), "July 16, 2021R114:00R2");
|
||||
assert.strictEqual(sectionTitles[1].textContent.trim(), "July 13-17, 2021R4");
|
||||
assert.strictEqual(sectionTitles[2].textContent.trim(), "July 15-17, 2021R3");
|
||||
assert.strictEqual(sectionTitles[3].textContent.trim(), "July 15-19, 2021R5");
|
||||
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_cw_body").textContent.trim(),
|
||||
"July 16, 2021R114:00 R2July 13-17, 2021R4July 15-17, 2021R3July 15-19, 2021R5 Create"
|
||||
"July 16, 2021R114:00R2July 13-17, 2021R4July 15-17, 2021R3July 15-19, 2021R5 Create"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -113,8 +113,8 @@ QUnit.module("CalendarView - YearPopover", ({ beforeEach }) => {
|
||||
editRecord: () => assert.step("edit"),
|
||||
},
|
||||
});
|
||||
assert.containsOnce(target, ".o_cw_body > a");
|
||||
await click(target, ".o_cw_body > a");
|
||||
assert.containsOnce(target, ".o_cw_body a.o_cw_popover_link");
|
||||
await click(target, ".o_cw_body a.o_cw_popover_link");
|
||||
assert.verifySteps(["edit"]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,18 +34,18 @@ QUnit.module("CalendarView - YearRenderer", ({ beforeEach }) => {
|
||||
// check "title format"
|
||||
assert.strictEqual(monthHeaders.length, 12);
|
||||
const monthTitles = [
|
||||
"Jan 2021",
|
||||
"Feb 2021",
|
||||
"Mar 2021",
|
||||
"Apr 2021",
|
||||
"January 2021",
|
||||
"February 2021",
|
||||
"March 2021",
|
||||
"April 2021",
|
||||
"May 2021",
|
||||
"Jun 2021",
|
||||
"Jul 2021",
|
||||
"Aug 2021",
|
||||
"Sep 2021",
|
||||
"Oct 2021",
|
||||
"Nov 2021",
|
||||
"Dec 2021",
|
||||
"June 2021",
|
||||
"July 2021",
|
||||
"August 2021",
|
||||
"September 2021",
|
||||
"October 2021",
|
||||
"November 2021",
|
||||
"December 2021",
|
||||
];
|
||||
for (let i = 0; i < 12; i++) {
|
||||
assert.strictEqual(monthHeaders[i].textContent, monthTitles[i]);
|
||||
@@ -137,18 +137,24 @@ QUnit.module("CalendarView - YearRenderer", ({ beforeEach }) => {
|
||||
await selectDateRange(target, "2021-07-02", "2021-07-05");
|
||||
});
|
||||
|
||||
QUnit.test("display correct column header for days, independent of the timezone", async (assert) => {
|
||||
// Regression test: when the system tz is somewhere in a negative GMT (in our example Alaska)
|
||||
// the day headers of a months were incorrectly set. (S S M T W T F) instead of (S M T W T F S)
|
||||
// if the first day of the week is Sunday.
|
||||
patchTimeZone(-540); // UTC-9 = Alaska
|
||||
QUnit.test(
|
||||
"display correct column header for days, independent of the timezone",
|
||||
async (assert) => {
|
||||
// Regression test: when the system tz is somewhere in a negative GMT (in our example Alaska)
|
||||
// the day headers of a months were incorrectly set. (S S M T W T F) instead of (S M T W T F S)
|
||||
// if the first day of the week is Sunday.
|
||||
patchTimeZone(-540); // UTC-9 = Alaska
|
||||
|
||||
await start({});
|
||||
await start({});
|
||||
|
||||
const dayHeaders = target
|
||||
.querySelector(".fc-month-container")
|
||||
.querySelectorAll(".fc-day-header");
|
||||
const dayHeaders = target
|
||||
.querySelector(".fc-month-container")
|
||||
.querySelectorAll(".fc-day-header");
|
||||
|
||||
assert.deepEqual([...dayHeaders].map((el) => el.textContent), ["S", "M", "T", "W", "T", "F", "S"]);
|
||||
});
|
||||
assert.deepEqual(
|
||||
[...dayHeaders].map((el) => el.textContent),
|
||||
["S", "M", "T", "W", "T", "F", "S"]
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -282,9 +282,9 @@ export function findPickedDate(target) {
|
||||
export async function pickDate(target, date) {
|
||||
const day = date.split("-")[2];
|
||||
const iDay = parseInt(day, 10) - 1;
|
||||
const el = target.querySelectorAll(
|
||||
`.o_datetime_picker .o_date_item_cell:not(.o_out_of_range)`
|
||||
)[iDay];
|
||||
const el = target.querySelectorAll(`.o_datetime_picker .o_date_item_cell:not(.o_out_of_range)`)[
|
||||
iDay
|
||||
];
|
||||
el.scrollIntoView();
|
||||
await click(el);
|
||||
}
|
||||
@@ -298,7 +298,7 @@ export function findDateCell(target, date) {
|
||||
}
|
||||
|
||||
export function findEvent(target, eventId) {
|
||||
return target.querySelector(`.fc_event[data-event-id="${eventId}"]`);
|
||||
return target.querySelector(`.o_event[data-event-id="${eventId}"]`);
|
||||
}
|
||||
|
||||
function findDateCol(target, date) {
|
||||
|
||||
Reference in New Issue
Block a user