Skip to content

Commit

Permalink
Merge pull request #18743 from eclarizio/allow_textarea_dynamic_attri…
Browse files Browse the repository at this point in the history
…butes

Allow textarea boxes to dynamically set validator type and rule

(cherry picked from commit 5bd2a9e)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1702064
  • Loading branch information
mkanoor authored and simaishi committed May 8, 2019
1 parent e9beef7 commit b739a78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/dialog_field_text_area_box.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class DialogFieldTextAreaBox < DialogFieldTextBox
AUTOMATE_VALUE_FIELDS = %w(required read_only visible description).freeze
AUTOMATE_VALUE_FIELDS = %w[required read_only visible description validator_rule validator_type].freeze
end
12 changes: 8 additions & 4 deletions spec/models/dialog_field_text_area_box_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@
dialog_field.normalize_automate_values(automate_hash)
end

it "does not set the data_type" do
expect(dialog_field.data_type).to be_nil
end

it "does not set the protected" do
expect(dialog_field.protected?).to be_falsey
end

it "does not set the validator type" do
expect(dialog_field.validator_type).to be_nil
it "sets the validator type" do
expect(dialog_field.validator_type).to eq("regex")
end

it "does not set the validator rule" do
expect(dialog_field.validator_rule).to be_nil
it "sets the validator rule" do
expect(dialog_field.validator_rule).to eq("rule")
end

it "sets the required" do
Expand Down

0 comments on commit b739a78

Please sign in to comment.