FIX: allow pasting links into title field that are longer than the max title length

This commit is contained in:
Neil Lalonde
2017-05-18 12:32:35 -04:00
parent 29755be139
commit dbb814ec6a
4 changed files with 22 additions and 3 deletions

View File

@ -3,7 +3,8 @@ import { acceptance } from "helpers/qunit-helpers";
acceptance("Composer topic featured links", {
loggedIn: true,
settings: {
topic_featured_link_enabled: true
topic_featured_link_enabled: true,
max_topic_title_length: 80
}
});
@ -52,3 +53,14 @@ test("ignore internal links", () => {
equal(find('.title-input input').val(), title, "title is unchanged");
});
});
test("link is longer than max title length", () => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "http://www.example.com/has-title-and-a-url-that-is-more-than-80-characters-because-thats-good-for-seo-i-guess.html");
andThen(() => {
ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
equal(find('.title-input input').val(), "An interesting article", "title is from the oneboxed article");
});
});

View File

@ -335,7 +335,7 @@ export default function() {
this.delete('/admin/badges/:id', success);
this.get('/onebox', request => {
if (request.queryParams.url === 'http://www.example.com/has-title.html') {
if (request.queryParams.url.startsWith('http://www.example.com/has-title')) {
return [
200,
{"Content-Type": "application/html"},