Skip to content

Commit

Permalink
[getodk#6439] Text fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
karntrehan committed Oct 16, 2024
1 parent a23196c commit 373d79c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class AddRepeatTest {
private static final String ONE_QUESTION_REPEAT = "one-question-repeat.xml";
private static final String FIELD_LIST_REPEAT = "field-list-repeat.xml";
private static final String FIXED_COUNT_REPEAT = "fixed-count-repeat.xml";
private static final String REPEAT_WITHOUT_LABEL = "repeat_without_label.xml";

private final CollectTestRule rule = new CollectTestRule();

Expand Down Expand Up @@ -117,4 +118,17 @@ public void whenInHierarchyForRepeat_clickingPlus_addsRepeatAtEndOfSeries() {
.addGroup()
.assertText("Person > 3");
}

@Test
public void whenInEmptyRepeat_swipingNext_andClickingAdd_addsAnotherRepeat() {
rule.startAtMainMenu()
.copyForm(REPEAT_WITHOUT_LABEL)
.startBlankForm("Repeat without label")
.assertText("> 1")
.assertQuestion("First name", true)
.answerQuestion("First name", true, "Karan")
.swipeToNextQuestionWithRepeatGroup("")
.clickOnAdd(new FormEntryPage("Repeat without label"))
.assertText("> 2");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ public AddNewRepeatDialog(String repeatName) {

@Override
public AddNewRepeatDialog assertOnPage() {
onView(withText(getTranslatedString(org.odk.collect.strings.R.string.add_repeat_question, repeatName)))
String dialogMessage;
if (repeatName.isBlank()) {
dialogMessage = getTranslatedString(org.odk.collect.strings.R.string.add_another_question);
} else {
dialogMessage = getTranslatedString(org.odk.collect.strings.R.string.add_repeat_question, repeatName);
}
onView(withText(dialogMessage))
.inRoot(isDialog())
.check(matches(isDisplayed()));
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0"?><h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" xmlns:odk="http://www.opendatakit.org/xforms"><h:head><h:title>Repeat without label</h:title><model odk:xforms-version="1.0.0"><instance><data id="repeat_no_label" version="20241014214421"><repeat jr:template=""><first_name/></repeat><repeat><first_name/></repeat><meta><instanceID/></meta></data></instance><bind nodeset="/data/repeat/first_name" type="string" required="true()"/><bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid"/></model></h:head><h:body><group ref="/data/repeat"><label></label><repeat nodeset="/data/repeat"><input ref="/data/repeat/first_name"><label>First name</label></input></repeat></group></h:body></h:html>

0 comments on commit 373d79c

Please sign in to comment.