Software /
code /
prosody
Comparison
spec/util_dataforms_spec.lua @ 9083:5d3639e415bd
util.dataforms: Add failing test for #1177
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 30 Jun 2018 20:49:26 +0200 |
parent | 9046:7cdc718312c8 |
child | 9121:e5eb36ee07a2 |
comparison
equal
deleted
inserted
replaced
9082:297a06074175 | 9083:5d3639e415bd |
---|---|
318 describe(":data", function () | 318 describe(":data", function () |
319 it("works", function () | 319 it("works", function () |
320 assert.truthy(some_form:data(xform)); | 320 assert.truthy(some_form:data(xform)); |
321 end); | 321 end); |
322 end); | 322 end); |
323 | |
324 describe("issue1177", function () | |
325 local form_with_stuff; | |
326 setup(function () | |
327 form_with_stuff = dataforms.new({ | |
328 { | |
329 type = "list-single"; | |
330 name = "abtest"; | |
331 label = "A or B?"; | |
332 options = { | |
333 { label = "A", value = "a", default = true }, | |
334 { label = "B", value = "b" }, | |
335 }; | |
336 }, | |
337 }); | |
338 end); | |
339 | |
340 it("includes options when value is included", function () | |
341 local f = form_with_stuff:form({ abtest = "a" }); | |
342 assert.truthy(f:find("field/option")); | |
343 end); | |
344 | |
345 it("includes options when value is excluded", function () | |
346 local f = form_with_stuff:form({}); | |
347 assert.truthy(f:find("field/option")); | |
348 end); | |
349 end); | |
323 end); | 350 end); |
324 | 351 |