Skip to content

Commit

Permalink
update test spec
Browse files Browse the repository at this point in the history
  • Loading branch information
shahrul committed Oct 3, 2024
1 parent e16e644 commit 1bc66a0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/test_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,34 @@ describe("LuaX", function()
h(el))
end)

it("should return a HTML string when given JSX like syntax 1", function()
it("should return a HTML string when given JSX like syntax", function()
local el = require("test.element")
assert.is.equal('<div bar="bar" class="container" d="1" id="foo" val="value">Hello, world!</div>', h(el))
end)

it("should return a HTML string when given JSX like syntax 2", function()
it("should return a HTML string when given children prop", function()
local el = require("test.foo")
assert.is.equal('<div>foobar</div>', h(el))
end)

it("should return a HTML string when given JSX like syntax 3", function()
it("should return a HTML string when given JSX like syntax with nested node", function()
local el = require("test.varin")
assert.is.equal(
'<div class="container" id="div_1"><p class="title" id="p_2" style="border: 1px solid red;">Hello, world!</p></div>',
h(el))
end)

it("should return a HTML string when given JSX like syntax 4", function()
it("should return a HTML string when given attributes with special characters", function()
local el = require("test.content")
assert.is.equal(
'<footer _="install Footer" class="footer"><span _="install TodoCount" class="todo-count" hx-trigger="load"></span>foobar</footer>',
h(el))
end)

it("should return a HTML string when given input node", function()
local el = require("test.input")
assert.is.equal(
'<input _="install TodoEdit" class="edit" name="title" todo-id="0" value="foo">',
h(el))
end)
end)

0 comments on commit 1bc66a0

Please sign in to comment.