summaryrefslogtreecommitdiff
path: root/tests/test_document.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_document.py')
-rw-r--r--tests/test_document.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/test_document.py b/tests/test_document.py
new file mode 100644
index 0000000..35f706f
--- /dev/null
+++ b/tests/test_document.py
@@ -0,0 +1,50 @@
+from wikimini import document
+
+
+class TestBlockLink:
+
+ def test_append(self):
+ link = document.BlockLink("https://localhost", "foo ")
+ link.append(document.Plain("bar"))
+ assert link.title == "foo bar"
+
+ link.append(document.Style(document.Plain("qux"), False, True, False))
+ assert link.title == "foo barqux"
+
+ def test_plain(self):
+ link = document.BlockLink("https://localhost", "foo ")
+ assert link.plain() == "foo "
+
+ def test_to_nodes(self):
+ link = document.BlockLink("https://localhost", "foo ")
+ assert link.to_nodes() == [
+ document.Plain("foo ")
+ ]
+
+
+class TestBlockQuote:
+
+ def test_append(self):
+ quote = document.BlockQuote(document.Paragraph([]))
+ quote.append(document.Plain("Foo"))
+ assert quote.plain() == "Foo"
+ assert len(quote.content.nodes) == 1
+
+ quote.append(document.Style(document.Plain("bar"), True, True, False))
+ assert quote.plain() == "Foobar"
+ assert len(quote.content.nodes) == 2
+
+ def test_plain(self):
+ quote = document.BlockQuote(document.Paragraph([
+ document.Plain("Foo"),
+ document.InlineLink("http://localhost", document.Plain("bar")),
+ ]))
+ assert quote.plain() == "Foobar"
+
+ def test_to_nodes(self):
+ nodes = [
+ document.Plain("Foo"),
+ document.InlineLink("http://localhost", document.Plain("bar")),
+ ]
+ assert (document.BlockQuote(document.Paragraph(nodes)).to_nodes()
+ == nodes)