From 0f8e93fdd00251a5c8f2d1fd25d74d82fe682087 Mon Sep 17 00:00:00 2001 From: A Cottrill Date: Thu, 25 Apr 2024 13:40:58 -0400 Subject: [PATCH] chore: create an test involving quotes --- lib/__fixtures__/curriculum-helpers-html.ts | 7 +++++++ lib/__tests__/curriculum-helper.test.ts | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/__fixtures__/curriculum-helpers-html.ts b/lib/__fixtures__/curriculum-helpers-html.ts index 8981cf4..a48ec78 100644 --- a/lib/__fixtures__/curriculum-helpers-html.ts +++ b/lib/__fixtures__/curriculum-helpers-html.ts @@ -22,9 +22,16 @@ not a comment not a comment `; +const commentInQuoteExample = ` +The string "", or "--!>", nor end with the string "". +`; + const testValues = { htmlFullExample, htmlCodeWithCommentsRemoved, + commentInQuoteExample, }; export default testValues; diff --git a/lib/__tests__/curriculum-helper.test.ts b/lib/__tests__/curriculum-helper.test.ts index 4c813cc..e0ac88d 100644 --- a/lib/__tests__/curriculum-helper.test.ts +++ b/lib/__tests__/curriculum-helper.test.ts @@ -9,7 +9,8 @@ const { stringWithWhiteSpaceChars, stringWithWhiteSpaceCharsRemoved } = const { cssFullExample, cssCodeWithCommentsRemoved } = cssTestValues; -const { htmlFullExample, htmlCodeWithCommentsRemoved } = htmlTestValues; +const { htmlFullExample, htmlCodeWithCommentsRemoved, commentInQuoteExample } = + htmlTestValues; const { jsCodeWithSingleAndMultLineComments, @@ -87,6 +88,12 @@ describe("removeHtmlComments", () => { htmlCodeWithCommentsRemoved ); }); + + it("returns an HTML string with comments inside quotes intact", function () { + expect(removeHtmlComments(commentInQuoteExample)).toBe( + commentInQuoteExample + ); + }); }); describe("isCalledWithNoArgs", () => {