FEATURE: when uncategorized topics are not allowed, disable the post input until a category is chosen

This commit is contained in:
Neil Lalonde
2018-04-10 19:31:20 -04:00
parent 720dd2432e
commit 6e6892c88e
9 changed files with 107 additions and 12 deletions

View File

@ -1,4 +1,4 @@
import { acceptance } from "helpers/qunit-helpers";
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
acceptance("Composer topic featured links", {
loggedIn: true,
@ -76,3 +76,32 @@ QUnit.test("onebox with title but extra words in title field", assert => {
assert.equal(find('.title-input input').val(), "http://www.example.com/has-title.html test", "title is unchanged");
});
});
acceptance("Composer topic featured links when uncategorized is not allowed", {
loggedIn: true,
settings: {
topic_featured_link_enabled: true,
max_topic_title_length: 80,
enable_markdown_linkify: true,
allow_uncategorized_topics: false
}
});
QUnit.test("Pasting a link enables the text input area", assert => {
replaceCurrentUser({ admin: false, staff: false, trust_level: 1 });
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');
});
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');
});
});