blob: 44fdb70a787a1db095785f4d86e5602eacef65db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# frozen_string_literal: true
describe Diaspora::Markdownify::HTML do
describe "#autolink" do
before do
@html = Diaspora::Markdownify::HTML.new
end
it "should make all of the links open in a new tab" do
markdownified = @html.autolink("http://joindiaspora.com", nil)
doc = Nokogiri.parse(markdownified)
link = doc.css("a")
expect(link.attr("target").value).to eq("_blank")
end
it "should add noopener and noreferrer to autolinks' rel attributes" do
markdownified = @html.autolink("http://joindiaspora.com", nil)
doc = Nokogiri.parse(markdownified)
link = doc.css("a")
expect(link.attr("rel").value).to include("noopener", "noreferrer")
end
end
end
|