OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
test calculated value input
Ivan Kuchin4dd23886da56
diff --git a/app/forms/custom_fields/inputs/calculated_value.rb b/app/forms/custom_fields/inputs/calculated_value.rbindex 0f35da11f3f..8ea91c98fc7 100644--- a/app/forms/custom_fields/inputs/calculated_value.rb+++ b/app/forms/custom_fields/inputs/calculated_value.rb@@ -34,6 +34,6 @@ class CustomFields::Inputs::CalculatedValue < CustomFields::Inputs::Base::Inputenddef input_attributes- super.merge({ disabled: true })+ super.merge({ type: "number", step: :any, disabled: true })endenddiff --git a/spec/forms/custom_fields/inputs/calculated_value_spec.rb b/spec/forms/custom_fields/inputs/calculated_value_spec.rbnew file mode 100644index 00000000000..7c8dd9f50ac--- /dev/null+++ b/spec/forms/custom_fields/inputs/calculated_value_spec.rb@@ -0,0 +1,53 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "spec_helper"++RSpec.describe CustomFields::Inputs::CalculatedValue, type: :forms, with_flag: { calculated_value_project_attribute: true } do+ include_context "with rendered custom field input form"++ let(:custom_field) { create(:calculated_value_project_custom_field, name: "Calculated value field", formula: "1 + 1") }++ it_behaves_like "rendering label with help text", "Calculated value field"++ context "without a value" do+ it "renders field" do+ expect(rendered_form).to have_field "Calculated value field", type: :number, disabled: true, with: ""+ end+ end++ context "with a value" do+ let(:value) { 78.23 }++ it "renders field" do+ expect(rendered_form).to have_field "Calculated value field", type: :number, disabled: true, with: "78.23"+ end+ end+end