mirror of
https://github.com/discourse/discourse.git
synced 2025-06-23 21:41:33 +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
39
test/javascripts/acceptance/composer-attachment-test.js.es6
Normal file
39
test/javascripts/acceptance/composer-attachment-test.js.es6
Normal file
@ -0,0 +1,39 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Composer Attachment", {
|
||||
loggedIn: true,
|
||||
pretend(server, helper) {
|
||||
server.post("/uploads/lookup-urls", () => {
|
||||
return helper.response([
|
||||
{
|
||||
short_url: "upload://asdsad.png",
|
||||
url: "/uploads/default/3X/1/asjdiasjdiasida.png",
|
||||
short_path: "/uploads/short-url/asdsad.png"
|
||||
}
|
||||
]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("attachments are cooked properly", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await fillIn(".d-editor-input", "[test](upload://abcdefg.png)");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
'<p><a href="/404">test</a></p>'
|
||||
);
|
||||
|
||||
await fillIn(".d-editor-input", "[test|attachment](upload://asdsad.png)");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
'<p><a href="/uploads/short-url/asdsad.png" class="attachment">test</a></p>'
|
||||
);
|
||||
});
|
Reference in New Issue
Block a user