MDL-77656 quiz: stop using displayed number as an id

This commit is contained in:
Tim Hunt 2023-03-28 10:22:25 +01:00
parent 3bea326d7a
commit 9efaa719cc
2 changed files with 13 additions and 11 deletions

View File

@ -796,9 +796,8 @@ class edit_renderer extends \plugin_renderer_base {
$questionslot = $structure->get_displayed_number_for_slot($slot);
$checkbox = new \core\output\checkbox_toggleall($this->togglegroup, false,
[
'id' => 'selectquestion-' . $questionslot,
'id' => 'selectquestion-' . $slot,
'name' => 'selectquestion[]',
'value' => $questionslot,
'classes' => 'select-multiple-checkbox',
'label' => get_string('selectquestionslot', 'quiz', $questionslot),
'labelclasses' => 'sr-only',

View File

@ -25,12 +25,14 @@ Feature: Edit quiz page - remove multiple questions
@javascript
Scenario: Delete selected question using select multiple items feature.
Given the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | truefalse | Question A | This is question 01 |
| Test questions | truefalse | Question B | This is question 02 |
| Test questions | truefalse | Question C | This is question 03 |
| questioncategory | qtype | name | questiontext |
| Test questions | description | Info | Some instructions |
| Test questions | truefalse | Question A | This is question 01 |
| Test questions | truefalse | Question B | This is question 02 |
| Test questions | truefalse | Question C | This is question 03 |
And quiz "Quiz 1" contains the following questions:
| question | page |
| Info | 1 |
| Question A | 1 |
| Question B | 1 |
| Question C | 2 |
@ -41,7 +43,7 @@ Feature: Edit quiz page - remove multiple questions
And I should see "Question B" on quiz page "1"
And I should see "Question C" on quiz page "2"
And I should see "Total of marks: 3.00"
And I should see "Questions: 3"
And I should see "Questions: 4"
And I should see "This quiz is open"
# Delete last question in last page. Page contains multiple questions. No reordering.
@ -50,11 +52,12 @@ Feature: Edit quiz page - remove multiple questions
And I click on "Delete selected" "button"
And I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should see "Question A" on quiz page "1"
And I should see "Question B" on quiz page "1"
And I should not see "Question C" on quiz page "2"
Then I should see "Info" on quiz page "1"
And I should see "Question A" on quiz page "1"
And I should not see "Question B" on quiz page "1"
And I should see "Question C" on quiz page "2"
And I should see "Total of marks: 2.00"
And I should see "Questions: 2"
And I should see "Questions: 3"
@javascript
Scenario: Delete first selected question using select multiple items feature.