From 66c9ef99816708cb1ffedd3ec37e5622bf823c20 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 13 Jun 2024 11:52:30 +0100 Subject: Support style mapping for highlights --- test/styles/document-matchers.tests.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/styles') diff --git a/test/styles/document-matchers.tests.js b/test/styles/document-matchers.tests.js index 5ce3f72..63a00a8 100644 --- a/test/styles/document-matchers.tests.js +++ b/test/styles/document-matchers.tests.js @@ -45,6 +45,26 @@ test("matchers for lists with index 0 do not match elements that are not lists", assert.ok(!matcher.matches(new Paragraph())); }); +test("highlight matcher does not match non-highlight elements", function() { + var matcher = documentMatchers.highlight(); + assert.ok(!matcher.matches(new Paragraph())); +}); + +test("highlight matcher without color matches all highlight elements", function() { + var matcher = documentMatchers.highlight({}); + assert.ok(matcher.matches({type: "highlight", color: "yellow"})); +}); + +test("highlight matcher with color matches highlight with that color", function() { + var matcher = documentMatchers.highlight({color: "yellow"}); + assert.ok(matcher.matches({type: "highlight", color: "yellow"})); +}); + +test("highlight matcher with color does not match highlights with other colors", function() { + var matcher = documentMatchers.highlight({color: "yellow"}); + assert.ok(!matcher.matches({type: "highlight", color: "red"})); +}); + function paragraphWithStyle(styleId, styleName) { return new Paragraph([], {styleId: styleId, styleName: styleName}); } -- cgit v1.2.3