diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-02-20 15:02:54 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-02-20 15:02:54 +0000 |
| commit | a506a6d3679c282cfd3a2f0257f5859d420feb22 (patch) | |
| tree | fea7aa22d6012abb8a14bc5da1abf8c7c9a7b692 /src/test | |
| parent | 969f585f87b4da456a30c99e3e988152fdca96fe (diff) | |
Allow paragraph matchers by style name
Diffstat (limited to 'src/test')
| -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"))))); } |
