From 859c0b93b579d8e9ea35791bd73e74a67cef5e3b Mon Sep 17 00:00:00 2001 From: Florian Staudacher Date: Fri, 30 Mar 2012 16:02:58 +0200 Subject: [PATCH 1/2] reset publisher css height when "cleared" (fixes #2867) --- app/assets/javascripts/app/views/publisher_view.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js index 2274aeb74..10912928e 100644 --- a/app/assets/javascripts/app/views/publisher_view.js +++ b/app/assets/javascripts/app/views/publisher_view.js @@ -67,7 +67,7 @@ app.views.Publisher = Backbone.View.extend({ open : function() { $(this.el).removeClass('closed'); this.$("#publisher_textarea_wrapper").addClass('active'); - this.$("textarea.ac_input").css('min-height', '42px'); + this.$("textarea").css('height', '42px'); return this; }, @@ -75,7 +75,7 @@ app.views.Publisher = Backbone.View.extend({ close : function() { $(this.el).addClass("closed"); this.$("#publisher_textarea_wrapper").removeClass("active"); - this.$("textarea.ac_input").css('min-height', ''); + this.$("textarea").css('height', ''); return this; } From 0629f4fd9c4c30d7abe362bf75ac91271885bdc8 Mon Sep 17 00:00:00 2001 From: Florian Staudacher Date: Fri, 30 Mar 2012 16:40:08 +0200 Subject: [PATCH 2/2] added tests for resetting height on close --- spec/javascripts/app/views/publisher_view_spec.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/javascripts/app/views/publisher_view_spec.js b/spec/javascripts/app/views/publisher_view_spec.js index 885001ec1..2fbc5908d 100644 --- a/spec/javascripts/app/views/publisher_view_spec.js +++ b/spec/javascripts/app/views/publisher_view_spec.js @@ -16,13 +16,19 @@ describe("app.views.Publisher", function() { }); describe("#close", function() { - it("removes the 'active' class from the publisher element", function(){ - $(this.view.el).removeClass("closed"); + beforeEach(function() { + this.view.open($.Event()); + }); - expect($(this.view.el)).not.toHaveClass("closed"); + it("removes the 'active' class from the publisher element", function(){ this.view.close($.Event()); expect($(this.view.el)).toHaveClass("closed"); }) + + it("resets the element's height", function() { + this.view.close($.Event()); + expect($(this.view.el).find("#status_message_fake_text").attr("style")).not.toContain("height"); + }); }); describe("#clear", function() {