diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java index 771431f..338776e 100644 --- a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java @@ -6,6 +6,7 @@ import org.zwobble.mammoth.documents.*; import org.zwobble.mammoth.html.Html; import org.zwobble.mammoth.html.HtmlNode; import org.zwobble.mammoth.styles.HtmlPath; +import org.zwobble.mammoth.styles.ParagraphMatcher; import org.zwobble.mammoth.styles.StyleMap; import java.io.ByteArrayInputStream; @@ -56,7 +57,25 @@ public class DocumentConverterTests { assertThat( convertToHtml( make(a(PARAGRAPH, with(STYLE, Optional.of(new Style("TipsParagraph", Optional.empty()))))), - StyleMap.builder().mapParagraph("TipsParagraph", HtmlPath.element("p", map("class", "tip"))).build()), + StyleMap.builder() + .mapParagraph( + ParagraphMatcher.styleId("TipsParagraph"), + HtmlPath.element("p", map("class", "tip"))) + .build()), + + deepEquals(list(Html.element("p", map("class", "tip"))))); + } + + @Test + public void styleMappingsUsingStyleNamesCanBeUsedToMapParagraphs() { + assertThat( + convertToHtml( + make(a(PARAGRAPH, with(STYLE, Optional.of(new Style("TipsParagraph", Optional.of("Tips Paragraph")))))), + StyleMap.builder() + .mapParagraph( + ParagraphMatcher.styleName("Tips Paragraph"), + HtmlPath.element("p", map("class", "tip"))) + .build()), deepEquals(list(Html.element("p", map("class", "tip"))))); } |
