aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-14 11:26:35 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-14 11:26:35 +0000
commit7eb51f99ed46e35b42e5bdd4e73dc55aa989b183 (patch)
tree64a7b43d1efb07b8bd95d3477159757bfa432d3b /src/test/java/org
parentf33735eb241e0bd590036dcba4a084074a681543 (diff)
Wrap superscript runs in <sup>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java8
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java3
2 files changed, 10 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 a0c0a66..8024291 100644
--- a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java
+++ b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java
@@ -12,6 +12,7 @@ import java.util.List;
import static com.natpryce.makeiteasy.MakeItEasy.*;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.zwobble.mammoth.documents.VerticalAlignment.SUPERSCRIPT;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;
import static org.zwobble.mammoth.tests.documents.DocumentElementMakers.*;
import static org.zwobble.mammoth.util.MammothLists.list;
@@ -66,6 +67,13 @@ public class DocumentConverterTests {
deepEquals(list(Html.element("s", list(Html.text("Hello"))))));
}
+ @Test
+ public void superscriptRunsAreWrappedInSuperscriptTags() {
+ assertThat(
+ convertToHtml(make(a(RUN, with(VERTICAL_ALIGNMENT, SUPERSCRIPT), with(CHILDREN, list(new Text("Hello")))))),
+ deepEquals(list(Html.element("sup", list(Html.text("Hello"))))));
+ }
+
private List<HtmlNode> convertToHtml(DocumentElement element) {
return DocumentConverter.convertToHtml(element);
diff --git a/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java b/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java
index 6e9409f..bacd649 100644
--- a/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java
+++ b/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java
@@ -18,6 +18,7 @@ public class DocumentElementMakers {
public static final Property<HasChildren, Boolean> ITALIC = newProperty();
public static final Property<HasChildren, Boolean> UNDERLINE = newProperty();
public static final Property<HasChildren, Boolean> STRIKETHROUGH = newProperty();
+ public static final Property<HasChildren, VerticalAlignment> VERTICAL_ALIGNMENT = newProperty();
public static final Property<HasChildren, List<DocumentElement>> CHILDREN = newProperty();
public static final Instantiator<Paragraph> PARAGRAPH =
@@ -32,7 +33,7 @@ public class DocumentElementMakers {
propertyLookup.valueOf(ITALIC, false),
propertyLookup.valueOf(UNDERLINE, false),
propertyLookup.valueOf(STRIKETHROUGH, false),
- VerticalAlignment.BASELINE,
+ propertyLookup.valueOf(VERTICAL_ALIGNMENT, VerticalAlignment.BASELINE),
Optional.empty(),
propertyLookup.valueOf(CHILDREN, list()));