diff --git a/src/services/utils.spec.ts b/src/services/utils.spec.ts index 49adcc0f4..0b54d6d95 100644 --- a/src/services/utils.spec.ts +++ b/src/services/utils.spec.ts @@ -91,7 +91,28 @@ describe.todo("#unescapeHtml", () => {}); describe.todo("#toObject", () => {}); -describe.todo("#stripTags", () => {}); +describe("#stripTags", () => { + + //pre + const htmlWithNewlines = +`

abc +def

+

ghi

`; + + const testCases: TestCase[] = [ + ["should strip all tags and only return the content, leaving new lines and spaces in tact", [htmlWithNewlines], "abc\ndef\nghi"], + //TriliumNextTODO: should this actually insert a space between content to prevent concatenated text? + ["should strip all tags and only return the content", ["

abc

def

"], "abcdef"], + ]; + + testCases.forEach(testCase => { + const [desc, fnParams, expected] = testCase; + it(desc, () => { + const result = utils.stripTags(...fnParams); + expect(result).toStrictEqual(expected); + }) + }); +}); describe.todo("#union", () => {});