@@ -29,8 +29,8 | |||||
29 | <h3><%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)</h3> |
|
29 | <h3><%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)</h3> | |
30 | <dl id="search-results"> |
|
30 | <dl id="search-results"> | |
31 | <% @results.each do |e| %> |
|
31 | <% @results.each do |e| %> | |
32 |
<dt class="<%= e.event_type %>"><%= content_tag('span', h(e.project), :class => 'project') unless @project == e.project %> <%= link_to highlight_tokens(truncate( |
|
32 | <dt class="<%= e.event_type %>"><%= content_tag('span', h(e.project), :class => 'project') unless @project == e.project %> <%= link_to highlight_tokens(truncate(e.event_title, :length => 255), @tokens), e.event_url %></dt> | |
33 |
<dd><span class="description"><%= highlight_tokens( |
|
33 | <dd><span class="description"><%= highlight_tokens(e.event_description, @tokens) %></span> | |
34 | <span class="author"><%= format_time(e.event_datetime) %></span></dd> |
|
34 | <span class="author"><%= format_time(e.event_datetime) %></span></dd> | |
35 | <% end %> |
|
35 | <% end %> | |
36 | </dl> |
|
36 | </dl> |
@@ -199,4 +199,24 class SearchControllerTest < ActionController::TestCase | |||||
199 | get :index, :id => 1, :q => '"good bye" hello "bye bye"' |
|
199 | get :index, :id => 1, :q => '"good bye" hello "bye bye"' | |
200 | assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens) |
|
200 | assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens) | |
201 | end |
|
201 | end | |
|
202 | ||||
|
203 | def test_results_should_be_escaped_once | |||
|
204 | assert Issue.find(1).update_attributes(:subject => '<subject> escaped_once', :description => '<description> escaped_once') | |||
|
205 | get :index, :q => 'escaped_once' | |||
|
206 | assert_response :success | |||
|
207 | assert_select '#search-results' do | |||
|
208 | assert_select 'dt.issue a', :text => /<subject>/ | |||
|
209 | assert_select 'dd', :text => /<description>/ | |||
|
210 | end | |||
|
211 | end | |||
|
212 | ||||
|
213 | def test_keywords_should_be_highlighted | |||
|
214 | assert Issue.find(1).update_attributes(:subject => 'subject highlighted', :description => 'description highlighted') | |||
|
215 | get :index, :q => 'highlighted' | |||
|
216 | assert_response :success | |||
|
217 | assert_select '#search-results' do | |||
|
218 | assert_select 'dt.issue a span.highlight', :text => 'highlighted' | |||
|
219 | assert_select 'dd span.highlight', :text => 'highlighted' | |||
|
220 | end | |||
|
221 | end | |||
202 | end |
|
222 | end |
General Comments 0
You need to be logged in to leave comments.
Login now