aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-06-13 12:40:05 +0100
committerMichael Williamson <mike@zwobble.org>2024-06-13 12:40:05 +0100
commita26168d0c52aeec2dfbe6fffc1531219b4dcd199 (patch)
tree7c05f0aa545ded685c08361f147573c5ac2616cd /src/test/java
parentd3a259e3e2d9ff17f2152eeae55e32d7cea09fed (diff)
Parse highlight matchers
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java
index 1af4a86..7c39e78 100644
--- a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java
+++ b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java
@@ -8,6 +8,8 @@ import org.zwobble.mammoth.internal.styles.parsing.StyleMappingTokeniser;
import org.zwobble.mammoth.internal.styles.parsing.TokenIterator;
import org.zwobble.mammoth.internal.styles.parsing.TokenType;
+import java.util.Optional;
+
import static org.hamcrest.MatcherAssert.assertThat;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;
@@ -147,6 +149,30 @@ public class DocumentMatcherParsingTests {
);
}
+ @Test
+ public void readsHighlightWithoutColor() {
+ assertThat(
+ parseDocumentMatcher("highlight"),
+ deepEquals(
+ new StyleMapBuilder()
+ .mapHighlight(new HighlightMatcher(Optional.empty()), HTML_PATH)
+ .build()
+ )
+ );
+ }
+
+ @Test
+ public void readsHighlightWithColor() {
+ assertThat(
+ parseDocumentMatcher("highlight[color='yellow']"),
+ deepEquals(
+ new StyleMapBuilder()
+ .mapHighlight(new HighlightMatcher(Optional.of("yellow")), HTML_PATH)
+ .build()
+ )
+ );
+ }
+
private static final HtmlPath HTML_PATH = HtmlPath.element("placeholder");
private StyleMap parseDocumentMatcher(String input) {