-
Notifications
You must be signed in to change notification settings - Fork 136
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
Allowing xml-internal question type. #383
Conversation
@lognaturel see also my comment in #176. Is this the expected behavior? |
@nribeka is this behavior on master or just on this branch? What happens if you actually include a select on the |
@lognaturel, this is in master. As long as you add If you add select on
|
I think it's coming from this line: https://github.com/XLSForm/pyxform/blame/master/pyxform/xls2json.py#L1119
This assignment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should not be primary instance nodes created for xml-internal
questions. I think that ideally when a list name that doesn't exist in the choices
tab is specified, that should lead to an error.
It would be helpful to add a test that verifies that extra columns' values are added to the secondary instance. Luckily, it looks like that behavior already works.
For this form:
| survey | | | | | |
| | type | name | label | hint |appearance |
| | xml-internal | states | The state | | |
| | xml-internal | yes_no | | | |
| choices | | | | | |
| | list_name | name | label | capital | color |
| | states | VA | Virginia | Richmond | orange |
| | states | IN | Indiana | Indianapolis| |
| | fruits | apple | Apple | | red |
| | fruits | banana | Banana | | yellow |
we expect to see capital
and color
nodes in the secondary instances where those have values in the form definition.
|
||
self.assertContains(survey_xml, '<instance id="yes_no">', 1) | ||
self.assertContains(survey_xml, '<instance id="states">', 1) | ||
self.assertContains(survey_xml, '<instance id="fruits">', 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fruits
isn't used anywhere so I wouldn't expect it be generated. I think this is existing behavior so maybe we don't need to change it here?
self.assertPyxformXform( | ||
md=md, | ||
model__contains=[ | ||
'<instance id="yes_no">', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two assertion blocks seem redundant to me. Perhaps it's best to go with the first variant so the count can be verified.
Fix #176.
This would allow question of type xml-internal.