Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.1] Allow to create element with warning in definition #2508

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/alchemy/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Element < BaseRecord
"compact",
"message",
"deprecated",
"warning",
].freeze

# All Elements that share the same page version and parent element and are fixed or not are considered a list.
Expand Down
3 changes: 3 additions & 0 deletions spec/dummy/config/alchemy/elements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,6 @@
- name: key_words
type: EssenceText
group: details

- name: element_with_warning
warning: "Do not use this element!"
10 changes: 10 additions & 0 deletions spec/models/alchemy/element_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ module Alchemy
end
end
end

context "with warning in definition" do
let(:element) do
Alchemy::Element.new(name: "element_with_warning")
end

it "creates element" do
expect { element.save }.to_not raise_error
end
end
end

describe ".dom_id_class" do
Expand Down