Skip to content

Commit

Permalink
MDL-82657 qbank_managecategories: Check "includesubcategories" on reload
Browse files Browse the repository at this point in the history
The "includesubcategories" parameter is passed in the URL as lowercase,
but the Javascript was looking for "includeSubcategories" in camel case.
This meant it was always being set as false (unchecked) even when the
URL said it was true.

This fixes the casing in the Javascript, and adds a behat test to
confirm the fix.
  • Loading branch information
marxjohnson committed Nov 25, 2024
1 parent 505987a commit 7f25924
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default class extends GenericFilter {
includeSubcategories: 'input[name=category-subcategories]',
};

constructor(filterType, rootNode, initialValues, filterOptions = {includeSubcategories: false}) {
constructor(filterType, rootNode, initialValues, filterOptions = {includesubcategories: false}) {
super(filterType, rootNode, initialValues);
this.addSubcategoryCheckbox(filterOptions.includeSubcategories);
this.addSubcategoryCheckbox(filterOptions.includesubcategories);
}

async addSubcategoryCheckbox(checked = false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ Feature: A teacher can put questions in categories in the question bank
When I set the field "Also show questions from subcategories" to "1"
And I click on "Apply filters" "button"
Then I should see "Question 1" in the "categoryquestions" "table"
When I reload the page
Then I should see "Question 1" in the "categoryquestions" "table"
And the field "Also show questions from subcategories" matches value "1"

0 comments on commit 7f25924

Please sign in to comment.