diff --git a/app/models/alchemy/element.rb b/app/models/alchemy/element.rb index f71d2d1e0c..a0a349df62 100644 --- a/app/models/alchemy/element.rb +++ b/app/models/alchemy/element.rb @@ -35,13 +35,14 @@ class Element < BaseRecord FORBIDDEN_DEFINITION_ATTRIBUTES = [ "amount", "autogenerate", - "nestable_elements", + "compact", + "deprecated", "hint", "ingredients", - "taggable", - "compact", "message", - "deprecated" + "nestable_elements", + "taggable", + "warning" ].freeze # All Elements that share the same page version and parent element and are fixed or not are considered a list. diff --git a/spec/dummy/config/alchemy/elements.yml b/spec/dummy/config/alchemy/elements.yml index 9b5d2eaab2..e17fc01680 100644 --- a/spec/dummy/config/alchemy/elements.yml +++ b/spec/dummy/config/alchemy/elements.yml @@ -226,3 +226,6 @@ - role: key_words type: Text group: details + +- name: element_with_warning + warning: "Do not use this element!" diff --git a/spec/models/alchemy/element_spec.rb b/spec/models/alchemy/element_spec.rb index dd2dc6ede8..f536fb274d 100644 --- a/spec/models/alchemy/element_spec.rb +++ b/spec/models/alchemy/element_spec.rb @@ -114,6 +114,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