diff --git a/mod/quiz/templates/random_question_form_preview_question_list.mustache b/mod/quiz/templates/random_question_form_preview_question_list.mustache
index ad2f9b328ac..45dfdbc7e0c 100644
--- a/mod/quiz/templates/random_question_form_preview_question_list.mustache
+++ b/mod/quiz/templates/random_question_form_preview_question_list.mustache
@@ -52,7 +52,7 @@
{{#questions}}
{{#icon}}{{#pix}} {{key}}, {{component}}, {{{alttext}}} {{/pix}}{{/icon}}
- {{name}}
+ {{{name}}}
{{/questions}}
diff --git a/mod/quiz/tests/behat/editing_add_random.feature b/mod/quiz/tests/behat/editing_add_random.feature
index 5a423a1a18a..17113976a2a 100644
--- a/mod/quiz/tests/behat/editing_add_random.feature
+++ b/mod/quiz/tests/behat/editing_add_random.feature
@@ -25,17 +25,19 @@ Feature: Adding random questions to a quiz based on category and tags
| contextlevel | reference | name | questioncategory |
| Course | C1 | Subcategory | Questions Category 1 |
And the following "questions" exist:
- | questioncategory | qtype | name | user | questiontext |
- | Questions Category 1 | essay | question 1 name | admin | Question 1 text |
- | Questions Category 1 | essay | question 2 name | teacher1 | Question 2 text |
- | Subcategory | essay | question 3 name | teacher1 | Question 3 text |
- | Subcategory | essay | question 4 name | teacher1 | Question 4 text |
+ | questioncategory | qtype | name | user | questiontext |
+ | Questions Category 1 | essay | question 1 name | admin | Question 1 text |
+ | Questions Category 1 | essay | question 2 name | teacher1 | Question 2 text |
+ | Subcategory | essay | question 3 name | teacher1 | Question 3 text |
+ | Subcategory | essay | question 4 name | teacher1 | Question 4 text |
+ | Questions Category 1 | essay | "listen" & "answer" | teacher1 | Question 5 text |
And the following "core_question > Tags" exist:
- | question | tag |
- | question 1 name | foo |
- | question 2 name | bar |
- | question 3 name | foo |
- | question 4 name | bar |
+ | question | tag |
+ | question 1 name | foo |
+ | question 2 name | bar |
+ | question 3 name | foo |
+ | question 4 name | bar |
+ | "listen" & "answer" | foo |
Scenario: Available tags are shown in the autocomplete tag field
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
@@ -80,6 +82,8 @@ Feature: Adding random questions to a quiz based on category and tags
And I click on "(See questions)" "link"
Then I should see "Questions Category 1"
And I should see "foo"
+ And I should see "question 1 name"
+ And I should see "\"listen\" & \"answer\""
Scenario: Teacher without moodle/question:useall should not see the add a random question menu item
Given the following "permission overrides" exist:
diff --git a/question/bank/managecategories/templates/listitem.mustache b/question/bank/managecategories/templates/listitem.mustache
index 5d6d8c3b955..934b002c9e2 100644
--- a/question/bank/managecategories/templates/listitem.mustache
+++ b/question/bank/managecategories/templates/listitem.mustache
@@ -33,7 +33,7 @@
- {{categoryname}}
+ {{{categoryname}}}
{{#idnumber}}
diff --git a/question/bank/managecategories/tests/behat/question_categories.feature b/question/bank/managecategories/tests/behat/question_categories.feature
index 0da4ce97fcd..4b76c27e1ff 100644
--- a/question/bank/managecategories/tests/behat/question_categories.feature
+++ b/question/bank/managecategories/tests/behat/question_categories.feature
@@ -15,11 +15,12 @@ Feature: A teacher can put questions in categories in the question bank
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
- | contextlevel | reference | questioncategory | name |
- | Course | C1 | Top | top |
- | Course | C1 | top | Default for C1 |
- | Course | C1 | Default for C1 | Subcategory |
- | Course | C1 | top | Used category |
+ | contextlevel | reference | questioncategory | name |
+ | Course | C1 | Top | top |
+ | Course | C1 | top | Default for C1 |
+ | Course | C1 | Default for C1 | Subcategory |
+ | Course | C1 | top | Used category |
+ | Course | C1 | top | Default & testing |
And the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Used category | essay | Test question to be moved | Write about whatever you want |
@@ -30,18 +31,18 @@ Feature: A teacher can put questions in categories in the question bank
When I am on the "Course 1" "core_question > course question categories" page
And I follow "Add category"
And I set the following fields to these values:
- | Name | New Category 1 |
- | Parent category | Top |
- | Category info | Created as a test |
- | ID number | newcatidnumber |
+ | Name | 'Test' & 'display' |
+ | Parent category | Default & testing |
+ | Category info | Created for testing category, HTML entity & its encoding |
+ | ID number | newcatidnumber |
And I press "submitbutton"
- Then I should see "New Category 1"
+ Then I should see "Default & testing"
And I should see "ID number"
And I should see "newcatidnumber"
And I should see "(0)"
- And I should see "Created as a test" in the "New Category 1" "list_item"
+ And I should see "Created for testing category, HTML entity & its encoding" in the "'Test' & 'display'" "list_item"
And I follow "Add category"
- And "New Category 1 [newcatidnumber]" "option" should exist in the "Parent category" "select"
+ And "'Test' & 'display' [newcatidnumber]" "option" should exist in the "Parent category" "select"
Scenario: A question category can be edited
When I am on the "Course 1" "core_question > course question categories" page
@@ -63,6 +64,7 @@ Feature: A teacher can put questions in categories in the question bank
When I am on the "Course 1" "core_question > course question categories" page
And I click on "Delete" "link" in the "Used category" "list_item"
And I should see "The category 'Used category' contains 1 questions"
+ And I select "Default for C1" from the "Category" singleselect
And I press "Save in category"
Then I should not see "Used category"
And I follow "Add category"