mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 10:00:29 +00:00
test: select with nil
This commit is contained in:
parent
c131b4b61b
commit
8dd3d909fd
@ -30,4 +30,34 @@ describe("list", function()
|
||||
"baz---qux",
|
||||
})
|
||||
end)
|
||||
|
||||
it("select_with_nil", function()
|
||||
local foo_selected = nil
|
||||
local bar_selected = nil
|
||||
|
||||
local config = Config.merge_config({
|
||||
foo = {
|
||||
select_with_nil = true,
|
||||
select = function (list_item, options)
|
||||
foo_selected = {list_item, options}
|
||||
end
|
||||
},
|
||||
bar = {
|
||||
select = function (list_item, options)
|
||||
bar_selected = {list_item, options}
|
||||
end
|
||||
}
|
||||
})
|
||||
local fooc = Config.get_config(config, "foo")
|
||||
local barc = Config.get_config(config, "bar")
|
||||
|
||||
local foo = List.decode(fooc, "foo", {})
|
||||
local bar = List.decode(fooc, "bar", {})
|
||||
|
||||
foo:select(4, {})
|
||||
bar:select(4, {})
|
||||
|
||||
eq({nil, {}}, foo_selected)
|
||||
eq(nil, bar_selected)
|
||||
end)
|
||||
end)
|
||||
|
Loading…
x
Reference in New Issue
Block a user