MDL-76550 Quiz and qbank: Fix display of Category and question names

This commit is contained in:
Anupama Sarjoshi 2022-12-02 15:04:47 +00:00
parent 1d863c338a
commit 9e77d14a7b
4 changed files with 30 additions and 24 deletions

View File

@ -52,7 +52,7 @@
{{#questions}}
<li class="list-group-item text-truncate">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{{alttext}}} {{/pix}}{{/icon}}
{{name}}
{{{name}}}
</li>
{{/questions}}
</ul>

View File

@ -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:

View File

@ -33,7 +33,7 @@
<b>
<a title="{{#str}}editquestions, question{{/str}}" href="{{{questionbankurl}}}">
{{categoryname}}
{{{categoryname}}}
{{#idnumber}}
<span class="badge badge-primary">
<span class="accesshide">

View File

@ -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"