summaryrefslogtreecommitdiff
path: root/test.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test.lua')
-rwxr-xr-xtest.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/test.lua b/test.lua
index 17aa46d..cd999b2 100755
--- a/test.lua
+++ b/test.lua
@@ -105,5 +105,27 @@ test("marigold.h correctly ignores missing content", function()
assert(div.children[1].content == 'the first paragraph')
assert(div.children[2].tag == 'p')
assert(div.children[2].content == 'the second paragraph')
+end)
+
+
+test("marigold.h correctly sets attributes and children", function()
+ local h = marigold.h
+ local div = h('div', {
+ id="root", class="blinking bold",
+ h('p', "the first paragraph"),
+ h('p', "the second paragraph"),
+ })
+
+ assert(div.tag == 'div')
+ assert(div.content == "")
+
+ assert(div.attributes.id == 'root')
+ assert(div.attributes.class == 'blinking bold')
+
+ assert(#div.children == 2)
+ assert(div.children[1].tag == 'p')
+ assert(div.children[1].content == 'the first paragraph')
+ assert(div.children[2].tag == 'p')
+ assert(div.children[2].content == 'the second paragraph')
end)