Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support self-closing setvalue without value #615

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

lognaturel
Copy link
Member

#564 added support for setvalue with an empty literal value or an empty String as the attribute value for value. However, it didn't add support for a self-closing setvalue tag without a value attribute which is what pyxform actually generates in the case of an empty calculation:
<setvalue event="xforms-value-changed" ref="/data/malaria_age"/>

What has been done to verify that this works as intended?

Added test and verified that the generated XML matches the one generated by pyxform.

Why is this the best possible solution? Were any other approaches considered?

This is such a small change that I don't think there really are alternatives. It gets the desired behavior -- if there isn't an explicit value for a value attribute or as a child, then we clear the target.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

This loosens the requirements for setvalue. It could possibly allow more form design mistakes through but I think that risk is acceptable.

Do we need any specific form for testing your changes? If so, please attach one.

See test.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

getodk/docs#1287

@codecov-io
Copy link

Codecov Report

Merging #615 (0f5131f) into master (3746adc) will increase coverage by 0.02%.
The diff coverage is 75.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #615      +/-   ##
============================================
+ Coverage     55.03%   55.06%   +0.02%     
- Complexity     3242     3244       +2     
============================================
  Files           242      242              
  Lines         13345    13347       +2     
  Branches       2568     2568              
============================================
+ Hits           7345     7349       +4     
+ Misses         5197     5196       -1     
+ Partials        803      802       -1     
Impacted Files Coverage Δ Complexity Δ
...ain/java/org/javarosa/xform/parse/XFormParser.java 67.86% <75.00%> (+0.14%) 258.00 <0.00> (+1.00)
.../java/org/javarosa/core/model/utils/DateUtils.java 59.26% <0.00%> (+0.28%) 77.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3746adc...0f5131f. Read the comment docs.

@seadowg
Copy link
Member

seadowg commented Feb 10, 2021

Looks good!

@lognaturel lognaturel merged commit 3511cac into getodk:master Feb 10, 2021
@lognaturel lognaturel deleted the empty-setvalue branch February 10, 2021 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants