From ddbe6083265ed3dd9b42db2f4a982c4aa4e54b76 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Tue, 11 Dec 2018 17:20:06 +0100 Subject: Set URL rel attribute for broken URLs It's possible that URI fails to parse a link, but browsers still recognize given URL as a link, we should make sure that 'rel' attribute is set also in this case. --- spec/lib/banzai/filter/external_link_filter_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/lib/banzai/filter/external_link_filter_spec.rb b/spec/lib/banzai/filter/external_link_filter_spec.rb index 2a3c0cd78b8..e6dae8d5382 100644 --- a/spec/lib/banzai/filter/external_link_filter_spec.rb +++ b/spec/lib/banzai/filter/external_link_filter_spec.rb @@ -49,16 +49,16 @@ describe Banzai::Filter::ExternalLinkFilter do end context 'for invalid urls' do - it 'skips broken hrefs' do + it 'adds rel and target attributes to broken hrefs' do doc = filter %q(

Google

) - expected = %q(

Google

) + expected = %q(

Google

) expect(doc.to_html).to eq(expected) end - it 'skips improperly formatted mailtos' do + it 'adds rel and target to improperly formatted mailtos' do doc = filter %q(

Email

) - expected = %q(

Email

) + expected = %q(

Email

) expect(doc.to_html).to eq(expected) end -- cgit v1.2.1