diff options
author | sanine <sanine.not@pm.me> | 2022-05-22 12:57:34 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-05-22 12:57:34 -0500 |
commit | 7188614f0e2103f2cfc87dd0cb268f82fafd8c22 (patch) | |
tree | 3ad696c8a08bb229f219540de849f69f2dc5346e /test.lua | |
parent | 825194d0e5a1c16d3c3170a90a9a2679146044a7 (diff) |
allow setting attributes
Diffstat (limited to 'test.lua')
-rwxr-xr-x | test.lua | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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) |