Debian Codegraph @

addons/hr_holidays/static/tests/tours/time_off_request_calendar_view.js

raw
1 import { registry } from "@web/core/registry";
2 import { stepUtils } from "@web_tour/tour_utils";
3
4 registry.category("web_tour.tours").add("time_off_request_calendar_view", {
5 url: "/odoo",
6 steps: () => [
7 stepUtils.showAppsMenuItem(),
8 {
9 content: "Open Time Off app",
10 trigger: '.o_app[data-menu-xmlid="hr_holidays.menu_hr_holidays_root"]',
11 run: "click",
12 },
13 {
14 content: "Click on the first Thursday of the year",
15 trigger: ".fc-daygrid-day.fc-day-thu",
16 run: () => {
17 const el = document.querySelector(".fc-daygrid-day.fc-day-thu").firstChild;
18 el.scrollIntoView();
19
20 const fromPosition = el.getBoundingClientRect();
21 fromPosition.x += el.offsetWidth / 2;
22 fromPosition.y += el.offsetHeight / 2;
23
24 el.dispatchEvent(
25 new MouseEvent("mousedown", {
26 bubbles: true,
27 which: 1,
28 button: 0,
29 clientX: fromPosition.x,
30 clientY: fromPosition.y,
31 })
32 );
33 el.dispatchEvent(
34 new MouseEvent("mouseup", {
35 bubbles: true,
36 which: 1,
37 button: 0,
38 clientX: fromPosition.x,
39 clientY: fromPosition.y,
40 })
41 );
42 },
43 },
44 {
45 content: "Save the leave",
46 trigger: '.btn:contains("Submit Request")',
47 run: "click",
48 },
49 ],
50 });