From 232de90607673b167a64fb42f60e24dd19acbf0c Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 27 Jun 2017 15:34:16 -0400 Subject: [PATCH] explicit autolink should not be oneboxed --- .../javascripts/pretty-text/engines/markdown-it/onebox.js.es6 | 2 +- spec/components/pretty_text_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/pretty-text/engines/markdown-it/onebox.js.es6 b/app/assets/javascripts/pretty-text/engines/markdown-it/onebox.js.es6 index 03c069475ea..e2babeafbeb 100644 --- a/app/assets/javascripts/pretty-text/engines/markdown-it/onebox.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/markdown-it/onebox.js.es6 @@ -17,7 +17,7 @@ function applyOnebox(state, silent) { for(j=0;j 0 && token.children[j-1].tag !== 'br') { diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb index 9e9b26fa0c7..96104ff60ee 100644 --- a/spec/components/pretty_text_spec.rb +++ b/spec/components/pretty_text_spec.rb @@ -312,7 +312,7 @@ HTML expect(PrettyText.excerpt(emoji_code, 100)).to eq(":heart:") end - context 'option ot preserve onebox source' do + context 'option to preserve onebox source' do it "should return the right excerpt" do onebox = "\n\n\n" expected = "meta.discourse.org" @@ -629,6 +629,7 @@ HTML expect(PrettyText.cook("http://a.com ")).to include('onebox') expect(PrettyText.cook("http://a.com a")).not_to include('onebox') expect(PrettyText.cook("- http://a.com")).not_to include('onebox') + expect(PrettyText.cook("")).not_to include('onebox') end it "can handle bbcode" do