MDL-86609 qbank_bulkmove: Target qbank categoryid fix.

This commit is contained in:
Nicolas Dunand
2026-01-16 14:35:56 +00:00
committed by Mark Johnson
parent 9699514341
commit bf73761ff8
4 changed files with 34 additions and 2 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -149,6 +149,11 @@ export default class ModalQuestionBankBulkmove extends Modal {
}
await this.updateCategorySelector(e.currentTarget.value);
this.updateSaveButtonState();
// In updateCategorySelector() the HTML of the SEARCH_CATEGORY select is replaced,
// so we need to add a new event listener.
document.querySelector(ModalQuestionBankBulkmove.SELECTORS.SEARCH_CATEGORY).addEventListener("change", () => {
this.updateSaveButtonState();
});
});
this.getModal().on("click", ModalQuestionBankBulkmove.SELECTORS.SAVE_BUTTON, (e) => {
@@ -132,6 +132,33 @@ Feature: Use the qbank plugin manager page for bulkmove
And the "class" attribute of "Question 1" "table_row" should not contain "highlight"
And the "class" attribute of "Question 2" "table_row" should not contain "highlight"
@javascript
Scenario: Move a question to a different bank in a specified category
Given the following "question categories" exist:
| contextlevel | reference | name |
| Activity module | qbank2 | Test questions 3b |
And the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | truefalse | Question 1 | Answer the first question |
And I am on the "Course 1" "core_question > course question bank" page logged in as teacher1
And I apply question bank filter "Category" with value "Test questions"
And I click on "Question 1" "checkbox"
And I click on "With selected" "button"
And I click on "move" "button"
And I open the autocomplete suggestions list in the ".search-banks" "css_element"
And I click on "C2 - Question bank 2" item in the autocomplete list
And I open the autocomplete suggestions list in the ".search-categories" "css_element"
And I click on "Test questions 3b" item in the autocomplete list
And I click on "Move questions" "button"
Then I should see "Are you sure you want to move these questions?"
And I click on "Confirm" "button"
# Confirm that selected questions are moved to selected category while unselected questions are not moved.
Then I should see "Questions successfully moved"
And I should see "Test questions 3b"
And I should see "Question 1"
And I should not see "Question 2"
And I should not see "Question 3"
@javascript
Scenario: Unable to bulk move questions from history page
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"