From d3a259e3e2d9ff17f2152eeae55e32d7cea09fed Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 13 Jun 2024 12:31:25 +0100 Subject: [PATCH] Add missing tests for document matcher parsing --- .../parsing/DocumentMatcherParsingTests.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) 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 2c86e7e9..1af4a86b 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 @@ -99,6 +99,54 @@ public void readsTableWithStyleName() { hasTableMatcher(TableMatcher.styleName("Normal Table"))); } + @Test + public void readsBold() { + assertThat( + parseDocumentMatcher("b"), + deepEquals(new StyleMapBuilder().bold(HTML_PATH).build()) + ); + } + + @Test + public void readsItalic() { + assertThat( + parseDocumentMatcher("i"), + deepEquals(new StyleMapBuilder().italic(HTML_PATH).build()) + ); + } + + @Test + public void readsUnderline() { + assertThat( + parseDocumentMatcher("u"), + deepEquals(new StyleMapBuilder().underline(HTML_PATH).build()) + ); + } + + @Test + public void readsStrikethrough() { + assertThat( + parseDocumentMatcher("strike"), + deepEquals(new StyleMapBuilder().strikethrough(HTML_PATH).build()) + ); + } + + @Test + public void readsAllCaps() { + assertThat( + parseDocumentMatcher("all-caps"), + deepEquals(new StyleMapBuilder().allCaps(HTML_PATH).build()) + ); + } + + @Test + public void readsSmallCaps() { + assertThat( + parseDocumentMatcher("small-caps"), + deepEquals(new StyleMapBuilder().smallCaps(HTML_PATH).build()) + ); + } + private static final HtmlPath HTML_PATH = HtmlPath.element("placeholder"); private StyleMap parseDocumentMatcher(String input) {