aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_dataforms_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-21 18:56:43 +0100
committerKim Alvefur <zash@zash.se>2019-11-21 18:56:43 +0100
commit7cafc6927809105e4e295e35c909d1e01e8b51cb (patch)
tree68e1211a50cbbc77e8f7e125a2027585d44c7fa6 /spec/util_dataforms_spec.lua
parentf8a0c8422e2d50fa17499bcba298a9be6ca25dd4 (diff)
downloadprosody-7cafc6927809105e4e295e35c909d1e01e8b51cb.tar.gz
prosody-7cafc6927809105e4e295e35c909d1e01e8b51cb.zip
util.dataforms: Add support for validating (integer) ranges
Diffstat (limited to 'spec/util_dataforms_spec.lua')
-rw-r--r--spec/util_dataforms_spec.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/util_dataforms_spec.lua b/spec/util_dataforms_spec.lua
index 0df9fb1d..d2d1264a 100644
--- a/spec/util_dataforms_spec.lua
+++ b/spec/util_dataforms_spec.lua
@@ -423,6 +423,8 @@ describe("util.dataforms", function ()
name = "number",
type = "text-single",
datatype = "xs:integer",
+ range_min = -10,
+ range_max = 10,
},
};
@@ -437,6 +439,13 @@ describe("util.dataforms", function ()
assert.table(e);
assert.string(e.number);
end);
+
+ it("works", function ()
+ local d,e = f:data(f:form({number = 100}));
+ assert.not_equal(100, d.number);
+ assert.table(e);
+ assert.string(e.number);
+ end);
end);
describe("media element", function ()
it("produced media element correctly", function ()