From dc63626520c5a6d461633e25e00b5f59c469cdf5 Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Fri, 5 Dec 2025 14:10:09 +0000 Subject: [PATCH] MDL-87412 qbank_managecategories: Fix "new child" drop target This fixes the CSS rule that reveals the "as new child of" drop target shown when dragging a category over another category which has no children. We can't behat test the actual drag-drop reordering behaviour with behat as reactive DragDrop components aren't testable, but we can trigger the CSS to add a regression test for the drop target's appearance. --- public/question/bank/managecategories/styles.css | 2 +- .../tests/behat/move_question_categories.feature | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/public/question/bank/managecategories/styles.css b/public/question/bank/managecategories/styles.css index c4094389078..b9341ad9ab5 100644 --- a/public/question/bank/managecategories/styles.css +++ b/public/question/bank/managecategories/styles.css @@ -84,7 +84,7 @@ /* stylelint-disable max-line-length */ .qbank_managecategories-newchild.qbank_managecategories-droptarget, /* Show the drop target if it's directly inside a highlighted category, but not if its inside a child of that category */ -.qbank_managecategories-droptarget-before > .container > .row > .qbank_managecategories-contentcontainer > :not(.qbank_managecategories-childlistcontainer) .qbank_managecategories-newchild { +.qbank_managecategories-droptarget-before > .container > div > .qbank_managecategories-contentcontainer > :not(.qbank_managecategories-childlistcontainer) .qbank_managecategories-newchild { display: unset; } /* stylelint-enable max-line-length */ diff --git a/public/question/bank/managecategories/tests/behat/move_question_categories.feature b/public/question/bank/managecategories/tests/behat/move_question_categories.feature index 86dde644d74..995be152b68 100644 --- a/public/question/bank/managecategories/tests/behat/move_question_categories.feature +++ b/public/question/bank/managecategories/tests/behat/move_question_categories.feature @@ -93,3 +93,14 @@ Feature: A teacher can reorder question categories And I should not see "Course category 1" in the "Parent category" "field" And I should see "Course category 2" in the "Parent category" "field" And I should not see "Course category 3" in the "Parent category" "field" + + Scenario: Dragging a category over a category with no children shows an "as new child" drop target. + Given the following "question categories" exist: + | contextlevel | reference | name | idnumber | questioncategory | + | Activity module | qbank1 | Course category 4 | questioncat4 | Course category 2 | + And I reload the page + And I change viewport size to "large" + And I drag "Course category 3" "list_item" and I drop it in "Course category 2" "text" + And I should not see "+" in the "Course category 2" "list_item" + When I drag "Course category 3" "list_item" and I drop it in "Course category 1" "text" + Then I should see "+" in the "Course category 1" "list_item"