diff --git a/src/_shared/utils/applyApTitleCase.test.ts b/src/_shared/utils/applyApTitleCase.test.ts index 5ab276447..a158e4183 100644 --- a/src/_shared/utils/applyApTitleCase.test.ts +++ b/src/_shared/utils/applyApTitleCase.test.ts @@ -82,7 +82,7 @@ describe('applyApTitleCase', () => { }); }); - it('words after curly apostrophes should be uppercase', () => { + it('words after double apostrophes should be uppercase', () => { const sentencesWithApostrophe = [ { result: @@ -90,18 +90,6 @@ describe('applyApTitleCase', () => { expected: '“Integrated Thriving” Can Fix Unhelpful Buzz Words Like “Girlboss” and “Snail Girl”', }, - { - result: - '‘Integrated thriving’ can fix unhelpful buzz words like ‘girlboss’ and ‘snail girl’', - expected: - '‘Integrated Thriving’ Can Fix Unhelpful Buzz Words Like ‘Girlboss’ and ‘Snail Girl’', - }, - { - result: - "'Integrated thriving' can fix unhelpful buzz words like 'girlboss' and 'snail girl'", - expected: - "'Integrated Thriving' Can Fix Unhelpful Buzz Words Like 'Girlboss' and 'Snail Girl'", - }, { result: '"Integrated thriving" can fix unhelpful buzz words like "girlboss" and "snail girl"', @@ -113,4 +101,16 @@ describe('applyApTitleCase', () => { expect(applyApTitleCase(swa.result)).toEqual(swa.expected); }); }); + + it('contractions should be properly uppercase', () => { + const sentencesWithContractions = [ + { + result: "Here's what you haven't noticed", + expected: "Here's What You Haven't Noticed", + }, + ]; + sentencesWithContractions.forEach((swc) => { + expect(applyApTitleCase(swc.result)).toEqual(swc.expected); + }); + }); }); diff --git a/src/_shared/utils/applyApTitleCase.ts b/src/_shared/utils/applyApTitleCase.ts index 53d4b5f1a..9389bf30b 100644 --- a/src/_shared/utils/applyApTitleCase.ts +++ b/src/_shared/utils/applyApTitleCase.ts @@ -1,7 +1,7 @@ export const STOP_WORDS = 'a an and at but by for in nor of on or so the to up yet'; -export const SEPARATORS = /(\s+|[-‑–—,:;!?()“”‘’'"])/; +export const SEPARATORS = /(\s+|[-‑–—,:;!?()“”"])/; export const stop = STOP_WORDS.split(' ');