refactor: update DayDetail component and tests for clarity and functionality
Some checks failed
CI / lint-and-test (push) Failing after 28s

- Revised unit tests for DayDetailContent to reflect changes in duty entry display, ensuring only time and name are shown without contact links.
- Updated styling in DayDetail component to enhance visual consistency with background color adjustments.
- Removed unused ContactLinks component from DayDetailContent to streamline the code and improve readability.
This commit is contained in:
2026-03-03 18:29:34 +03:00
parent 8bf92bd4a1
commit 54f85a8f14
3 changed files with 7 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/**
* Unit tests for DayDetailContent: sorts duties by start_at, includes contact info.
* Unit tests for DayDetailContent: sorts duties by start_at; duty entries show time and name only (no contact links).
* Ported from webapp/js/dayDetail.test.js buildDayDetailContent.
*/
@@ -54,7 +54,7 @@ describe("DayDetailContent", () => {
expect(ivanovPos).toBeLessThan(petrovPos);
});
it("includes contact info (phone, username) for duty entries when present", () => {
it("shows duty time and name on one line and does not show contact links", () => {
const dateKey = "2025-03-01";
const duties = [
duty("Alice", "2025-03-01T09:00:00Z", "2025-03-01T17:00:00Z", {
@@ -70,8 +70,8 @@ describe("DayDetailContent", () => {
/>
);
expect(screen.getByText("Alice")).toBeInTheDocument();
expect(document.querySelector('a[href^="tel:"]')).toBeInTheDocument();
expect(document.querySelector('a[href*="t.me"]')).toBeInTheDocument();
expect(screen.getByText(/alice_dev/)).toBeInTheDocument();
expect(document.querySelector('a[href^="tel:"]')).toBeNull();
expect(document.querySelector('a[href*="t.me"]')).toBeNull();
expect(screen.queryByText(/alice_dev/)).not.toBeInTheDocument();
});
});