From bb3f0c62528b664c5792b1a041d4990fd1f35d13 Mon Sep 17 00:00:00 2001 From: jumagura Date: Mon, 18 Sep 2023 17:41:24 -0400 Subject: [PATCH] DEV: Add acceptance tests for category filtering --- .../category-chooser-initializer-test.js | 21 +++++++++++++++++++ test/javascripts/fixtures/categories.js.es6 | 5 +++++ 2 files changed, 26 insertions(+) create mode 100644 test/javascripts/acceptance/category-chooser-initializer-test.js diff --git a/test/javascripts/acceptance/category-chooser-initializer-test.js b/test/javascripts/acceptance/category-chooser-initializer-test.js new file mode 100644 index 00000000..a5ca3b2a --- /dev/null +++ b/test/javascripts/acceptance/category-chooser-initializer-test.js @@ -0,0 +1,21 @@ +import { click, visit } from "@ember/test-helpers"; +import { acceptance } from "discourse/tests/helpers/qunit-helpers"; +import selectKit from "discourse/tests/helpers/select-kit-helper"; +import { test } from "qunit"; + +acceptance("CategoryChooser", function (needs) { + needs.user(); + needs.settings({ + allow_uncategorized_topics: false, + }); + + test("does not display category with custom_wizard_hide_from_composer set to 't'", async function (assert) { + const categoryChooser = selectKit(".category-chooser"); + + await visit("/"); + await click("#create-topic"); + await categoryChooser.expand(); + + assert.ok(categoryChooser.rowByIndex(4).name() !== "Custom Categories"); + }); +}); diff --git a/test/javascripts/fixtures/categories.js.es6 b/test/javascripts/fixtures/categories.js.es6 index e553f860..432a1b77 100644 --- a/test/javascripts/fixtures/categories.js.es6 +++ b/test/javascripts/fixtures/categories.js.es6 @@ -33,6 +33,7 @@ export default { navigate_to_first_post_after_read: false, custom_fields: { create_topic_wizard: null, + custom_wizard_hide_from_composer: null, }, allowed_tags: [], allowed_tag_groups: [], @@ -77,6 +78,7 @@ export default { navigate_to_first_post_after_read: false, custom_fields: { create_topic_wizard: null, + custom_wizard_hide_from_composer: null, }, allowed_tags: [], allowed_tag_groups: [], @@ -121,6 +123,7 @@ export default { navigate_to_first_post_after_read: false, custom_fields: { create_topic_wizard: null, + custom_wizard_hide_from_composer: null, }, allowed_tags: [], allowed_tag_groups: [], @@ -165,6 +168,7 @@ export default { navigate_to_first_post_after_read: false, custom_fields: { create_topic_wizard: null, + custom_wizard_hide_from_composer: null, }, allowed_tags: [], allowed_tag_groups: [], @@ -206,6 +210,7 @@ export default { navigate_to_first_post_after_read: false, custom_fields: { create_topic_wizard: null, + custom_wizard_hide_from_composer: "t", }, allowed_tags: [], allowed_tag_groups: [],