mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:13:39 +08:00
FEATURE: Support [description|attachment](upload://<short-sha>)
in MD. (#7603)
This commit is contained in:

committed by
Penar Musaraj

parent
42818b810e
commit
b1d3c678ca
@ -165,14 +165,19 @@ QUnit.test("allows valid uploads to go through", assert => {
|
||||
assert.not(bootbox.alert.calledOnce);
|
||||
});
|
||||
|
||||
var testUploadMarkdown = function(filename) {
|
||||
return getUploadMarkdown({
|
||||
original_filename: filename,
|
||||
filesize: 42,
|
||||
thumbnail_width: 100,
|
||||
thumbnail_height: 200,
|
||||
url: "/uploads/123/abcdef.ext"
|
||||
});
|
||||
var testUploadMarkdown = function(filename, opts = {}) {
|
||||
return getUploadMarkdown(
|
||||
Object.assign(
|
||||
{
|
||||
original_filename: filename,
|
||||
filesize: 42,
|
||||
thumbnail_width: 100,
|
||||
thumbnail_height: 200,
|
||||
url: "/uploads/123/abcdef.ext"
|
||||
},
|
||||
opts
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
QUnit.test("getUploadMarkdown", assert => {
|
||||
@ -184,9 +189,12 @@ QUnit.test("getUploadMarkdown", assert => {
|
||||
testUploadMarkdown("[foo|bar].png"),
|
||||
""
|
||||
);
|
||||
assert.ok(
|
||||
testUploadMarkdown("important.txt") ===
|
||||
'<a class="attachment" href="/uploads/123/abcdef.ext">important.txt</a> (42 Bytes)\n'
|
||||
|
||||
const short_url = "uploads://asdaasd.ext";
|
||||
|
||||
assert.equal(
|
||||
testUploadMarkdown("important.txt", { short_url }),
|
||||
`[important.txt (42 Bytes)|attachment](${short_url})`
|
||||
);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user