diff --git a/app/helpers/note_helper.rb b/app/helpers/note_helper.rb
index 21c8fa51e..2e9850aef 100644
--- a/app/helpers/note_helper.rb
+++ b/app/helpers/note_helper.rb
@@ -18,7 +18,8 @@ module NoteHelper
elsif author.status == "deleted"
t("users.no_such_user.deleted")
else
- link_to h(author.display_name), link_options.merge(:controller => "/users", :action => "show", :display_name => author.display_name)
+ link_to h(author.display_name), link_options.merge(:controller => "/users", :action => "show", :display_name => author.display_name),
+ :class => "mw-100 d-inline-block align-bottom text-truncate text-wrap", :dir => "auto"
end
end
end
diff --git a/app/views/notes/show.html.erb b/app/views/notes/show.html.erb
index 8dda65c25..d17612e29 100644
--- a/app/views/notes/show.html.erb
+++ b/app/views/notes/show.html.erb
@@ -9,19 +9,17 @@
-
- - <%= note_event("opened", @note.created_at, @note.author) %>
- <% if @note.status == "closed" %>
- - <%= note_event(@note.status, @note.closed_at, @note.all_comments.last.author) %>
- <% end %>
- -
- <%= t "browse.location" %>
- <%= link_to(t(".coordinates_html",
- :latitude => tag.span(number_with_delimiter(@note.lat), :class => "latitude"),
- :longitude => tag.span(number_with_delimiter(@note.lon), :class => "longitude")),
- root_path(:anchor => "map=18/#{@note.lat}/#{@note.lon}")) %>
-
-
+
<%= note_event("opened", @note.created_at, @note.author) %>
+ <% if @note.status == "closed" %>
+
<%= note_event(@note.status, @note.closed_at, @note.all_comments.last.author) %>
+ <% end %>
+
+ <%= t "browse.location" %>
+ <%= link_to t(".coordinates_html",
+ :latitude => tag.span(number_with_delimiter(@note.lat), :class => "latitude"),
+ :longitude => tag.span(number_with_delimiter(@note.lon), :class => "longitude")),
+ root_path(:anchor => "map=18/#{@note.lat}/#{@note.lon}") %>
+
<% if @note_comments.find { |comment| comment.author.nil? } -%>
diff --git a/test/helpers/note_helper_test.rb b/test/helpers/note_helper_test.rb
index bee1cdc2c..8b8173694 100644
--- a/test/helpers/note_helper_test.rb
+++ b/test/helpers/note_helper_test.rb
@@ -8,8 +8,25 @@ class NoteHelperTest < ActionView::TestCase
date = Time.utc(2014, 3, 5, 21, 37, 45)
user = create(:user)
- assert_match %r{^Created by anonymous $}, note_event("opened", date, nil)
- assert_match %r{^Resolved by #{user.display_name} $}, note_event("closed", date, user)
+ note_event_dom = Rails::Dom::Testing.html_document_fragment.parse "#{note_event('opened', date, nil)}
"
+ assert_dom note_event_dom, ":root", :text => /^Created by anonymous .* ago$/ do
+ assert_dom "> a", :count => 0
+ assert_dom "> time", :count => 1 do
+ assert_dom "> @title", "5 March 2014 at 21:37"
+ assert_dom "> @datetime", "2014-03-05T21:37:45Z"
+ end
+ end
+
+ note_event_dom = Rails::Dom::Testing.html_document_fragment.parse "#{note_event('closed', date, user)}
"
+ assert_dom note_event_dom, ":root", :text => /^Resolved by #{user.display_name} .* ago$/ do
+ assert_dom "> a", :count => 1, :text => user.display_name do
+ assert_dom "> @href", "/user/#{ERB::Util.u(user.display_name)}"
+ end
+ assert_dom "> time", :count => 1 do
+ assert_dom "> @title", "5 March 2014 at 21:37"
+ assert_dom "> @datetime", "2014-03-05T21:37:45Z"
+ end
+ end
end
def test_note_author
@@ -17,8 +34,17 @@ class NoteHelperTest < ActionView::TestCase
user = create(:user)
assert_equal "", note_author(nil)
+
assert_equal "deleted", note_author(deleted_user)
- assert_equal "#{user.display_name}", note_author(user)
- assert_equal "#{user.display_name}", note_author(user, :only_path => false)
+
+ note_author_dom = Rails::Dom::Testing.html_document_fragment.parse note_author(user)
+ assert_dom note_author_dom, "a:root", :text => user.display_name do
+ assert_dom "> @href", "/user/#{ERB::Util.u(user.display_name)}"
+ end
+
+ note_author_dom = Rails::Dom::Testing.html_document_fragment.parse note_author(user, :only_path => false)
+ assert_dom note_author_dom, "a:root", :text => user.display_name do
+ assert_dom "> @href", "http://test.host/user/#{ERB::Util.u(user.display_name)}"
+ end
end
end