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
commit00a28917877a2b5ac762e8720b11a1f532802dc8 (patch)
tree12687c7f5dacb3a1b222e39e040feb8870d79383 /spec
parent46d630b02de34e8e516fbd2fac096b5c2d8ae8e8 (diff)
downloadprosody-00a28917877a2b5ac762e8720b11a1f532802dc8.tar.gz
prosody-00a28917877a2b5ac762e8720b11a1f532802dc8.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);