BUGFIX: newline after bold was not producting a BR
This commit is contained in:
parent
dd8a06187a
commit
b8357aa90a
|
@ -21,10 +21,8 @@ Discourse.Dialect.postProcessText(function (text, event) {
|
|||
if (split.length) {
|
||||
var replacement = [];
|
||||
for (var i=0; i<split.length; i++) {
|
||||
if (split[i].length > 0) {
|
||||
replacement.push(split[i]);
|
||||
if (i !== split.length-1) { replacement.push(['br']); }
|
||||
}
|
||||
if (split[i].length > 0) { replacement.push(split[i]); }
|
||||
if (i !== split.length-1) { replacement.push(['br']); }
|
||||
}
|
||||
|
||||
return replacement;
|
||||
|
|
|
@ -240,4 +240,19 @@ describe PrettyText do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
describe "markdown quirks" do
|
||||
it "allows for newline after bold" do
|
||||
PrettyText.cook("**hello**\nworld").should match_html "<p><strong>hello</strong><br />world</p>"
|
||||
end
|
||||
it "allows for newline for 2 bolds" do
|
||||
PrettyText.cook("**hello**\n**world**").should match_html "<p><strong>hello</strong><br /><strong>world</strong></p>"
|
||||
end
|
||||
|
||||
pending "does not break a streak for mentions" do
|
||||
Fabricate(:user, username: 'sam')
|
||||
PrettyText.cook("<small>a @sam c</small>").should match_html "<p><small>a <a class='mention' href='/users/sam'>@sam</a> c</small></p>"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,11 +5,11 @@ describe PostAnalyzer do
|
|||
let(:default_topic_id) { 12 }
|
||||
|
||||
describe '#cook' do
|
||||
let(:post_analyzer) { described_class.new nil, nil }
|
||||
let(:post_analyzer) {PostAnalyzer.new nil, nil }
|
||||
|
||||
let(:args) { [raw, options] }
|
||||
let(:raw) { "Here's a tweet:\n#{url}" }
|
||||
let(:options) { {} }
|
||||
let(:args) { [raw, options] }
|
||||
|
||||
let(:url) {
|
||||
'https://twitter.com/evil_trout/status/345954894420787200'
|
||||
|
|
Loading…
Reference in New Issue