1@core_form 2Feature: Repeated elements in moodleforms 3 4 Scenario: Clicking button to add repeat elements creates repeat elements with the correct default values 5 Given I log in as "admin" 6 And I am on fixture page "/lib/form/tests/behat/fixtures/repeat_defaults_form.php" 7 When I press "Add repeats" 8 Then the following fields match these values: 9 | testcheckbox[1] | 1 | 10 | testadvcheckbox[1] | 1 | 11 | testdate[1][day] | 8 | 12 | testdate[1][month] | September | 13 | testdate[1][year] | 2013 | 14 | testdatetime[1][day] | 8 | 15 | testdatetime[1][month] | September | 16 | testdatetime[1][year] | 2013 | 17 | testdatetime[1][hour] | 10 | 18 | testdatetime[1][minute] | 30 | 19 | testduration[1][number] | 3 | 20 | testduration[1][timeunit] | hours | 21 | testselect[1] | B | 22 | testselectyes[1] | Yes | 23 | testselectno[1] | No | 24 | testtext[1] | Testing 123 | 25 26 Scenario: Functionality to delete an option in the repeated elements 27 Given I log in as "admin" 28 And I am on fixture page "/lib/form/tests/behat/fixtures/repeat_with_delete_form.php" 29 And I set the field "Test text 1" to "value 1" 30 When I press "Add repeats" 31 Then the following fields match these values: 32 | Test text 1 | value 1 | 33 | Test text 2 | Testing | 34 And I set the field "Test text 2" to "value 2" 35 And I press "Add repeats" 36 And the following fields match these values: 37 | Test text 1 | value 1 | 38 | Test text 2 | value 2 | 39 | Test text 3 | Testing | 40 And I set the field "Test text 3" to "value 3" 41 And I press "Delete option 2" 42 And the following fields match these values: 43 | Test text 1 | value 1 | 44 | Test text 3 | value 3 | 45 And I should not see "Test text 2" 46 And I should not see "Delete option 2" 47 And I press "Save changes" 48 And I should see "{\"0\":\"value 1\",\"2\":\"value 3\"}" 49