mirror of
https://github.com/discourse/discourse.git
synced 2026-08-09 21:45:25 +08:00
We are happy with how this functionality is working with two category types and overall the experience is much better, we want to get this enabled for all sites and move to permanent in the next month. These 3 plugin PRs need to be merged first: * https://github.com/discourse/discourse-doc-categories/pull/90 * https://github.com/discourse/discourse-category-experts/pull/232 * https://github.com/discourse/discourse-jira/pull/127
35 lines
1 KiB
Ruby
Vendored
35 lines
1 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
describe "Edit Category General" do
|
|
fab!(:admin)
|
|
fab!(:category)
|
|
let(:category_page) { PageObjects::Pages::Category.new }
|
|
let(:form) { PageObjects::Components::FormKit.new(".form-kit") }
|
|
before { sign_in(admin) }
|
|
|
|
context "when changing background color" do
|
|
it "displays an error when the hex code is invalid" do
|
|
category_page.visit_general(category)
|
|
|
|
form.field("color").fill_in("ABZ")
|
|
category_page.save_settings
|
|
expect(form.field("color")).to have_errors(
|
|
I18n.t("js.category.color_validations.non_hexdecimal"),
|
|
)
|
|
|
|
form.field("color").fill_in("A")
|
|
category_page.save_settings
|
|
expect(form.field("color")).to have_errors(
|
|
I18n.t("js.category.color_validations.incorrect_length"),
|
|
)
|
|
end
|
|
|
|
it "saves successfully when the hex code is valid" do
|
|
category_page.visit_general(category)
|
|
|
|
form.field("color").fill_in("AB1")
|
|
category_page.save_settings
|
|
expect(form.field("color")).to have_no_errors
|
|
end
|
|
end
|
|
end
|