Merge branch 'svbergerem-textarea-autosize' into develop
This commit is contained in:
commit
26e37c46bd
10 changed files with 43 additions and 13 deletions
|
|
@ -81,6 +81,7 @@ Contributions are very welcome, the hard work is done!
|
|||
* Refactor mobile comment section [#6509](https://github.com/diaspora/diaspora/pull/6509)
|
||||
* Set vertical resize as default for all textareas [#6654](https://github.com/diaspora/diaspora/pull/6654)
|
||||
* Unifiy max-widths and page layouts [#6675](https://github.com/diaspora/diaspora/pull/6675)
|
||||
* Enable autosizing for all textareas [6674](https://github.com/diaspora/diaspora/pull/6674)
|
||||
|
||||
## Bug fixes
|
||||
* Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852)
|
||||
|
|
|
|||
|
|
@ -144,6 +144,9 @@ var app = {
|
|||
// add placeholder support for old browsers
|
||||
$("input, textarea").placeholder();
|
||||
|
||||
// init autosize plugin
|
||||
autosize($("textarea"));
|
||||
|
||||
// setup remote forms
|
||||
$(document).on("ajax:success", "form[data-remote]", function() {
|
||||
$(this).clearForm();
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ app.views.Base = Backbone.View.extend({
|
|||
// add placeholder support for old browsers
|
||||
this.$("input, textarea").placeholder();
|
||||
|
||||
// init autosize plugin
|
||||
autosize(this.$("textarea"));
|
||||
|
||||
this.postRenderTemplate();
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ app.views.CommentStream = app.views.Base.extend({
|
|||
|
||||
// add autoexpanders to new comment textarea
|
||||
this.$("textarea").val(this.textareaValue);
|
||||
autosize(this.$("textarea"));
|
||||
autosize.update(this.$("textarea"));
|
||||
},
|
||||
|
||||
presenter: function(){
|
||||
|
|
|
|||
|
|
@ -94,9 +94,6 @@ app.views.Publisher = Backbone.View.extend({
|
|||
this.viewPollCreator.render();
|
||||
});
|
||||
|
||||
// init autosize plugin
|
||||
autosize(this.inputEl);
|
||||
|
||||
this.initSubviews();
|
||||
this.checkSubmitAvailability();
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ $(document).ready(function(){
|
|||
.toggleClass('inactive');
|
||||
};
|
||||
|
||||
// init autosize plugin
|
||||
autosize($("textarea"));
|
||||
|
||||
/* Drawer menu */
|
||||
$("#menu-badge").bind("tap click", function(evt){
|
||||
evt.preventDefault();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,4 @@ $(document).ready(function(){
|
|||
evt.preventDefault();
|
||||
$("#new_status_message").submit();
|
||||
});
|
||||
|
||||
autosize($("#status_message_text"));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -45,6 +45,13 @@ describe("app", function() {
|
|||
expect($.fn.placeholder).toHaveBeenCalled();
|
||||
expect($.fn.placeholder.calls.mostRecent().object.selector).toBe("input, textarea");
|
||||
});
|
||||
|
||||
it("initializes autosize for textareas", function(){
|
||||
spyOn(window, "autosize");
|
||||
app.setupForms();
|
||||
expect(window.autosize).toHaveBeenCalled();
|
||||
expect(window.autosize.calls.mostRecent().args[0].selector).toBe("textarea");
|
||||
});
|
||||
});
|
||||
|
||||
describe("setupAjaxErrorRedirect", function() {
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ describe("app.views.CommentStream", function(){
|
|||
|
||||
describe("postRenderTemplate", function(){
|
||||
it("autoResizes the new comment textarea", function(){
|
||||
spyOn(window, "autosize");
|
||||
spyOn(window.autosize, "update");
|
||||
this.view.postRenderTemplate();
|
||||
expect(window.autosize).toHaveBeenCalled();
|
||||
expect(window.autosize.calls.mostRecent().args[0].selector).toBe("textarea");
|
||||
expect(window.autosize.update).toHaveBeenCalled();
|
||||
expect(window.autosize.update.calls.mostRecent().args[0].selector).toBe("textarea");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
describe("app.views.Base", function(){
|
||||
beforeEach(function(){
|
||||
var StaticTemplateClass = app.views.Base.extend({ templateName : "static-text" });
|
||||
this.model = new Backbone.Model({text : "model attributes are in the default presenter"});
|
||||
this.view = new StaticTemplateClass({model: this.model});
|
||||
});
|
||||
|
||||
describe("#render", function(){
|
||||
beforeEach(function(){
|
||||
var staticTemplateClass = app.views.Base.extend({ templateName : "static-text" });
|
||||
|
||||
this.model = new Backbone.Model({text : "model attributes are in the default presenter"});
|
||||
this.view = new staticTemplateClass({model: this.model});
|
||||
this.view.render();
|
||||
});
|
||||
|
||||
|
|
@ -85,4 +87,20 @@ describe("app.views.Base", function(){
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#renderTemplate", function(){
|
||||
it("calls jQuery.placeholder() for inputs", function() {
|
||||
spyOn($.fn, "placeholder");
|
||||
this.view.renderTemplate();
|
||||
expect($.fn.placeholder).toHaveBeenCalled();
|
||||
expect($.fn.placeholder.calls.mostRecent().object.selector).toBe("input, textarea");
|
||||
});
|
||||
|
||||
it("initializes autosize for textareas", function(){
|
||||
spyOn(window, "autosize");
|
||||
this.view.renderTemplate();
|
||||
expect(window.autosize).toHaveBeenCalled();
|
||||
expect(window.autosize.calls.mostRecent().args[0].selector).toBe("textarea");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue