util.dataforms: Add failing test for #1177

remotes/origin/0.11
Kim Alvefur 8 years ago
parent 46d630b02d
commit 00a2891787
  1. 27
      spec/util_dataforms_spec.lua

@ -320,5 +320,32 @@ describe("util.dataforms", function ()
assert.truthy(some_form:data(xform));
end);
end);
describe("issue1177", function ()
local form_with_stuff;
setup(function ()
form_with_stuff = dataforms.new({
{
type = "list-single";
name = "abtest";
label = "A or B?";
options = {
{ label = "A", value = "a", default = true },
{ label = "B", value = "b" },
};
},
});
end);
it("includes options when value is included", function ()
local f = form_with_stuff:form({ abtest = "a" });
assert.truthy(f:find("field/option"));
end);
it("includes options when value is excluded", function ()
local f = form_with_stuff:form({});
assert.truthy(f:find("field/option"));
end);
end);
end);

Loading…
Cancel
Save