From 73575882b3cd9a18714fffcc9d901f17fb1d7cb4 Mon Sep 17 00:00:00 2001 From: JAHANWEE Date: Thu, 6 Nov 2025 21:09:32 +0530 Subject: [PATCH 1/6] Added a label to add last used date on each group --- groups/createElements.js | 30 +++++++++++++++++++++++++++++- groups/script.js | 7 +++++++ groups/style.css | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/groups/createElements.js b/groups/createElements.js index 18c7c8e6..fde7c971 100644 --- a/groups/createElements.js +++ b/groups/createElements.js @@ -27,6 +27,7 @@ const createCard = ( }

+

@@ -35,12 +36,39 @@ const createCard = (
`; - + if (group.isUpdating) cardElement.querySelector('.card__btn').classList.add('button--blocked'); cardElement.querySelector('.card__title').textContent = group.title; cardElement.querySelector('.card__description').textContent = group.description; + const lastUsedElement = cardElement.querySelector('.card__last-used'); + if (group.lastUsedOnMs) { + const shortFormatted = new Intl.DateTimeFormat('en-US', { + weekday: 'short', + year: 'numeric', + month: 'short', + day: 'numeric', + }).format(new Date(group.lastUsedOnMs)); + lastUsedElement.classList.add('tooltip-container'); + lastUsedElement.textContent = `Last used on: ${shortFormatted}`; + + const tooltip = document.createElement('span'); + tooltip.className = 'tooltip'; + tooltip.innerText = new Intl.DateTimeFormat('en-US', { + weekday: 'long', + year: 'numeric', + month: 'short', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + timeZoneName: 'short', + hour12: true, + }).format(new Date(group.lastUsedOnMs)); + lastUsedElement.appendChild(tooltip); + } else { + lastUsedElement.style.display = 'none'; + } cardElement.querySelector('.card__btn').textContent = group.isMember ? 'Remove me' : 'Add me'; diff --git a/groups/script.js b/groups/script.js index d4075405..9a11bcfe 100644 --- a/groups/script.js +++ b/groups/script.js @@ -196,6 +196,12 @@ const afterAuthentication = async () => { .split('-') .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) .join(' '); + const lastUsedOnMs = + group?.lastUsedOn?.seconds != null + ? group.lastUsedOn.seconds * 1000 + : group?.lastUsedOn?._seconds != null + ? group.lastUsedOn._seconds * 1000 + : undefined; acc[group.id] = { id: group.id, title: title, @@ -203,6 +209,7 @@ const afterAuthentication = async () => { isMember: group.isMember, roleId: group.roleid, description: group.description, + lastUsedOnMs, isUpdating: false, }; return acc; diff --git a/groups/style.css b/groups/style.css index 08c9a89e..962fb558 100644 --- a/groups/style.css +++ b/groups/style.css @@ -390,6 +390,39 @@ body { line-height: 18px; } +.card__last-used { + margin-top: 0.4rem; + color: var(--color-text-secondary); + font-weight: 400; + font-size: 0.75rem; +} + + +.tooltip-container { + position: relative; +} + +.tooltip { + background-color: var(--black-color, #000); + color: var(--white, #fff); + visibility: hidden; + text-align: center; + border-radius: 4px; + padding: 0.5rem; + position: absolute; + opacity: 0.9; + font-size: 0.7rem; + width: 10rem; + bottom: 100%; + left: 50%; + margin-left: -5rem; +} + +.tooltip-container:hover .tooltip { + visibility: visible; + transition-delay: 400ms; +} + .card__action { display: flex; justify-content: space-between; From 7be191ba0f56ee2226b7eb316673597964653753 Mon Sep 17 00:00:00 2001 From: JAHANWEE Date: Thu, 6 Nov 2025 23:34:15 +0530 Subject: [PATCH 2/6] feat(groups): add reusable date helpers and use them in group cards --- groups/createElements.js | 20 ++++---------------- groups/utils.js | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/groups/createElements.js b/groups/createElements.js index fde7c971..e87c2661 100644 --- a/groups/createElements.js +++ b/groups/createElements.js @@ -1,3 +1,5 @@ +import { fullDateString, shortDateString } from './utils.js'; + const createCard = ( rawGroup, onClick = () => {}, @@ -44,27 +46,13 @@ const createCard = ( group.description; const lastUsedElement = cardElement.querySelector('.card__last-used'); if (group.lastUsedOnMs) { - const shortFormatted = new Intl.DateTimeFormat('en-US', { - weekday: 'short', - year: 'numeric', - month: 'short', - day: 'numeric', - }).format(new Date(group.lastUsedOnMs)); + const shortFormatted = shortDateString(group.lastUsedOnMs); lastUsedElement.classList.add('tooltip-container'); lastUsedElement.textContent = `Last used on: ${shortFormatted}`; const tooltip = document.createElement('span'); tooltip.className = 'tooltip'; - tooltip.innerText = new Intl.DateTimeFormat('en-US', { - weekday: 'long', - year: 'numeric', - month: 'short', - day: 'numeric', - hour: 'numeric', - minute: 'numeric', - timeZoneName: 'short', - hour12: true, - }).format(new Date(group.lastUsedOnMs)); + tooltip.innerText = fullDateString(group.lastUsedOnMs); lastUsedElement.appendChild(tooltip); } else { lastUsedElement.style.display = 'none'; diff --git a/groups/utils.js b/groups/utils.js index f97112f4..e8aed5ba 100644 --- a/groups/utils.js +++ b/groups/utils.js @@ -178,6 +178,29 @@ function setParamValueInURL(paramKey, paramValue) { ); } +const fullDateString = (timestamp) => { + const options = { + weekday: 'long', + year: 'numeric', + month: 'short', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + timeZoneName: 'short', + hour12: true, + }; + return new Intl.DateTimeFormat('en-US', options).format(new Date(timestamp)); +}; + +const shortDateString = (timestamp) => { + const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; + const date = new Date(timestamp); + const day = daysOfWeek[date.getDay()]; + const year = date.getFullYear(); + const month = new Intl.DateTimeFormat('en-US', { month: 'short' }).format(date); + return `${day}, ${date.getDate()} ${month} ${year}`; +}; + export { getUserGroupRoles, getMembers, @@ -191,4 +214,6 @@ export { getDiscordGroupIdsFromSearch, getParamValueFromURL, setParamValueInURL, + fullDateString, + shortDateString, }; From 54719249a6f8521cf2ac376f505a79aeb7f715df Mon Sep 17 00:00:00 2001 From: JAHANWEE Date: Fri, 7 Nov 2025 01:00:56 +0530 Subject: [PATCH 3/6] test:label for groups page to display last used on date --- __tests__/groups/group.test.js | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/__tests__/groups/group.test.js b/__tests__/groups/group.test.js index 97f49624..dfee7ce0 100644 --- a/__tests__/groups/group.test.js +++ b/__tests__/groups/group.test.js @@ -422,4 +422,62 @@ describe('Discord Groups Page', () => { 'Group deleted successfully', ); }); + test('Should show last used label and tooltip when lastUsedOn is present', async () => { + await page.goto(`${LOCAL_TEST_PAGE_URL}/groups`); + await page.waitForNetworkIdle(); + + // Find a card where last-used is visible + const cardHandle = await page.evaluateHandle(() => { + const cards = Array.from(document.querySelectorAll('.card')); + return cards.find((card) => { + const el = card.querySelector('.card__last-used'); + return el && getComputedStyle(el).display !== 'none'; + }) || null; + }); + + expect(cardHandle).toBeTruthy(); + + // Read label text (exclude tooltip text inside) + const lastUsedText = await page.evaluate((card) => { + const el = card.querySelector('.card__last-used'); + if (!el) return ''; + const tooltip = el.querySelector('.tooltip'); + if (tooltip) { + // Remove tooltip text from overall textContent + const full = el.textContent.trim(); + const tip = tooltip.textContent.trim(); + return full.replace(tip, '').trim(); + } + // Fallback: take first text node only + const first = el.childNodes[0]; + if (first && first.nodeType === Node.TEXT_NODE) return first.textContent.trim(); + return el.textContent.trim(); + }, cardHandle); + + expect(lastUsedText).toMatch(/^Last used on: [A-Za-z]{3}, \d{1,2} [A-Za-z]{3} \d{4}$/); + + // Tooltip + const tooltipText = await page.evaluate((card) => { + const tip = card.querySelector('.card__last-used .tooltip'); + return tip ? tip.textContent.trim() : ''; + }, cardHandle); + + expect(tooltipText.length).toBeGreaterThan(0); + }); + + test('Should hide last used label when lastUsedOn is absent', async () => { + await page.goto(`${LOCAL_TEST_PAGE_URL}/groups`); + await page.waitForNetworkIdle(); + + // Find a card where last-used is hidden + const isAnyHidden = await page.evaluate(() => { + const cards = Array.from(document.querySelectorAll('.card')); + return cards.some((card) => { + const el = card.querySelector('.card__last-used'); + return el && getComputedStyle(el).display === 'none'; + }); + }); + + expect(isAnyHidden).toBe(true); + }); }); From 7cfb954b31a64e1564ca912455226550b7846fb4 Mon Sep 17 00:00:00 2001 From: JAHANWEE Date: Wed, 12 Nov 2025 04:44:44 +0530 Subject: [PATCH 4/6] added new date format without weekday in shortDate being displayed --- __tests__/groups/group.test.js | 15 +++++++++------ groups/utils.js | 23 ++++++++++++++++++----- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/__tests__/groups/group.test.js b/__tests__/groups/group.test.js index dfee7ce0..91e38a6a 100644 --- a/__tests__/groups/group.test.js +++ b/__tests__/groups/group.test.js @@ -429,10 +429,12 @@ describe('Discord Groups Page', () => { // Find a card where last-used is visible const cardHandle = await page.evaluateHandle(() => { const cards = Array.from(document.querySelectorAll('.card')); - return cards.find((card) => { - const el = card.querySelector('.card__last-used'); - return el && getComputedStyle(el).display !== 'none'; - }) || null; + return ( + cards.find((card) => { + const el = card.querySelector('.card__last-used'); + return el && getComputedStyle(el).display !== 'none'; + }) || null + ); }); expect(cardHandle).toBeTruthy(); @@ -450,11 +452,12 @@ describe('Discord Groups Page', () => { } // Fallback: take first text node only const first = el.childNodes[0]; - if (first && first.nodeType === Node.TEXT_NODE) return first.textContent.trim(); + if (first && first.nodeType === Node.TEXT_NODE) + return first.textContent.trim(); return el.textContent.trim(); }, cardHandle); - expect(lastUsedText).toMatch(/^Last used on: [A-Za-z]{3}, \d{1,2} [A-Za-z]{3} \d{4}$/); + expect(lastUsedText).toMatch(/^Last used on: \d{1,2} [A-Za-z]{3} \d{4}$/); // Tooltip const tooltipText = await page.evaluate((card) => { diff --git a/groups/utils.js b/groups/utils.js index e8aed5ba..2c218bef 100644 --- a/groups/utils.js +++ b/groups/utils.js @@ -179,6 +179,13 @@ function setParamValueInURL(paramKey, paramValue) { } const fullDateString = (timestamp) => { + if (typeof timestamp !== 'number' || !Number.isFinite(timestamp)) { + return 'N/A'; + } + const dateObj = new Date(timestamp); + if (isNaN(dateObj.getTime())) { + return 'N/A'; + } const options = { weekday: 'long', year: 'numeric', @@ -189,16 +196,22 @@ const fullDateString = (timestamp) => { timeZoneName: 'short', hour12: true, }; - return new Intl.DateTimeFormat('en-US', options).format(new Date(timestamp)); + return new Intl.DateTimeFormat('en-US', options).format(dateObj); }; const shortDateString = (timestamp) => { - const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; + if (typeof timestamp !== 'number' || !Number.isFinite(timestamp)) { + return 'N/A'; + } const date = new Date(timestamp); - const day = daysOfWeek[date.getDay()]; + if (isNaN(date.getTime())) { + return 'N/A'; + } const year = date.getFullYear(); - const month = new Intl.DateTimeFormat('en-US', { month: 'short' }).format(date); - return `${day}, ${date.getDate()} ${month} ${year}`; + const month = new Intl.DateTimeFormat('en-US', { month: 'short' }).format( + date, + ); + return `${date.getDate()} ${month} ${year}`; }; export { From 35bc755bfd9b178d4a7c74a6b168c25541a5075c Mon Sep 17 00:00:00 2001 From: JAHANWEE Date: Wed, 12 Nov 2025 21:35:48 +0530 Subject: [PATCH 5/6] chore:added tests for function fullDateString and shortDateString and fixed:Inconsistent null checking in timestamp conversion --- __tests__/groups/group.test.js | 52 ++++++++++++++++++++++++++++++++++ groups/createElements.js | 8 +++--- groups/script.js | 10 +++---- 3 files changed, 61 insertions(+), 9 deletions(-) diff --git a/__tests__/groups/group.test.js b/__tests__/groups/group.test.js index 91e38a6a..0aa40d54 100644 --- a/__tests__/groups/group.test.js +++ b/__tests__/groups/group.test.js @@ -483,4 +483,56 @@ describe('Discord Groups Page', () => { expect(isAnyHidden).toBe(true); }); + + test('fullDateString should return correctly formatted string and N/A for invalid inputs', async () => { + const result = await page.evaluate(async () => { + const mod = await import('/groups/utils.js'); + const ts = Date.UTC(2024, 10, 6, 10, 15); + const formatted = mod.fullDateString(ts); + const options = { + weekday: 'long', + year: 'numeric', + month: 'short', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + timeZoneName: 'short', + hour12: true, + }; + const expected = new Intl.DateTimeFormat('en-US', options).format( + new Date(ts), + ); + const invalidString = mod.fullDateString('abc'); + const invalidNaN = mod.fullDateString(NaN); + const invalidObj = mod.fullDateString({}); + return { formatted, expected, invalidString, invalidNaN, invalidObj }; + }); + + expect(result.formatted).toBe(result.expected); + expect(result.invalidString).toBe('N/A'); + expect(result.invalidNaN).toBe('N/A'); + expect(result.invalidObj).toBe('N/A'); + }); + + test('shortDateString should return correctly formatted string and N/A for invalid inputs', async () => { + const result = await page.evaluate(async () => { + const mod = await import('/groups/utils.js'); + const ts = Date.UTC(2024, 10, 6, 10, 15); + const formatted = mod.shortDateString(ts); + const d = new Date(ts); + const month = new Intl.DateTimeFormat('en-US', { month: 'short' }).format( + d, + ); + const expected = `${d.getDate()} ${month} ${d.getFullYear()}`; + const invalidUndef = mod.shortDateString(undefined); + const invalidStr = mod.shortDateString('bad'); + const invalidNaN = mod.shortDateString(NaN); + return { formatted, expected, invalidUndef, invalidStr, invalidNaN }; + }); + + expect(result.formatted).toBe(result.expected); + expect(result.invalidUndef).toBe('N/A'); + expect(result.invalidStr).toBe('N/A'); + expect(result.invalidNaN).toBe('N/A'); + }); }); diff --git a/groups/createElements.js b/groups/createElements.js index e87c2661..f13c6b23 100644 --- a/groups/createElements.js +++ b/groups/createElements.js @@ -38,21 +38,21 @@ const createCard = ( `; - + if (group.isUpdating) cardElement.querySelector('.card__btn').classList.add('button--blocked'); cardElement.querySelector('.card__title').textContent = group.title; cardElement.querySelector('.card__description').textContent = group.description; const lastUsedElement = cardElement.querySelector('.card__last-used'); - if (group.lastUsedOnMs) { - const shortFormatted = shortDateString(group.lastUsedOnMs); + if (group.lastUsedTimestamp) { + const shortFormatted = shortDateString(group.lastUsedTimestamp); lastUsedElement.classList.add('tooltip-container'); lastUsedElement.textContent = `Last used on: ${shortFormatted}`; const tooltip = document.createElement('span'); tooltip.className = 'tooltip'; - tooltip.innerText = fullDateString(group.lastUsedOnMs); + tooltip.innerText = fullDateString(group.lastUsedTimestamp); lastUsedElement.appendChild(tooltip); } else { lastUsedElement.style.display = 'none'; diff --git a/groups/script.js b/groups/script.js index 9a11bcfe..72d4672b 100644 --- a/groups/script.js +++ b/groups/script.js @@ -196,12 +196,12 @@ const afterAuthentication = async () => { .split('-') .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) .join(' '); - const lastUsedOnMs = - group?.lastUsedOn?.seconds != null + const lastUsedTimestamp = + group?.lastUsedOn?.seconds !== undefined ? group.lastUsedOn.seconds * 1000 - : group?.lastUsedOn?._seconds != null + : group?.lastUsedOn?._seconds !== undefined ? group.lastUsedOn._seconds * 1000 - : undefined; + : undefined; acc[group.id] = { id: group.id, title: title, @@ -209,7 +209,7 @@ const afterAuthentication = async () => { isMember: group.isMember, roleId: group.roleid, description: group.description, - lastUsedOnMs, + lastUsedTimestamp, isUpdating: false, }; return acc; From 140c61f31bc1c845d25ed05492df6976bb894463 Mon Sep 17 00:00:00 2001 From: JAHANWEE Date: Thu, 13 Nov 2025 04:10:39 +0530 Subject: [PATCH 6/6] fix:improved variable naming conventions and fixed changes --- __tests__/groups/group.test.js | 146 ++++++++++++++++++--------------- groups/style.css | 2 - 2 files changed, 79 insertions(+), 69 deletions(-) diff --git a/__tests__/groups/group.test.js b/__tests__/groups/group.test.js index 0aa40d54..440494dd 100644 --- a/__tests__/groups/group.test.js +++ b/__tests__/groups/group.test.js @@ -21,6 +21,19 @@ describe('Discord Groups Page', () => { let page; jest.setTimeout(60000); + // Shared constants for date formatting tests + const TEST_TIMESTAMP = Date.UTC(2024, 10, 6, 10, 15); + const FULL_DATE_FORMAT_OPTIONS = { + weekday: 'long', + year: 'numeric', + month: 'short', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + timeZoneName: 'short', + hour12: true, + }; + beforeAll(async () => { browser = await puppeteer.launch({ headless: 'new', @@ -422,12 +435,11 @@ describe('Discord Groups Page', () => { 'Group deleted successfully', ); }); - test('Should show last used label and tooltip when lastUsedOn is present', async () => { + test('Should display last used label and tooltip when lastUsedOn is present', async () => { await page.goto(`${LOCAL_TEST_PAGE_URL}/groups`); await page.waitForNetworkIdle(); - // Find a card where last-used is visible - const cardHandle = await page.evaluateHandle(() => { + const groupCardHandle = await page.evaluateHandle(() => { const cards = Array.from(document.querySelectorAll('.card')); return ( cards.find((card) => { @@ -437,33 +449,29 @@ describe('Discord Groups Page', () => { ); }); - expect(cardHandle).toBeTruthy(); + expect(groupCardHandle).toBeTruthy(); - // Read label text (exclude tooltip text inside) const lastUsedText = await page.evaluate((card) => { const el = card.querySelector('.card__last-used'); if (!el) return ''; - const tooltip = el.querySelector('.tooltip'); - if (tooltip) { - // Remove tooltip text from overall textContent - const full = el.textContent.trim(); - const tip = tooltip.textContent.trim(); - return full.replace(tip, '').trim(); + const tooltipElement = el.querySelector('.tooltip'); + if (tooltipElement) { + const fullText = el.textContent.trim(); + const tooltipText = tooltipElement.textContent.trim(); + return fullText.replace(tooltipText, '').trim(); } - // Fallback: take first text node only - const first = el.childNodes[0]; - if (first && first.nodeType === Node.TEXT_NODE) - return first.textContent.trim(); + const firstChildNode = el.childNodes[0]; + if (firstChildNode && firstChildNode.nodeType === Node.TEXT_NODE) + return firstChildNode.textContent.trim(); return el.textContent.trim(); - }, cardHandle); + }, groupCardHandle); expect(lastUsedText).toMatch(/^Last used on: \d{1,2} [A-Za-z]{3} \d{4}$/); - // Tooltip const tooltipText = await page.evaluate((card) => { - const tip = card.querySelector('.card__last-used .tooltip'); - return tip ? tip.textContent.trim() : ''; - }, cardHandle); + const tooltipElement = card.querySelector('.card__last-used .tooltip'); + return tooltipElement ? tooltipElement.textContent.trim() : ''; + }, groupCardHandle); expect(tooltipText.length).toBeGreaterThan(0); }); @@ -472,8 +480,7 @@ describe('Discord Groups Page', () => { await page.goto(`${LOCAL_TEST_PAGE_URL}/groups`); await page.waitForNetworkIdle(); - // Find a card where last-used is hidden - const isAnyHidden = await page.evaluate(() => { + const isAnyCardHidden = await page.evaluate(() => { const cards = Array.from(document.querySelectorAll('.card')); return cards.some((card) => { const el = card.querySelector('.card__last-used'); @@ -481,58 +488,63 @@ describe('Discord Groups Page', () => { }); }); - expect(isAnyHidden).toBe(true); + expect(isAnyCardHidden).toBe(true); }); - test('fullDateString should return correctly formatted string and N/A for invalid inputs', async () => { - const result = await page.evaluate(async () => { - const mod = await import('/groups/utils.js'); - const ts = Date.UTC(2024, 10, 6, 10, 15); - const formatted = mod.fullDateString(ts); - const options = { - weekday: 'long', - year: 'numeric', - month: 'short', - day: 'numeric', - hour: 'numeric', - minute: 'numeric', - timeZoneName: 'short', - hour12: true, - }; - const expected = new Intl.DateTimeFormat('en-US', options).format( - new Date(ts), - ); - const invalidString = mod.fullDateString('abc'); - const invalidNaN = mod.fullDateString(NaN); - const invalidObj = mod.fullDateString({}); - return { formatted, expected, invalidString, invalidNaN, invalidObj }; - }); + test('Should return correctly formatted full date string and N/A for invalid inputs', async () => { + const evaluationResult = await page.evaluate( + async (timestamp, fullDateFormatOptions) => { + const utilsModule = await import('/groups/utils.js'); + const formatted = utilsModule.fullDateString(timestamp); + const expected = new Intl.DateTimeFormat( + 'en-US', + fullDateFormatOptions, + ).format(new Date(timestamp)); + const invalidString = utilsModule.fullDateString('abc'); + const invalidNotANumber = utilsModule.fullDateString(NaN); + const invalidObject = utilsModule.fullDateString({}); + return { + formatted, + expected, + invalidString, + invalidNotANumber, + invalidObject, + }; + }, + TEST_TIMESTAMP, + FULL_DATE_FORMAT_OPTIONS, + ); - expect(result.formatted).toBe(result.expected); - expect(result.invalidString).toBe('N/A'); - expect(result.invalidNaN).toBe('N/A'); - expect(result.invalidObj).toBe('N/A'); + expect(evaluationResult.formatted).toBe(evaluationResult.expected); + expect(evaluationResult.invalidString).toBe('N/A'); + expect(evaluationResult.invalidNotANumber).toBe('N/A'); + expect(evaluationResult.invalidObject).toBe('N/A'); }); - test('shortDateString should return correctly formatted string and N/A for invalid inputs', async () => { - const result = await page.evaluate(async () => { - const mod = await import('/groups/utils.js'); - const ts = Date.UTC(2024, 10, 6, 10, 15); - const formatted = mod.shortDateString(ts); - const d = new Date(ts); + test('Should return correctly formatted short date string and N/A for invalid inputs', async () => { + const evaluationResult = await page.evaluate(async (timestamp) => { + const utilsModule = await import('/groups/utils.js'); + const formatted = utilsModule.shortDateString(timestamp); + const dateInstance = new Date(timestamp); const month = new Intl.DateTimeFormat('en-US', { month: 'short' }).format( - d, + dateInstance, ); - const expected = `${d.getDate()} ${month} ${d.getFullYear()}`; - const invalidUndef = mod.shortDateString(undefined); - const invalidStr = mod.shortDateString('bad'); - const invalidNaN = mod.shortDateString(NaN); - return { formatted, expected, invalidUndef, invalidStr, invalidNaN }; - }); + const expected = `${dateInstance.getDate()} ${month} ${dateInstance.getFullYear()}`; + const invalidUndefined = utilsModule.shortDateString(undefined); + const invalidStringInput = utilsModule.shortDateString('bad'); + const invalidNotANumber = utilsModule.shortDateString(NaN); + return { + formatted, + expected, + invalidUndefined, + invalidStringInput, + invalidNotANumber, + }; + }, TEST_TIMESTAMP); - expect(result.formatted).toBe(result.expected); - expect(result.invalidUndef).toBe('N/A'); - expect(result.invalidStr).toBe('N/A'); - expect(result.invalidNaN).toBe('N/A'); + expect(evaluationResult.formatted).toBe(evaluationResult.expected); + expect(evaluationResult.invalidUndefined).toBe('N/A'); + expect(evaluationResult.invalidStringInput).toBe('N/A'); + expect(evaluationResult.invalidNotANumber).toBe('N/A'); }); }); diff --git a/groups/style.css b/groups/style.css index 962fb558..e5f05613 100644 --- a/groups/style.css +++ b/groups/style.css @@ -393,11 +393,9 @@ body { .card__last-used { margin-top: 0.4rem; color: var(--color-text-secondary); - font-weight: 400; font-size: 0.75rem; } - .tooltip-container { position: relative; }