diff options
Diffstat (limited to 'src/test/java/org')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMapParserTests.java | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMapParserTests.java b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMapParserTests.java index d6205cd..5456cb8 100644 --- a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMapParserTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMapParserTests.java @@ -1,10 +1,7 @@ package org.zwobble.mammoth.tests.styles.parsing; import org.junit.Test; -import org.zwobble.mammoth.internal.styles.HtmlPath; -import org.zwobble.mammoth.internal.styles.ParagraphMatcher; -import org.zwobble.mammoth.internal.styles.RunMatcher; -import org.zwobble.mammoth.internal.styles.StyleMap; +import org.zwobble.mammoth.internal.styles.*; import org.zwobble.mammoth.internal.styles.parsing.StyleMapParser; import static org.hamcrest.MatcherAssert.assertThat; @@ -60,6 +57,24 @@ public class StyleMapParserTests { } @Test + public void canMapLineBreaks() { + StyleMap styleMap = StyleMapParser.parse("br[type='line'] => div"); + StyleMap expectedStyleMap = StyleMap.builder() + .mapBreak(BreakMatcher.LINE_BREAK, HtmlPath.collapsibleElement("div")) + .build(); + assertThat(styleMap, deepEquals(expectedStyleMap)); + } + + @Test + public void canMapPageBreaks() { + StyleMap styleMap = StyleMapParser.parse("br[type='page'] => div"); + StyleMap expectedStyleMap = StyleMap.builder() + .mapBreak(BreakMatcher.PAGE_BREAK, HtmlPath.collapsibleElement("div")) + .build(); + assertThat(styleMap, deepEquals(expectedStyleMap)); + } + + @Test public void blankLinesAreIgnored() { StyleMap styleMap = StyleMapParser.parse("\n\n \n\np =>\n\r\n"); assertThat(styleMap, deepEquals(StyleMap.builder().mapParagraph(ParagraphMatcher.ANY, HtmlPath.EMPTY).build())); |
