-
Notifications
You must be signed in to change notification settings - Fork 109
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
Improve and augment tests around relative paths, especially in choice filters #349
Comments
@ggalmazor I know you have some of this already in a branch and that there's overlap with #334 so I think it makes sense for you to take on. The additional tests must be in before the next JR release to add more confidence around #335. |
Overlap with #336 |
I have a question about the optional
What could be the use of a |
I have another question about the <?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml">
<h:head>
<h:title>relative-current-ref</h:title>
<model>
<instance>
<data id="relative-current-ref-repeat">
<meta>
<instanceID/>
</meta>
<repeat_group>
<person/>
<selected_person/>
</repeat_group>
</data>
</instance>
<bind nodeset="/data/repeat_group/person" type="string"/>
<bind nodeset="/data/repeat_group/selected_person" type="string"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/data/meta/instanceID" readonly="true()" type="string"/>
</model>
</h:head>
<h:body>
<repeat nodeset="/data/repeat_group">
<group>
<label>Top level group</label>
<input ref="/data/repeat_group/person">
<label>Person</label>
</input>
<input ref="/data/repeat_group/selected_person">
<label>Selected Person</label>
<setvalue event="xforms-value-changed" ref="curren()/../person">Value changed!</setvalue>
</input>
</group>
</repeat>
</h:body>
</h:html> (don't mind the field names, etc. I just want the second text field to update with some fixed value when the value of the first one changes) The parser is complaining about this form with this error: Any ideas? |
I've never seen this before and didn't know it was possible. My guess would be that a client could use that to only send the subtree described by that node. I don't believe Collect does that but would be good to check if it does use it. I think this is safe to ignore.
We already actually have a good form for this -- I changed So these tests are already paying off. 🎉 |
Should we create an issue for this? |
Yes, good idea. I guess you can omit that test here and the test can go with the fix for easy tracking. |
@lognaturel, it turns out that this last check we figured out doesn't make sense:
After seeing this, I think it doesn't leave much room for augmenting the test suite for |
@ggalmazor When you wrote that, I was imagining something like XLSForm/pyxform#187 (comment) where the label of the select uses a relative expression with |
Ooooh, that's a good one I didn't think about! I'll explore that |
I think it'd be good to have an example like that with a relative reference. Not sure if it should really use Maybe something to consider is to have a series of tests that demonstrate where expressions with |
#335 introduced some tests on using
current()
in an itemset context. These are pretty low-level and not entirely targeted (e.g. they always do a "round trip" with verification that values are properly written back out).On that PR, @ggalmazor discussed a few directions that could be taken to make these tests easier to read. For example, a method
answerQuestion(string, string)
could be introduced. The first string would be interpreted as an XPath path that a reference can be built from. Then this could be converted to a formindex to jump to that desired question. The second string would be the answer to set.Similarly,
answerOf(string)
could take an XPath path as a string and return the answer to that question / value of the node.To augment these tests, introduce more cases with relative paths (from #335 (comment)):
submission
inside the model of a form XFormParser.java#755setvalue
action XFormParser.java#690<label>
that shows an<itext>
related to the selected value from a previous fieldThe text was updated successfully, but these errors were encountered: