aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-20 14:20:40 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-20 14:20:40 +0000
commitbba2f4d95240ea3569e253609e95cc94c5c8ef13 (patch)
tree1a510988da0f17f4a3222a0b2f62de4b2f1cf641 /src/test/java/org/zwobble/mammoth
parenta3eb5f0c3ee50afafc517c4a7e36501539489178 (diff)
Add strikethrough to style map
Diffstat (limited to 'src/test/java/org/zwobble/mammoth')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java
index fd1402f..f81962b 100644
--- a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java
+++ b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java
@@ -6,7 +6,6 @@ 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.HtmlPathElement;
import org.zwobble.mammoth.styles.StyleMap;
import java.io.ByteArrayInputStream;
@@ -15,9 +14,7 @@ import java.util.Optional;
import static com.natpryce.makeiteasy.MakeItEasy.*;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.hasEntry;
-import static org.hamcrest.Matchers.hasProperty;
+import static org.hamcrest.Matchers.*;
import static org.zwobble.mammoth.documents.VerticalAlignment.SUBSCRIPT;
import static org.zwobble.mammoth.documents.VerticalAlignment.SUPERSCRIPT;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;
@@ -80,7 +77,8 @@ public class DocumentConverterTests {
assertThat(
convertToHtml(
make(a(RUN, with(UNDERLINE, true), with(CHILDREN, list(new Text("Hello"))))),
- new StyleMap(new HtmlPath(list(new HtmlPathElement("em"))))),
+ StyleMap.builder().underline(HtmlPath.element("em")).build()),
+
deepEquals(list(Html.element("em", list(Html.text("Hello"))))));
}
@@ -92,6 +90,15 @@ public class DocumentConverterTests {
}
@Test
+ public void struckthroughRunsCanBeMappedUsingStyleMapping() {
+ assertThat(
+ convertToHtml(
+ make(a(RUN, with(STRIKETHROUGH, true), with(CHILDREN, list(new Text("Hello"))))),
+ StyleMap.builder().strikethrough(HtmlPath.element("del")).build()),
+ deepEquals(list(Html.element("del", list(Html.text("Hello"))))));
+ }
+
+ @Test
public void superscriptRunsAreWrappedInSuperscriptTags() {
assertThat(
convertToHtml(make(a(RUN, with(VERTICAL_ALIGNMENT, SUPERSCRIPT), with(CHILDREN, list(new Text("Hello")))))),