| 1 | import { test, expect } from "@odoo/hoot"; |
| 2 | import { mountView, models, defineModels } from "@web/../tests/web_test_helpers"; |
| 3 | import { defineMailModels } from "@mail/../tests/mail_test_helpers"; |
| 4 | |
| 5 | class HrEmployee extends models.ServerModel { |
| 6 | _name = "hr.employee"; |
| 7 | } |
| 8 | defineMailModels(); |
| 9 | defineModels([HrEmployee]); |
| 10 | |
| 11 | test("Show Time Off before Work Location", async () => { |
| 12 | HrEmployee._records = [ |
| 13 | { |
| 14 | id: 1, |
| 15 | name: "Employee test", |
| 16 | work_location_name: "Office 1", |
| 17 | work_location_type: "office", |
| 18 | show_hr_icon_display: true, |
| 19 | hr_icon_display: "presence_holiday_absent", |
| 20 | leave_date_to: "2025-01-06 00:00:00", |
| 21 | }, |
| 22 | ]; |
| 23 | await mountView({ |
| 24 | resModel: "hr.employee", |
| 25 | type: "form", |
| 26 | resId: 1, |
| 27 | arch: ` |
| 28 | <form> |
| 29 | <field name="hr_icon_display" widget="hr_presence_status"/> |
| 30 | </form>`, |
| 31 | }); |
| 32 | expect("small.fa-building").toHaveCount(0); |
| 33 | expect("small.fa-plane").toBeVisible(); |
| 34 | expect("div.o_field_hr_presence_status>div").toHaveAttribute("title", "On leave, back on Jan 6, 2025"); |
| 35 | expect("div.o_field_hr_presence_status>div").toHaveClass("btn-outline-warning"); |
| 36 | }); |