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 6ece043
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 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
8 changes: 4 additions & 4 deletions src/test/java/org/javarosa/core/model/SelectChoiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ public void getChild_updates_whenChoicesAreFromRepeat() throws IOException, XFor
input("value"),
input("label"),
input("special-property")),
input("filter"),
select1Dynamic("/data/select", "../repeat")
input("/data/filter"),
select1Dynamic("/data/select", "/data/repeat")
)));
scenario.answer("/data/repeat[0]/value", "a");
scenario.answer("/data/repeat[0]/label", "A");
Expand Down Expand Up @@ -201,8 +201,8 @@ public void getChildren_updates_whenChoicesAreFromRepeat() throws IOException, X
input("value"),
input("label"),
input("special-property")),
input("filter"),
select1Dynamic("/data/select", "../repeat")
input("/data/filter"),
select1Dynamic("/data/select", "/data/repeat")
)));
scenario.answer("/data/repeat[0]/value", "a");
scenario.answer("/data/repeat[0]/label", "A");
Expand Down

0 comments on commit 6ece043

Please sign in to comment.