From 0e2584b8418e3795282ed5197853fa8eaa6ca1b5 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 12 Apr 2018 11:32:05 -0400 Subject: [PATCH] fix cursor on disabled composer --- .../discourse/templates/components/d-editor.hbs | 4 ++-- app/assets/stylesheets/common/d-editor.scss | 11 ++++++----- test/javascripts/acceptance/composer-test.js.es6 | 9 +++------ .../acceptance/composer-topic-links-test.js.es6 | 6 ++---- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/discourse/templates/components/d-editor.hbs b/app/assets/javascripts/discourse/templates/components/d-editor.hbs index 571285df208..be1f2d50dad 100644 --- a/app/assets/javascripts/discourse/templates/components/d-editor.hbs +++ b/app/assets/javascripts/discourse/templates/components/d-editor.hbs @@ -9,8 +9,8 @@
-
-
+
+
{{#each toolbar.groups as |group|}} {{#each group.buttons as |b|}} {{#if b.popupMenu}} diff --git a/app/assets/stylesheets/common/d-editor.scss b/app/assets/stylesheets/common/d-editor.scss index 7bf2b433f57..5ccdd6b224f 100644 --- a/app/assets/stylesheets/common/d-editor.scss +++ b/app/assets/stylesheets/common/d-editor.scss @@ -57,6 +57,12 @@ background: transparent; } + &.disabled { + cursor: not-allowed; + .d-editor-button-bar { + visibility: hidden; + } + } } .d-editor-preview-wrapper { @@ -90,11 +96,6 @@ .btn.italic { font-style: italic; } - - &.disabled { - visibility: hidden; - cursor: not-allowed; - } } .d-editor-spacer { diff --git a/test/javascripts/acceptance/composer-test.js.es6 b/test/javascripts/acceptance/composer-test.js.es6 index c159485336b..bd60b6cbb78 100644 --- a/test/javascripts/acceptance/composer-test.js.es6 +++ b/test/javascripts/acceptance/composer-test.js.es6 @@ -353,8 +353,7 @@ QUnit.test("Disable body until category is selected", assert => { assert.ok(exists('.d-editor-input'), 'the composer input is visible'); assert.ok(exists('.title-input .popup-tip.bad.hide'), 'title errors are hidden by default'); assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.bad.hide'), 'body errors are hidden by default'); - assert.ok(exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is disabled'); - assert.ok(find('.d-editor-container .d-editor-input:disabled').length, 'textarea is disabled'); + assert.ok(exists('.d-editor-textarea-wrapper.disabled'), 'textarea is disabled'); }); const categoryChooser = selectKit('.category-chooser'); @@ -362,15 +361,13 @@ QUnit.test("Disable body until category is selected", assert => { categoryChooser.expand().selectRowByValue(2); andThen(() => { - assert.ok(!exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is enabled'); - assert.ok(find('.d-editor-container .d-editor-input:disabled').length === 0, 'textarea is enabled'); + assert.ok(find('.d-editor-textarea-wrapper.disabled').length === 0, 'textarea is enabled'); }); fillIn('.d-editor-input', 'Now I can type stuff'); categoryChooser.expand().selectRowByValue('__none__'); andThen(() => { - assert.ok(!exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is still enabled'); - assert.ok(find('.d-editor-container .d-editor-input:disabled').length === 0, 'textarea is still enabled'); + assert.ok(find('.d-editor-textarea-wrapper.disabled').length === 0, 'textarea is still enabled'); }); }); diff --git a/test/javascripts/acceptance/composer-topic-links-test.js.es6 b/test/javascripts/acceptance/composer-topic-links-test.js.es6 index c57464d11ef..60bd14487eb 100644 --- a/test/javascripts/acceptance/composer-topic-links-test.js.es6 +++ b/test/javascripts/acceptance/composer-topic-links-test.js.es6 @@ -93,15 +93,13 @@ QUnit.test("Pasting a link enables the text input area", assert => { visit("/"); click('#create-topic'); andThen(() => { - assert.ok(exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is disabled'); - assert.ok(find('.d-editor-container .d-editor-input:disabled').length, 'textarea is disabled'); + assert.ok(find('.d-editor-textarea-wrapper.disabled').length, 'textarea is disabled'); }); fillIn('#reply-title', "http://www.example.com/has-title.html"); andThen(() => { assert.ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it"); assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good'); assert.equal(find('.title-input input').val(), "An interesting article", "title is from the oneboxed article"); - assert.ok(!exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is enabled'); - assert.ok(find('.d-editor-container .d-editor-input:disabled').length === 0, 'textarea is enabled'); + assert.ok(find('.d-editor-textarea-wrapper.disabled').length === 0, 'textarea is enabled'); }); });