Call autosize when changing input via markdown editor

Fixes #7521
This commit is contained in:
Steffen van Bergerem 2017-08-10 16:42:08 +02:00
parent 9d2d20e854
commit d4bdb2fcb4
No known key found for this signature in database
GPG key ID: 315C9787D548DC6B
2 changed files with 6 additions and 1 deletions

View file

@ -9,7 +9,8 @@ Diaspora.MarkdownEditor.prototype = {
this.options = { this.options = {
resize: "none", resize: "none",
onHidePreview: $.noop, onHidePreview: $.noop,
onPostPreview: $.noop onPostPreview: $.noop,
onChange: function(e) { autosize.update(e.$textarea); }
}; };
$.extend(this.options, opts); $.extend(this.options, opts);

View file

@ -31,6 +31,7 @@ describe("Diaspora.MarkdownEditor", function() {
it("call $.fn.markdown with correct default options", function() { it("call $.fn.markdown with correct default options", function() {
spyOn($.fn, "markdown"); spyOn($.fn, "markdown");
spyOn(autosize, "update");
this.target.initialize(this.$el, {}); this.target.initialize(this.$el, {});
expect($.fn.markdown).toHaveBeenCalled(); expect($.fn.markdown).toHaveBeenCalled();
var args = $.fn.markdown.calls.mostRecent().args[0]; var args = $.fn.markdown.calls.mostRecent().args[0];
@ -40,6 +41,9 @@ describe("Diaspora.MarkdownEditor", function() {
expect(args.onPostPreview).toBe($.noop); expect(args.onPostPreview).toBe($.noop);
expect(args.fullscreen).toEqual({enable: false, icons: {}}); expect(args.fullscreen).toEqual({enable: false, icons: {}});
expect(args.hiddenButtons).toEqual(["cmdPreview"]); expect(args.hiddenButtons).toEqual(["cmdPreview"]);
args.onChange({$textarea: "el"});
expect(autosize.update).toHaveBeenCalledWith("el");
}); });
it("overrides fullscreen, hiddenButtons, language and onShow options", function() { it("overrides fullscreen, hiddenButtons, language and onShow options", function() {