diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java | 9 | ||||
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java | 12 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java index 6152822..0a35512 100644 --- a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java @@ -4,6 +4,7 @@ import org.junit.Test; import org.zwobble.mammoth.DocumentConverter; import org.zwobble.mammoth.documents.Document; import org.zwobble.mammoth.documents.DocumentElement; +import org.zwobble.mammoth.documents.Text; import org.zwobble.mammoth.html.Html; import org.zwobble.mammoth.html.HtmlNode; @@ -35,6 +36,14 @@ public class DocumentConverterTests { Html.element("p", list(Html.text("there")))))); } + @Test + public void boldRunsAreWrappedInStrongTags() { + assertThat( + convertToHtml(make(a(RUN, with(BOLD, true), with(CHILDREN, list(new Text("Hello")))))), + + deepEquals(list(Html.element("strong", 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 396a95a..6e9409f 100644 --- a/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java +++ b/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java @@ -14,6 +14,10 @@ import static com.natpryce.makeiteasy.Property.newProperty; import static org.zwobble.mammoth.util.MammothLists.list; public class DocumentElementMakers { + public static final Property<HasChildren, Boolean> BOLD = newProperty(); + 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, List<DocumentElement>> CHILDREN = newProperty(); public static final Instantiator<Paragraph> PARAGRAPH = @@ -24,10 +28,10 @@ public class DocumentElementMakers { public static final Instantiator<Run> RUN = propertyLookup -> new Run( - false, - false, - false, - false, + propertyLookup.valueOf(BOLD, false), + propertyLookup.valueOf(ITALIC, false), + propertyLookup.valueOf(UNDERLINE, false), + propertyLookup.valueOf(STRIKETHROUGH, false), VerticalAlignment.BASELINE, Optional.empty(), propertyLookup.valueOf(CHILDREN, list())); |
