Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

References #404 - Added html_safe call to the non-image answer type in... #405

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/surveyor/helpers/surveyor_helper_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def render_help_text(obj, context=nil)
# Answers
def a_text(obj, pos=nil, context = nil)
return image_tag(obj.text) if obj.is_a?(Answer) and obj.display_type == "image"
obj.split_or_hidden_text(pos, context)
obj.split_or_hidden_text(pos, context).html_safe
end

def rc_to_attr(type_sym)
Expand Down
8 changes: 7 additions & 1 deletion spec/helpers/surveyor_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ def group
helper.a_text(a2, nil, FakeMustacheContext).should == "Yes, I do work for Northwestern"
end

it "should return html_safe text for answer" do
q1 = Factory(:question, :text => "Do you work for {{site}}", :answers => [a1 = Factory(:answer, :text => "No, I don't work for {{site}}"), a2 = Factory(:answer, :text => "Yes, I do work for {{site}}") ])
helper.a_text(a1, nil, FakeMustacheContext).html_safe?.should be_true
end


it "should return the group text with number" do
g1 = Factory(:question_group)
helper.q_text(g1, FakeMustacheContext).should == "<span class='qnum'>1) </span>#{g1.text}"
Expand Down Expand Up @@ -151,4 +157,4 @@ def rc_to_as(type_sym)
end
end

end
end