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

Allow textarea boxes to dynamically set validator type and rule #18743

Merged
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
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