From 4f99bbace9e1e315daf74588c61585c2a48cbd4d Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Wed, 16 Mar 2022 17:52:30 -0400 Subject: [PATCH] fix tests --- .../format-date/format-date.test.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/format-date/format-date.test.ts b/src/components/format-date/format-date.test.ts index b0dfc3306..a7e95a7bf 100644 --- a/src/components/format-date/format-date.test.ts +++ b/src/components/format-date/format-date.test.ts @@ -56,7 +56,7 @@ describe('', () => { ` ); - expect(el.shadowRoot?.textContent).to.equal(setup.result); + expect(el.shadowRoot?.textContent?.trim()).to.equal(setup.result); }); }); }); @@ -77,7 +77,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { weekday: weekdayFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -95,7 +95,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { era: eraFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -113,7 +113,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { year: yearFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -131,7 +131,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { month: monthFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -149,7 +149,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { day: dayFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -167,7 +167,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { hour: hourFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -188,7 +188,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { minute: minuteFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -209,7 +209,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { second: secondFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -230,7 +230,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { timeZoneName: timeZoneNameFormat }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -251,7 +251,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { timeZone: timeZone }).format( new Date(new Date().getFullYear(), 0, 1) ); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); }); @@ -272,7 +272,7 @@ describe('', () => { const expected = new Intl.DateTimeFormat('en-US', { hour12: hourFormatValue === 'auto' ? undefined : hourFormatValue === '12' }).format(new Date(new Date().getFullYear(), 0, 1)); - expect(el.shadowRoot?.textContent).to.equal(expected); + expect(el.shadowRoot?.textContent?.trim()).to.equal(expected); }); }); });