From 7b711254a506c95b0b3fff44a0a4667d07848b73 Mon Sep 17 00:00:00 2001 From: Augier Date: Thu, 2 Feb 2017 11:25:43 +0100 Subject: [PATCH] Fix CSS and blur on commant submission --- .../javascripts/app/views/comment_stream_view.js | 1 + .../color_themes/_color_theme_override_dark.scss | 11 +++++++---- app/assets/stylesheets/markdown-editor.scss | 1 - .../javascripts/app/views/comment_stream_view_spec.js | 7 +++++-- spec/javascripts/jasmine_helpers/SpecHelper.js | 1 + 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/app/views/comment_stream_view.js b/app/assets/javascripts/app/views/comment_stream_view.js index ec3f126c1..161d4c935 100644 --- a/app/assets/javascripts/app/views/comment_stream_view.js +++ b/app/assets/javascripts/app/views/comment_stream_view.js @@ -152,6 +152,7 @@ app.views.CommentStream = app.views.Base.extend({ closeForm: function() { this.$("form").removeClass("open"); this.$(".md-editor").removeClass("active"); + this.commentBox.blur(); autosize.update(this.commentBox); }, diff --git a/app/assets/stylesheets/color_themes/_color_theme_override_dark.scss b/app/assets/stylesheets/color_themes/_color_theme_override_dark.scss index dd52eec0c..fe2f17f11 100644 --- a/app/assets/stylesheets/color_themes/_color_theme_override_dark.scss +++ b/app/assets/stylesheets/color_themes/_color_theme_override_dark.scss @@ -11,13 +11,15 @@ body { #publisher_textarea_wrapper { background-color: $gray; } .btn.btn-link.question_mark:hover .entypo-cog { color: $gray-light; } } - - .write-preview-tabs > li.active * { color: $text-color; } - .md-preview { background-color: $gray; } - .md-cancel:hover .entypo-cross { color: $gray-light; } .publisher-buttonbar .btn.btn-link:hover i { color: $gray-light; } } + .write-preview-tabs > li.active * { color: $text-color; } + .md-cancel:hover .entypo-cross { color: $gray-light; } + + .md-input, + .md-preview { background-color: $gray; } + .aspect_dropdown li a .text { color: $dropdown-link-color; } .info .tag { background-color: $gray-light; } @@ -95,6 +97,7 @@ body { #welcome-to-diaspora { background: $orange; } + .md-editor, .block-form fieldset .form-control:focus { border-color: $input-border; } &.page-registrations.action-new, diff --git a/app/assets/stylesheets/markdown-editor.scss b/app/assets/stylesheets/markdown-editor.scss index 462ab2b31..d2657f5ad 100644 --- a/app/assets/stylesheets/markdown-editor.scss +++ b/app/assets/stylesheets/markdown-editor.scss @@ -92,7 +92,6 @@ .md-preview { - background: $white; color: $text-color; // !important is needed to override the CSS rules dynamically added to the element // scss-lint:disable ImportantRule diff --git a/spec/javascripts/app/views/comment_stream_view_spec.js b/spec/javascripts/app/views/comment_stream_view_spec.js index 1dc25d098..4bd183552 100644 --- a/spec/javascripts/app/views/comment_stream_view_spec.js +++ b/spec/javascripts/app/views/comment_stream_view_spec.js @@ -21,10 +21,13 @@ describe("app.views.CommentStream", function(){ }); it("calls onFormBlur when clicking outside the comment box", function() { - spyOn(app.views.CommentStream.prototype, "onFormBlur"); + // remove existing event handlers + $(document.body).off("click"); + + spyOn(this.view, "onFormBlur"); this.view.setupBindings(); $(document.body).click(); - expect(app.views.CommentStream.prototype.onFormBlur).toHaveBeenCalled(); + expect(this.view.onFormBlur).toHaveBeenCalled(); }); }); diff --git a/spec/javascripts/jasmine_helpers/SpecHelper.js b/spec/javascripts/jasmine_helpers/SpecHelper.js index 9d790cb36..4b0bd9175 100644 --- a/spec/javascripts/jasmine_helpers/SpecHelper.js +++ b/spec/javascripts/jasmine_helpers/SpecHelper.js @@ -102,6 +102,7 @@ afterEach(function() { expect($(".modal-backdrop").length).toBe(0); $(".modal-backdrop").remove(); spec.loadFixtureCount = 0; + $(document.body).off(); });