aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_dataforms_spec.lua
Commit message (Collapse)AuthorAgeFilesLines
* util.stanza: Add method for extracting a single attribute valueKim Alvefur2022-08-171-1/+1
| | | | | | | | | Sometimes you only care about a single attribute, but the child tag itself may be optional, leading to needing `tag and tag.attr.foo` or `stanza:find("tag@foo")`. The `:find()` method is fairly complex, so avoiding it for this kind of simpler use case is a win.
* Spelling: Fix various spelling mistakes (thanks timeless)Kim Alvefur2022-03-071-2/+2
| | | | | | Words, sometimes I wonder how they even work Maybe I missed something.
* util.dataforms: Ensure larger integers are serialized as suchKim Alvefur2021-10-281-0/+6
| | | | | | | Assumes that most number fields are integers, as most numeric types listed in XEP-0122 are, as are all such fields in Prosody as of this. Otherwise %g produces something like 1.1259e+15
* util.dataforms: Scope integer handling testsKim Alvefur2021-10-261-26/+29
| | | | | So they're separate from the datetime tests, and any future validation tests
* util.dataforms: Turn number values into timestamps for datetime fieldsKim Alvefur2021-10-261-1/+1
| | | | Makes it symmetric with parsing.
* util.dataforms: Coerce number values for boolean fieldsKim Alvefur2021-10-261-0/+10
| | | | | Makes more sense than coercing to a string, which would always be truthy.
* util.dataforms: Add support for datetime field types via XEP-0122Kim Alvefur2021-10-251-0/+14
|
* util.dataforms: Add support for validating (integer) rangesKim Alvefur2019-11-211-0/+9
|
* util.dataforms: Add more XEP-0211 media element test coverageKim Alvefur2020-08-161-0/+28
|
* util.dataforms: Convert media element sizes to avoid error on Lua 5.3Kim Alvefur2020-08-161-0/+15
| | | | | | | | The stanza API does not accept number values and threw an error due to the height and width attributes of the media element (XEP-0221). This part had no test coverage previously, explaining why it was not discovered until now.
* util.dataforms: Improve descriptions in testsKim Alvefur2019-12-161-5/+5
|
* util.dataforms: Add support for XEP-0122: Data Forms ValidationKim Alvefur2018-09-011-0/+22
| | | | Initially only basic validation of xs:integer
* util.dataforms: Allow field names to be different from the 'var' attributeKim Alvefur2018-09-011-0/+15
| | | | | | This should allow the usage of long prefixes and namespace-like names to be contained to the XML representation of the form, so that the code can use more convenient names.
* util.dataforms: Allow passing the current values to be used in stead of ↵Kim Alvefur2018-08-051-0/+39
| | | | omitted fields
* util.dataforms: Add failing test for #1177Kim Alvefur2018-06-301-0/+27
|
* util.dataforms: Include a fixed field in testKim Alvefur2018-07-151-0/+10
|
* util.dataforms: Add a simple function for identifying form typesKim Alvefur2018-06-021-0/+9
| | | | | This is meant to allow identifying forms without parsing them completely.
* util.dataforms: Add initial testsKim Alvefur2018-06-021-0/+305
This covers basic form generation, that the fields have the correct attributes, children and text content.