aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-11-28 16:34:20 +0000
committerMichael Williamson <mike@zwobble.org>2016-11-28 16:34:20 +0000
commitb6eabe382e59235192691b5bf04a172ce333ec24 (patch)
treee15d80da7905a4f4e2eeba6b7a738c5ec4d8d6e8 /src/test/java
parentdc6e1277e8255a37727951b78ba5c8fd52de12ed (diff)
Add parsing for break style mappings
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMapParserTests.java23
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()));