Skip to content

Commit 7f25924

Browse files
committed
MDL-82657 qbank_managecategories: Check "includesubcategories" on reload
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.
1 parent 505987a commit 7f25924

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

question/bank/managecategories/amd/build/datafilter/filtertypes/categories.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

question/bank/managecategories/amd/build/datafilter/filtertypes/categories.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

question/bank/managecategories/amd/src/datafilter/filtertypes/categories.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export default class extends GenericFilter {
3131
includeSubcategories: 'input[name=category-subcategories]',
3232
};
3333

34-
constructor(filterType, rootNode, initialValues, filterOptions = {includeSubcategories: false}) {
34+
constructor(filterType, rootNode, initialValues, filterOptions = {includesubcategories: false}) {
3535
super(filterType, rootNode, initialValues);
36-
this.addSubcategoryCheckbox(filterOptions.includeSubcategories);
36+
this.addSubcategoryCheckbox(filterOptions.includesubcategories);
3737
}
3838

3939
async addSubcategoryCheckbox(checked = false) {

question/bank/managecategories/tests/behat/question_categories.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,6 @@ Feature: A teacher can put questions in categories in the question bank
9999
When I set the field "Also show questions from subcategories" to "1"
100100
And I click on "Apply filters" "button"
101101
Then I should see "Question 1" in the "categoryquestions" "table"
102+
When I reload the page
103+
Then I should see "Question 1" in the "categoryquestions" "table"
104+
And the field "Also show questions from subcategories" matches value "1"

0 commit comments

Comments
 (0)