Skip to content

Commit

Permalink
test(Form): finish tests for this component
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazerbeak12345 committed Dec 11, 2023
1 parent 14218da commit 958e804
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion spec/sway_inv_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,37 @@ describe("content functions", function ()
current_idx = 3
}}}, NG_calls, "NG")
end)
pending"show_inv field option includes the inv and the option is not exported"
it("show_inv field option includes the inv and the option is not exported", function ()
local NG = sway.NavGui
local NG_calls = {}
sway.NavGui = function (...)
NG_calls[#NG_calls+1] = {...}
return gui.Nil{}
end
local IT = sway.InventoryTiles
local IT_calls = {}
sway.InventoryTiles = function (...)
IT_calls[#IT_calls+1] = {...}
end
local gocc = sway.get_or_create_context
sway.get_or_create_context = function ()
return { nav_titles = {"the title"}, nav_idx = 3 }
end
local ret = sway.Form{ show_inv = true, gui.Box{} }
local match = flow_extras.search{
tree = ret,
value = "box"
}()
sway.NavGui = NG
sway.InventoryTiles = IT
sway.get_or_create_context = gocc
assert.same({{}}, IT_calls, "IT")
assert.truthy(match, "box")
assert.same({{{
nav_titles = {"the title"},
current_idx = 3
}}}, NG_calls, "NG")
end)
end)
pending"InventoryTiles"
pending"get_form"
Expand Down

0 comments on commit 958e804

Please sign in to comment.