aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-30 20:49:26 +0200
committerKim Alvefur <zash@zash.se>2018-06-30 20:49:26 +0200
commit211253c16c4c150dc2d5a56341d8a28029ac468b (patch)
tree12687c7f5dacb3a1b222e39e040feb8870d79383 /spec
parent60b3cc3a00a492f8fcf2b08b253210c867936902 (diff)
downloadprosody-211253c16c4c150dc2d5a56341d8a28029ac468b.tar.gz
prosody-211253c16c4c150dc2d5a56341d8a28029ac468b.zip
util.dataforms: Add failing test for #1177
Diffstat (limited to 'spec')
-rw-r--r--spec/util_dataforms_spec.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/util_dataforms_spec.lua b/spec/util_dataforms_spec.lua
index f4c0d8b5..66236e96 100644
--- a/spec/util_dataforms_spec.lua
+++ b/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);