Linkify message:// URLs in notes. Those links are used by Mail.app on

Mac OS X to link to a mail message by message id.
This commit is contained in:
Patrice Neff 2010-01-10 02:47:54 +08:00 committed by Eric Allen
parent e844b5aa5b
commit 5299490c83
5 changed files with 69 additions and 5 deletions

View file

@ -510,4 +510,44 @@ class TodosControllerTest < ActionController::TestCase
assert_select("a[href=#{url}]")
end
def test_format_note_normal
login_as(:admin_user)
todo = users(:admin_user).todos.first
todo.notes = "A normal description."
todo.save!
get :index
assert_select("div#notes_todo_#{todo.id}", "A normal description.")
end
def test_format_note_markdown
login_as(:admin_user)
todo = users(:admin_user).todos.first
todo.notes = "A *bold description*."
todo.save!
get :index
assert_select("div#notes_todo_#{todo.id}", "A bold description.")
assert_select("div#notes_todo_#{todo.id} strong", "bold description")
end
def test_format_note_link
login_as(:admin_user)
todo = users(:admin_user).todos.first
todo.notes = "A link to http://github.com/."
todo.save!
get :index
assert_select("div#notes_todo_#{todo.id}", 'A link to http://github.com/.')
assert_select("div#notes_todo_#{todo.id} a[href=http://github.com/]", 'http://github.com/')
end
def test_format_note_link_message
login_as(:admin_user)
todo = users(:admin_user).todos.first
todo.notes = "A Mail.app message://<ABCDEF-GHADB-123455-FOO-BAR@example.com> link"
todo.save!
get :index
# puts css_select("div#notes_todo_#{todo.id}")
assert_select("div#notes_todo_#{todo.id}", 'A Mail.app message://&lt;ABCDEF-GHADB-123455-FOO-BAR@example.com&gt; link')
assert_select("div#notes_todo_#{todo.id} a", 'message://&lt;ABCDEF-GHADB-123455-FOO-BAR@example.com&gt;')
assert_select("div#notes_todo_#{todo.id} a[href=message://&lt;ABCDEF-GHADB-123455-FOO-BAR@example.com&gt;]", 'message://&lt;ABCDEF-GHADB-123455-FOO-BAR@example.com&gt;')
end
end