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

Improve tests based on findings from porting them to Web Forms #759

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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