Skip to content

Commit

Permalink
Test choices from previous repeat answers in nested repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisRayM committed Sep 28, 2020
1 parent 41c36ad commit 5d96e21
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pyxform/tests_v1/test_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,31 @@ def test_choice_from_previous_repeat_answers_with_choice_filter(self):
],
run_odk_validate=True,
)

def test_choice_from_previous_repeat_answers_in_nested_repeat(self):
"""Select one choices from previous repeat answers within a nested repeat"""
xlsform_md = """
| survey | | | | |
| | type | name | label | choice_filter |
| | text | enumerators_name | Enter enumerators name | |
| | begin repeat | household_rep | Household Repeat | |
| | integer | household_id | Enter household ID | |
| | begin repeat | household_mem_rep | Household member repeat | |
| | text | name | Enter name of a household member | |
| | integer | age | Enter age of the household member | |
| | end repeat | household_mem_rep | | |
| | begin repeat | selected | Select a representative | |
| | integer | target_min_age | Minimum age requirement | |
| | select one ${name} | selected_name | Choose a name | ${name} > ${target_min_age} |
| | end repeat | selected | | |
| | end repeat | household_rep | | |
"""
self.assertPyxformXform(
name="data",
id_string="some-id",
md=xlsform_md,
xml__contains=[
'<itemset nodeset="/data/household_rep/household_mem_rep[ ./name &gt; current()/../target_min_age ]">',
],
run_odk_validate=True,
)

0 comments on commit 5d96e21

Please sign in to comment.