4. Replace tests/smoke.luau
luastra/ui · semantic spatial navigation · about 25 minutesroot → nested depth → focus → return
The test follows the meaningful interaction states without asserting host-calculated coordinates or animation frames.
When to use it
Replace the smoke test. Test semantic states and contracts in Luau; verify actual layout, motion, focus order, and list fallback separately in supported hosts.
Focused example
--!strict
local app = require("app/main")
local function byId(node: any, id: string): any
if node.id == id then return node end
for _, child in node.children do
local found = byId(child, id)
if found ~= nil then return found end
end
return nil
end
local function hasClass(node: any, name: string): boolean
return string.find(" " .. node.properties.className .. " ", " " .. name .. " ", 1, true) ~= nil
end
local initial = app.render()
assert(initial.type == "Screen")
assert(hasClass(byId(initial, "orbit"), "luastra-orbit"))
assert(hasClass(byId(initial, "orbit/root"), "luastra-constellation-state-active"))
assert(byId(initial, "orbit/build-space") == nil)
assert(byId(initial, "orbit/build").properties.orbitRelatedTo == "orbit/learn")
app.handle("open-build", "orbit/build", "")
local nested = app.render()
assert(hasClass(byId(nested, "orbit/root"), "luastra-constellation-state-behind"))
assert(hasClass(byId(nested, "orbit/build-space"), "luastra-constellation-state-active"))
app.handle("open-focus", "orbit/build/interface", "")
local focused = app.render()
assert(byId(focused, "orbit/focus").properties.open == true)
assert(hasClass(byId(focused, "orbit/build/interface"), "luastra-orbit-selected"))
assert(byId(focused, "orbit/focus/title").properties.text == "Interface")
app.handle("close-focus", "orbit/focus/close", "")
assert(byId(app.render(), "orbit/focus").properties.open == false)
app.handle("return-root", "orbit/path/root", "")
local returned = app.render()
assert(hasClass(byId(returned, "orbit/root"), "luastra-constellation-state-active"))
assert(hasClass(byId(returned, "orbit/build-space"), "luastra-constellation-state-ahead"))
assert(app.snapshot().depth == "root")
return true