Fix autosize for the textarea in conversations

We need to reinit autosize when we navigate in conversations with the backbone router.
This commit is contained in:
cmrd Senya 2017-07-06 19:32:42 +03:00
parent 7b711254a5
commit 8f4498506d
No known key found for this signature in database
GPG key ID: 5FCC5BA680E67BFE
2 changed files with 4 additions and 0 deletions

View file

@ -24,6 +24,7 @@ app.views.ConversationsInbox = app.views.Base.extend({
self.selectConversation(conversationId);
self.setupConversation();
self.conversationForm.renderMarkdownEditor("#conversation-show .conversation-message-text");
autosize(self.$("#conversation-show textarea"));
}
});
},

View file

@ -35,6 +35,7 @@ describe("app.views.ConversationsInbox", function() {
spyOn(app.views.ConversationsInbox.prototype, "selectConversation");
spyOn(app.views.ConversationsInbox.prototype, "setupConversation");
spyOn(app.views.ConversationsForm.prototype, "renderMarkdownEditor");
spyOn(window, "autosize");
this.target.renderConversation(this.conversationId);
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
@ -46,6 +47,8 @@ describe("app.views.ConversationsInbox", function() {
expect(app.views.ConversationsInbox.prototype.selectConversation).toHaveBeenCalledWith(this.conversationId);
expect(app.views.ConversationsInbox.prototype.setupConversation).toHaveBeenCalled();
expect(app.views.ConversationsForm.prototype.renderMarkdownEditor).toHaveBeenCalled();
expect(window.autosize).toHaveBeenCalled();
expect(window.autosize.calls.mostRecent().args[0].is($("#conversation-show textarea")));
expect($("#conversation-new")).toHaveClass("hidden");
expect($("#conversation-show")).not.toHaveClass("hidden");
expect($("#conversation-show #fake-conversation-content").length).toBe(1);