FEATURE: links that can't have no onebox can be used as featured topic links

This commit is contained in:
Neil Lalonde 2017-02-17 18:35:19 -05:00
parent bebc55eebd
commit a6ebe495bf
2 changed files with 4 additions and 3 deletions

View File

@ -68,7 +68,8 @@ export default Ember.Component.extend({
if (loadOnebox && loadOnebox.then) {
loadOnebox.then( () => {
this._updatePost(lookupCache(this.get('composer.title')));
const v = lookupCache(this.get('composer.title'));
this._updatePost(v ? v : link);
}).finally(() => {
this.set('composer.loading', false);
Ember.run.schedule('afterRender', () => { this.$('input').putCursorAtEnd(); });

View File

@ -35,8 +35,8 @@ test("no onebox result", () => {
click('#create-topic');
fillIn('#reply-title', "http://www.example.com/nope-onebox.html");
andThen(() => {
equal(find('.d-editor-preview').html().trim().indexOf('onebox'), -1, "link isn't put into the post");
equal(find('.d-editor-input').val().length, 0, "link isn't put into the post");
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'), 'link is pasted into body');
equal(find('.title-input input').val(), "http://www.example.com/nope-onebox.html", "title is unchanged");
});
});