Merge pull request #6870 from svbergerem/update-status-message-text-prefill-mention

Update status message text after prefilling mentions
This commit is contained in:
Dennis Schubert 2016-06-19 01:03:26 +02:00 committed by GitHub
commit f1e296cc52
2 changed files with 19 additions and 0 deletions

View file

@ -135,6 +135,10 @@ app.views.Publisher = Backbone.View.extend({
});
this.viewPollCreator.on("change", this.checkSubmitAvailability, this);
this.viewPollCreator.render();
if (this.prefillMention) {
this.handleTextchange();
}
},
// set the selected aspects in the dropdown by their ids

View file

@ -47,6 +47,21 @@ describe("app.views.Publisher", function() {
this.view = new app.views.Publisher();
});
describe("#initSubviews", function() {
it("calls handleTextchange if the publisher is prefilled with mentions", function() {
spyOn(this.view, "handleTextchange");
this.view.prefillMention = "user@example.org";
this.view.initSubviews();
expect(this.view.handleTextchange).toHaveBeenCalled();
});
it("doesn't call handleTextchange if there are no prefilled mentions", function() {
spyOn(this.view, "handleTextchange");
this.view.initSubviews();
expect(this.view.handleTextchange).not.toHaveBeenCalled();
});
});
describe("#open", function() {
it("removes the 'closed' class from the publisher element", function() {
expect($(this.view.el)).toHaveClass("closed");