Skip to content

Commit

Permalink
Use absolute references in body
Browse files Browse the repository at this point in the history
These relative refs were likely introduced by analogy to itemset declarations
  • Loading branch information
lognaturel committed Apr 16, 2024
1 parent 5ae6894 commit 015a677
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ private static XFormsElement getSelectFromRepeatForm(String predicate) {
t("select"))))),
body(
repeat("/data/repeat",
input("value"),
input("label")),
input("filter"),
select1Dynamic("/data/select", "../repeat" + (!predicate.isEmpty() ? "[" + predicate + "]" : ""))
input("/data/repeat/value"),
input("/data/repeat/label")),
input("/data/filter"),
select1Dynamic("/data/select", "/data/repeat" + (!predicate.isEmpty() ? "[" + predicate + "]" : ""))
));
}
//endregion
Expand Down Expand Up @@ -274,7 +274,7 @@ public void selectInRepeat_withRefToRepeatChildInPredicate_evaluatesChoiceListFo
item("bb", "BB")))),
body(
repeat("/data/repeat",
input("filter"),
input("/data/filter"),
select1Dynamic("/data/repeat/select", "instance('choices')/root/item[starts-with(value,current()/../filter)]"))
)));

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/javarosa/core/model/SelectCachingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public void eqChoiceFilter_inRepeat_onlyEvaluatedOnce() throws Exception {
item("b", "B"),
item("bb", "BB")))),
body(
input("filter"),
input("/data/filter"),
repeat("/data/repeat",
select1Dynamic("/data/repeat/select", "instance('choices')/root/item[value=/data/filter]"))
)));
Expand Down Expand Up @@ -372,7 +372,7 @@ public void eqChoiceFiltersInRepeatsWithCurrentPathExpressionsAreOnlyEvaluatedOn
item("b", "B")))),
body(
repeat("/data/outer",
input("filter"),
input("/data/filter"),
repeat("/data/outer/inner",
select1Dynamic("/data/outer/inner/select", "instance('choices')/root/item[value=current()/../../filter]"))
))));
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/javarosa/core/model/SelectChoiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void getChild_updates_whenChoicesAreFromRepeat() throws IOException, XFor
input("value"),
input("label"),
input("special-property")),
input("filter"),
input("/data/filter"),
select1Dynamic("/data/select", "../repeat")
)));
scenario.answer("/data/repeat[0]/value", "a");
Expand Down Expand Up @@ -201,7 +201,7 @@ public void getChildren_updates_whenChoicesAreFromRepeat() throws IOException, X
input("value"),
input("label"),
input("special-property")),
input("filter"),
input("/data/filter"),
select1Dynamic("/data/select", "../repeat")
)));
scenario.answer("/data/repeat[0]/value", "a");
Expand Down

0 comments on commit 015a677

Please sign in to comment.