diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/calendar/test/browser/browser_basicFunctionality.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/calendar/test/browser/browser_basicFunctionality.js')
-rw-r--r-- | comm/calendar/test/browser/browser_basicFunctionality.js | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/comm/calendar/test/browser/browser_basicFunctionality.js b/comm/calendar/test/browser/browser_basicFunctionality.js new file mode 100644 index 0000000000..c8f0fd68b7 --- /dev/null +++ b/comm/calendar/test/browser/browser_basicFunctionality.js @@ -0,0 +1,78 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* globals createCalendarUsingDialog */ + +var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm"); + +add_task(async function testBasicFunctionality() { + const calendarName = "Mochitest"; + + registerCleanupFunction(() => { + for (let calendar of cal.manager.getCalendars()) { + if (calendar.name == calendarName) { + cal.manager.removeCalendar(calendar); + } + } + Services.focus.focusedWindow = window; + }); + + Services.focus.focusedWindow = window; + + // Create test calendar. + await createCalendarUsingDialog(calendarName); + + // Check for minimonth, every month has a day 1. + Assert.ok( + document.querySelector("#calMinimonth .minimonth-cal-box td[aria-label='1']"), + "day 1 exists in the minimonth" + ); + + // Check for calendar list. + Assert.ok(document.querySelector("#calendar-list-pane"), "calendar list pane exists"); + Assert.ok(document.querySelector("#calendar-list"), "calendar list exists"); + + // Check for event search. + Assert.ok(document.querySelector("#bottom-events-box"), "event search box exists"); + + // There should be search field. + Assert.ok(document.querySelector("#unifinder-search-field"), "unifinded search field exists"); + + // Make sure the week view is the default selected view. + Assert.ok( + document + .querySelector(`.calview-toggle-item[aria-selected="true"]`) + .getAttribute("aria-controls") == "week-view", + "week-view toggle is the current default" + ); + + let dayViewButton = document.querySelector("#calTabDay"); + dayViewButton.click(); + Assert.ok(dayViewButton.getAttribute("aria-selected"), "day view button is selected"); + await CalendarTestUtils.ensureViewLoaded(window); + + // Day view should have 09:00 box. + let someTime = cal.createDateTime(); + someTime.resetTo(someTime.year, someTime.month, someTime.day, 9, 0, 0, someTime.timezone); + let label = cal.dtz.formatter.formatTime(someTime); + let labelEl = document.querySelectorAll("#day-view .multiday-timebar .multiday-hour-box")[9]; + Assert.ok(labelEl, "9th hour box should exist"); + Assert.equal(labelEl.textContent, label, "9th hour box should show the correct time"); + Assert.ok(CalendarTestUtils.dayView.getHourBoxAt(window, 9), "09:00 box exists"); + + // Open tasks view. + document.querySelector("#tasksButton").click(); + + // Should be possible to filter today's tasks. + Assert.ok(document.querySelector("#opt_today_filter"), "show today radio button exists"); + + // Check for task add button. + Assert.ok(document.querySelector("#calendar-add-task-button"), "task add button exists"); + + // Check for filtered tasks list. + Assert.ok( + document.querySelector("#calendar-task-tree .calendar-task-treechildren"), + "filtered tasks list exists" + ); +}); |