aboutsummaryrefslogtreecommitdiff
path: root/test/styles
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-06-13 11:52:30 +0100
committerMichael Williamson <mike@zwobble.org>2024-06-13 11:52:30 +0100
commit66c9ef99816708cb1ffedd3ec37e5622bf823c20 (patch)
tree10e640bcda8b6ecd92a7486a9d700366cf40f239 /test/styles
parent700e395a3d2a0c9f6526fe7c69a92bd347fa1b88 (diff)
Support style mapping for highlights
Diffstat (limited to 'test/styles')
-rw-r--r--test/styles/document-matchers.tests.js20
1 files changed, 20 insertions, 0 deletions
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});
}