mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Don't apply markdown to content of [quote] -- it messes up spacing.
This commit is contained in:
@@ -202,14 +202,19 @@ describe("Discourse.BBCode", function() {
|
||||
|
||||
describe("quoting", function() {
|
||||
|
||||
// Format text without an avatar lookup
|
||||
function formatQuote(text) {
|
||||
return format(text, {lookupAvatar: false});
|
||||
}
|
||||
|
||||
it("can quote", function() {
|
||||
expect(format("[quote=\"eviltrout, post:1, topic:1\"]abc[/quote]", { lookupAvatar: false })).
|
||||
expect(formatQuote("[quote=\"eviltrout, post:1, topic:1\"]abc[/quote]")).
|
||||
toBe("</p><aside class='quote' data-post=\"1\" data-topic=\"1\" >\n <div class='title'>\n " +
|
||||
"<div class='quote-controls'></div>\n \n eviltrout\n said:\n </div>\n <blockquote>abc</blockquote>\n</aside>\n<p>");
|
||||
});
|
||||
|
||||
it("can nest quotes", function() {
|
||||
expect(format("[quote=\"eviltrout, post:1, topic:1\"]abc[quote=\"eviltrout, post:2, topic:2\"]nested[/quote][/quote]", { lookupAvatar: false })).
|
||||
expect(formatQuote("[quote=\"eviltrout, post:1, topic:1\"]abc[quote=\"eviltrout, post:2, topic:2\"]nested[/quote][/quote]")).
|
||||
toBe("</p><aside class='quote' data-post=\"1\" data-topic=\"1\" >\n <div class='title'>\n <div " +
|
||||
"class='quote-controls'></div>\n \n eviltrout\n said:\n </div>\n <blockquote>abc</p><aside " +
|
||||
"class='quote' data-post=\"2\" data-topic=\"2\" >\n <div class='title'>\n <div class='quote-" +
|
||||
@@ -217,13 +222,27 @@ describe("Discourse.BBCode", function() {
|
||||
});
|
||||
|
||||
it("can handle more than one quote", function() {
|
||||
expect(format("before[quote=\"eviltrout, post:1, topic:1\"]first[/quote]middle[quote=\"eviltrout, post:2, topic:2\"]second[/quote]after", { lookupAvatar: false })).
|
||||
expect(formatQuote("before[quote=\"eviltrout, post:1, topic:1\"]first[/quote]middle[quote=\"eviltrout, post:2, topic:2\"]second[/quote]after")).
|
||||
toBe("before</p><aside class='quote' data-post=\"1\" data-topic=\"1\" >\n <div class='title'>\n <div class='quote-cont" +
|
||||
"rols'></div>\n \n eviltrout\n said:\n </div>\n <blockquote>first</blockquote>\n</aside>\n<p>middle</p><aside cla" +
|
||||
"ss='quote' data-post=\"2\" data-topic=\"2\" >\n <div class='title'>\n <div class='quote-controls'></div>\n \n " +
|
||||
"eviltrout\n said:\n </div>\n <blockquote>second</blockquote>\n</aside>\n<p>after");
|
||||
});
|
||||
|
||||
describe("extractQuotes", function() {
|
||||
|
||||
var extractQuotes = Discourse.BBCode.extractQuotes;
|
||||
|
||||
it("returns an object a template renderer", function() {
|
||||
var q = "[quote=\"eviltrout, post:1, topic:2\"]hello[/quote]";
|
||||
var result = extractQuotes(q + " world");
|
||||
|
||||
expect(result.text).toBe(md5(q) + "\n world");
|
||||
expect(result.template).not.toBe(null);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("buildQuoteBBCode", function() {
|
||||
|
||||
var build = Discourse.BBCode.buildQuoteBBCode;
|
||||
|
||||
@@ -24,7 +24,7 @@ describe("Discourse.Markdown", function() {
|
||||
lookupAvatar: function(name) { return "" + name; }
|
||||
});
|
||||
expect(cooked).toBe("<p>1</p><aside class='quote' data-post=\"1\" >\n <div class='title'>\n <div class='quote-controls'></div>\n" +
|
||||
" bob\n bob\n said:\n </div>\n <blockquote>my quote</blockquote>\n</aside>\n<p>2</p>");
|
||||
" bob\n bob\n said:\n </div>\n <blockquote>my quote</blockquote>\n</aside>\n<p> <br>\n2</p>");
|
||||
});
|
||||
|
||||
it("includes no avatar if none is found", function() {
|
||||
@@ -33,7 +33,7 @@ describe("Discourse.Markdown", function() {
|
||||
lookupAvatar: function(name) { return null; }
|
||||
});
|
||||
expect(cooked).toBe("<p>1</p><aside class='quote' data-post=\"1\" >\n <div class='title'>\n <div class='quote-controls'></div>\n" +
|
||||
" \n bob\n said:\n </div>\n <blockquote>my quote</blockquote>\n</aside>\n<p>2</p>");
|
||||
" \n bob\n said:\n </div>\n <blockquote>my quote</blockquote>\n</aside>\n<p> <br>\n2</p>");
|
||||
});
|
||||
|
||||
describe("Links", function() {
|
||||
|
||||
Reference in New Issue
Block a user