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

Add dialog field description to list of values updatable by automate #16011

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_check_box.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class DialogFieldCheckBox < DialogField
AUTOMATE_VALUE_FIELDS = %w(required read_only visible).freeze
AUTOMATE_VALUE_FIELDS = %w(required read_only visible description).freeze

def checked?
value == "t"
Expand Down
2 changes: 1 addition & 1 deletion app/models/dialog_field_date_control.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class DialogFieldDateControl < DialogField
AUTOMATE_VALUE_FIELDS = %w(show_past_dates read_only visible).freeze
AUTOMATE_VALUE_FIELDS = %w(show_past_dates read_only visible description).freeze

include TimezoneMixin

Expand Down
2 changes: 1 addition & 1 deletion app/models/dialog_field_date_time_control.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class DialogFieldDateTimeControl < DialogFieldDateControl
AUTOMATE_VALUE_FIELDS = %w(show_past_dates read_only visible).freeze
AUTOMATE_VALUE_FIELDS = %w(show_past_dates read_only visible description).freeze

def automate_output_value
return nil if @value.blank?
Expand Down
2 changes: 1 addition & 1 deletion app/models/dialog_field_sorted_item.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class DialogFieldSortedItem < DialogField
AUTOMATE_VALUE_FIELDS = %w(sort_by sort_order data_type default_value required read_only visible).freeze
AUTOMATE_VALUE_FIELDS = %w(sort_by sort_order data_type default_value required read_only visible description).freeze

def initialize_with_values(dialog_values)
if load_values_on_init?
Expand Down
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).freeze
AUTOMATE_VALUE_FIELDS = %w(required read_only visible description).freeze
end
2 changes: 1 addition & 1 deletion app/models/dialog_field_text_box.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class DialogFieldTextBox < DialogField
AUTOMATE_VALUE_FIELDS = %w(data_type protected required validator_rule validator_type read_only visible).freeze
AUTOMATE_VALUE_FIELDS = %w(data_type protected required validator_rule validator_type read_only visible description).freeze

def value
@value = values_from_automate if dynamic && @value.blank?
Expand Down
11 changes: 8 additions & 3 deletions spec/models/dialog_field_check_box_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@
let(:dialog_field) { described_class.new }
let(:automate_hash) do
{
"value" => value,
"required" => true,
"read_only" => true
"value" => value,
"required" => true,
"read_only" => true,
"description" => "description"
}
end

Expand All @@ -94,6 +95,10 @@
it "sets the read_only" do
expect(dialog_field.read_only).to be_truthy
end

it "sets the description" do
expect(dialog_field.description).to eq("description")
end
end

context "when the automate hash has a value" do
Expand Down
7 changes: 6 additions & 1 deletion spec/models/dialog_field_date_control_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
{
"value" => value,
"show_past_dates" => true,
"read_only" => true
"read_only" => true,
"description" => "description"
}
end

Expand All @@ -79,6 +80,10 @@
it "sets the read_only" do
expect(dialog_field.read_only).to be_truthy
end

it "sets the description" do
expect(dialog_field.description).to eq("description")
end
end

context "when the automate hash has a value" do
Expand Down
5 changes: 5 additions & 0 deletions spec/models/dialog_field_sorted_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
"sort_order" => "descending",
"data_type" => "datatype",
"default_value" => "default",
"description" => "description",
"required" => true,
"read_only" => true,
"values" => values
Expand All @@ -321,6 +322,10 @@
expect(dialog_field.sort_order).to eq(:descending)
end

it "sets the description" do
expect(dialog_field.description).to eq("description")
end

it "sets the data_type" do
expect(dialog_field.data_type).to eq("datatype")
end
Expand Down
5 changes: 5 additions & 0 deletions spec/models/dialog_field_text_area_box_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"data_type" => "datatype",
"value" => value,
"protected" => true,
"description" => "description",
"required" => true,
"read_only" => true,
"validator_rule" => "rule",
Expand Down Expand Up @@ -35,6 +36,10 @@
expect(dialog_field.required).to be_truthy
end

it "sets the description" do
expect(dialog_field.description).to eq("description")
end

it "sets the read_only" do
expect(dialog_field.read_only).to be_truthy
end
Expand Down
5 changes: 5 additions & 0 deletions spec/models/dialog_field_text_box_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
"data_type" => "datatype",
"value" => value,
"protected" => true,
"description" => "description",
"required" => true,
"read_only" => true,
"validator_type" => "regex",
Expand All @@ -303,6 +304,10 @@
expect(dialog_field.required).to be_truthy
end

it "sets the description" do
expect(dialog_field.description).to eq("description")
end

it "sets the read_only" do
expect(dialog_field.read_only).to be_truthy
end
Expand Down