Skip to content

Commit 27a0e45

Browse files
Stop escaping of text that has been run through the filters as html(#439)
* Adding behat test to verify. Co-authored-by: Andrew Hancox <[email protected]>
1 parent a73fbbb commit 27a0e45

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

templates/results_choice.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
{{#responses}}
8888
{{#response}}
8989
<tr class="">
90-
<td class="cell c0" style="text-align:left;width:50%;">{{response.text}}</td>
90+
<td class="cell c0" style="text-align:left;width:50%;">{{{response.text}}}</td>
9191
<td class="cell c1" style="text-align:left;width:40%;white-space:nowrap;">
9292
<img style="height:9px; width:4px;" alt="{{response.alt1}}" src="{{response.image1}}" /><img style="height:9px; width:{{response.width2}}px;" alt="{{response.alt2}}" src="{{response.image2}}" /><img style="height:9px; width:4px;" alt="{{response.alt3}}" src="{{response.image3}}" />
9393
{{{response.percent}}}

tests/behat/check_responses.feature

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,44 @@ Feature: Review responses
8080
And I press "Delete"
8181
Then I should see "You are not eligible to take this questionnaire."
8282
And I should not see "View all responses"
83+
84+
@javascript
85+
Scenario: Choices with HTML should display filtered HTML in the responses on the response page
86+
Given the following "users" exist:
87+
| username | firstname | lastname | email |
88+
| teacher1 | Teacher | 1 | teacher1@example.com |
89+
| student1 | Student | 1 | student1@example.com |
90+
And the following "courses" exist:
91+
| fullname | shortname | category |
92+
| Course 1 | C1 | 0 |
93+
And the following "course enrolments" exist:
94+
| user | course | role |
95+
| teacher1 | C1 | editingteacher |
96+
| student1 | C1 | student |
97+
And the following "activities" exist:
98+
| activity | name | description | course | idnumber |
99+
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 |
100+
And I log in as "teacher1"
101+
And I am on "Course 1" course homepage
102+
And I follow "Test questionnaire"
103+
And I navigate to "Questions" in current page administration
104+
And I add a "Check Boxes" question and I fill the form with:
105+
| Question Name | Q1 |
106+
| Yes | y |
107+
| Min. forced responses | 1 |
108+
| Max. forced responses | 2 |
109+
| Question Text | Select one or two choices only |
110+
| Possible answers | <b>One</b>,Two,Three,Four |
111+
And I log in as "student1"
112+
And I am on "Course 1" course homepage
113+
And I follow "Test questionnaire"
114+
And I navigate to "Answer the questions..." in current page administration
115+
Then I should see "Select one or two choices only"
116+
# And I set the field "Do you own a car?" to "y"
117+
And I set the field "One" to "checked"
118+
And I press "Submit questionnaire"
119+
And I log in as "teacher1"
120+
And I am on "Course 1" course homepage
121+
And I follow "Test questionnaire"
122+
And I navigate to "View all responses" in current page administration
123+
Then "//b[text()='One']" "xpath_element" should exist

0 commit comments

Comments
 (0)