There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
test: fix incorrect day suffix (#3121)
JimmFly8bcc4d6a57e8
diff --git a/tests/libs/filter.ts b/tests/libs/filter.tsindex 2344bfd4ce..f659b33ffa 100644--- a/tests/libs/filter.ts+++ b/tests/libs/filter.ts@@ -87,10 +87,24 @@ const checkIsNextMonth = (date: Date): boolean => {export const selectDateFromDatePicker = async (page: Page, date: Date) => {const datePickerPopup = page.locator('.react-datepicker-popper');- const day = date.getDate().toString();+ const day = date.getDate();const month = date.toLocaleString('en-US', { month: 'long' });const weekday = date.toLocaleString('en-US', { weekday: 'long' });const year = date.getFullYear().toString();+ const nth = function (d: number) {+ if (d > 3 && d < 21) return 'th';+ switch (d % 10) {+ case 1:+ return 'st';+ case 2:+ return 'nd';+ case 3:+ return 'rd';+ default:+ return 'th';+ }+ };+ const daySuffix = nth(day);// Open the date picker popupawait clickDatePicker(page);const selectDate = async (): Promise<void> => {@@ -105,12 +119,9 @@ export const selectDateFromDatePicker = async (page: Page, date: Date) => {);await nextMonthButton.click();}- const map = ['th', 'st', 'nd', 'rd'];// Click on the day cellconst dateCell = page.locator(- `[aria-disabled="false"][aria-label="Choose ${weekday}, ${month} ${day}${- map[Number.parseInt(day) % 10] ?? 'th'- }, ${year}"]`+ `[aria-disabled="false"][aria-label="Choose ${weekday}, ${month} ${day}${daySuffix}, ${year}"]`);await dateCell.click();};