You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
856 B

require 'active_support/core_ext/object/blank'
require_relative '../../../app/helpers/carto/html_safe'
describe Carto::HtmlSafe do
let(:html_safe) do
class TestModule; include Carto::HtmlSafe; end.new
end
it 'sets target="blank" for links' do
link = 'http://www.carto.com'
html_safe.markdown_html_safe("[text](#{link})").should eq "<p><a href=\"#{link}\" target=\"_blank\">text</a></p>\n"
end
it 'does not set target="blank" for mailto markdown' do
mailto = 'mailto:wadus@example.com'
html_safe.markdown_html_safe("[text](#{mailto})").should eq "<p><a href=\"#{mailto}\">text</a></p>\n"
end
it 'does not set target="blank" for mailto links' do
mail = 'wadus@example.com'
mailto = 'mailto:' + mail
html_safe.markdown_html_safe("<#{mailto}>").should eq "<p><a href=\"#{mailto}\">#{mail}</a></p>\n"
end
end