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:
parent
7b711254a5
commit
8f4498506d
2 changed files with 4 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ app.views.ConversationsInbox = app.views.Base.extend({
|
||||||
self.selectConversation(conversationId);
|
self.selectConversation(conversationId);
|
||||||
self.setupConversation();
|
self.setupConversation();
|
||||||
self.conversationForm.renderMarkdownEditor("#conversation-show .conversation-message-text");
|
self.conversationForm.renderMarkdownEditor("#conversation-show .conversation-message-text");
|
||||||
|
autosize(self.$("#conversation-show textarea"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ describe("app.views.ConversationsInbox", function() {
|
||||||
spyOn(app.views.ConversationsInbox.prototype, "selectConversation");
|
spyOn(app.views.ConversationsInbox.prototype, "selectConversation");
|
||||||
spyOn(app.views.ConversationsInbox.prototype, "setupConversation");
|
spyOn(app.views.ConversationsInbox.prototype, "setupConversation");
|
||||||
spyOn(app.views.ConversationsForm.prototype, "renderMarkdownEditor");
|
spyOn(app.views.ConversationsForm.prototype, "renderMarkdownEditor");
|
||||||
|
spyOn(window, "autosize");
|
||||||
this.target.renderConversation(this.conversationId);
|
this.target.renderConversation(this.conversationId);
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
status: 200,
|
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.selectConversation).toHaveBeenCalledWith(this.conversationId);
|
||||||
expect(app.views.ConversationsInbox.prototype.setupConversation).toHaveBeenCalled();
|
expect(app.views.ConversationsInbox.prototype.setupConversation).toHaveBeenCalled();
|
||||||
expect(app.views.ConversationsForm.prototype.renderMarkdownEditor).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-new")).toHaveClass("hidden");
|
||||||
expect($("#conversation-show")).not.toHaveClass("hidden");
|
expect($("#conversation-show")).not.toHaveClass("hidden");
|
||||||
expect($("#conversation-show #fake-conversation-content").length).toBe(1);
|
expect($("#conversation-show #fake-conversation-content").length).toBe(1);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue