From e7e170aded92aa2165384e8a1f7492ea49180f40 Mon Sep 17 00:00:00 2001 From: Nisemono Date: Wed, 6 Dec 2023 00:16:00 +0800 Subject: [PATCH] One more tc --- .../unit/lib/markdown-it/highlight/HightlightRule.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/test/unit/lib/markdown-it/highlight/HightlightRule.test.ts b/packages/core/test/unit/lib/markdown-it/highlight/HightlightRule.test.ts index 3323b4b74c..e8038c5b40 100644 --- a/packages/core/test/unit/lib/markdown-it/highlight/HightlightRule.test.ts +++ b/packages/core/test/unit/lib/markdown-it/highlight/HightlightRule.test.ts @@ -60,12 +60,13 @@ describe('shouldApplyHighlight', () => { describe('getHighlightType', () => { const rules = HighlightRule.parseAllRules( - '3,4[1:5],1[:]-2, 6-8', 0, 'line1\nline2\nline3\nline4\nline5\nline6\nline7\nline8', + '3,4[1:5],1[:]-2,6-8,9[:]', 0, 'line1\nline2\nline3\nline4\nline5\nline6\nline7\nline8\nline9', ); const wholeTextRule = rules[0]; const partialTextRule = rules[1]; const wholeLinesRule = rules[2]; const wholeTextsRule = rules[3]; + const wholeLineRule = rules[4]; test('returns WholeLine for two lines', () => { expect(wholeLinesRule.getHighlightType(1).highlightType).toBe(HIGHLIGHT_TYPES.WholeLine); @@ -81,6 +82,10 @@ describe('getHighlightType', () => { expect(highlightType).toBe(HIGHLIGHT_TYPES.WholeText); }); + test('returns WholeLine for single line', () => { + expect(wholeLineRule.getHighlightType(9).highlightType).toBe(HIGHLIGHT_TYPES.WholeLine); + }); + test('returns PartialText for bounded slice', () => { const { highlightType, bounds } = partialTextRule.getHighlightType(4); expect(highlightType).toBe(HIGHLIGHT_TYPES.PartialText);