Make ‘var’ attribute of a Field optional
Looking at [the spec](https://xmpp.org/extensions/xep-0004.html#protocol-field) it seems valid not to have a `var` attribute set, at least for fields of type `fixed` that is: > If the element type is anything other than "fixed" (see below), it MUST > possess a 'var' attribute that uniquely identifies the field in the context > of the form (if it is "fixed", it MAY possess a 'var' attribute). The element > MAY possess a 'label' attribute that defines a human-readable name for the field.
This commit is contained in:
parent
079379a178
commit
ac0707e52d
7 changed files with 71 additions and 24 deletions
|
|
@ -232,7 +232,7 @@ mod tests {
|
|||
.unwrap();
|
||||
let form = DataForm::try_from(elem).unwrap();
|
||||
assert_eq!(form.fields.len(), 1);
|
||||
assert_eq!(form.fields[0].var, "ocr");
|
||||
assert_eq!(form.fields[0].var.as_deref(), Some("ocr"));
|
||||
assert_eq!(form.fields[0].media[0].width, Some(290));
|
||||
assert_eq!(form.fields[0].media[0].height, Some(80));
|
||||
assert_eq!(form.fields[0].media[0].uris[0].type_, "image/jpeg");
|
||||
|
|
|
|||
Loading…
Reference in a new issue