mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 03:13:39 +08:00
476d91d233
Why this change?
This is a follow-up to 86b2e3aa3e
.
Basically, we want to allow people to select more than 1 category as well.
What does this change do?
1. Change `type: category` to `type: categories` and support `min` and `max`
validations for `type: categories`.
2. Fix the `<SchemaThemeSetting::Types::Categories>` component to support the
`min` and `max` validations and switch it to use the `<CategorySelector>` component
instead of the `<CategoryChooser>` component which only supports selecting one category.
23 lines
682 B
Ruby
23 lines
682 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe ThemeSettingsSerializer do
|
|
fab!(:theme)
|
|
|
|
let(:theme_setting) do
|
|
yaml = File.read("#{Rails.root}/spec/fixtures/theme_settings/objects_settings.yaml")
|
|
theme.set_field(target: :settings, name: "yaml", value: yaml)
|
|
theme.save!
|
|
theme.settings
|
|
end
|
|
|
|
before { SiteSetting.experimental_objects_type_for_theme_settings = true }
|
|
|
|
describe "#objects_schema" do
|
|
it "should include the attribute when theme setting is typed objects" do
|
|
payload = ThemeSettingsSerializer.new(theme_setting[:objects_setting]).as_json
|
|
|
|
expect(payload[:theme_settings][:objects_schema][:name]).to eq("section")
|
|
end
|
|
end
|
|
end
|