diff options
Diffstat (limited to 'test.lua')
-rwxr-xr-x | test.lua | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -85,3 +85,25 @@ test("marigold.h correctly adds children", function() assert(div.children[2].tag == 'p') assert(div.children[2].content == 'the second paragraph') end) + + +test("marigold.h correctly ignores missing content", function() + local h = marigold.h + local div = h('div', { + h('p', "the first paragraph"), + h('p', "the second paragraph"), + }) + + assert(div.tag == 'div') + assert(div.content == "") + -- still should have nothing in the attributes table + for k, v in ipairs(div.attributes) do + assert(false, string.format("%s, %s", tostring(k), tostring(v))) + end + 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) |