diff --git a/src/lib/installation/clients/inst_complex_welcome.rb b/src/lib/installation/clients/inst_complex_welcome.rb index 03f00a646..5d10c5534 100644 --- a/src/lib/installation/clients/inst_complex_welcome.rb +++ b/src/lib/installation/clients/inst_complex_welcome.rb @@ -84,6 +84,10 @@ def handle_ret(ret) when :next return nil unless Language.CheckIncompleteTranslation(@language) + if selected_product.nil? + Yast::Popup.Error(_("Please select a product to install.")) + return nil + end setup_final_choice merge_and_run_workflow if selected_product :next diff --git a/src/lib/installation/dialogs/complex_welcome.rb b/src/lib/installation/dialogs/complex_welcome.rb index f0bc38260..3ba5b5ee2 100644 --- a/src/lib/installation/dialogs/complex_welcome.rb +++ b/src/lib/installation/dialogs/complex_welcome.rb @@ -77,7 +77,7 @@ def contents # # @return [::Installation::Widgets::ProductSelector] def product_selector - ::Installation::Widgets::ProductSelector.new(products) + ::Installation::Widgets::ProductSelector.new(products, skip_validation: true) end # Product license widget @@ -100,7 +100,6 @@ def show_license? def filling (show_license? || Yast::UI.TextMode) ? Empty() : VWeight(1, VStretch()) end - end end end diff --git a/src/lib/installation/widgets/product_selector.rb b/src/lib/installation/widgets/product_selector.rb index 8a4351658..558a1a222 100644 --- a/src/lib/installation/widgets/product_selector.rb +++ b/src/lib/installation/widgets/product_selector.rb @@ -13,9 +13,11 @@ class ProductSelector < CWM::RadioButtons attr_reader :product # @param products [Array] to display - def initialize(products) + # @param skip_validation [Boolean] Skip value validation + def initialize(products, skip_validation: false) @products = products @items = products.map { |p| [p.name, p.label] } + @skip_validation = skip_validation textdomain "installation" end @@ -49,11 +51,18 @@ def store end def validate - return true if value + return true if value || skip_validation? Yast::Popup.Error(_("Please select a product to install.")) false end + + # Determine whether the validation should be skipped + # + # @see #initialize + def skip_validation? + @skip_validation + end end end end diff --git a/test/dialogs/complex_welcome_test.rb b/test/dialogs/complex_welcome_test.rb index 9a38e78cb..72892c9fb 100755 --- a/test/dialogs/complex_welcome_test.rb +++ b/test/dialogs/complex_welcome_test.rb @@ -49,7 +49,7 @@ it "shows the product selector" do expect(Installation::Widgets::ProductSelector).to receive(:new) - .with(products) + .with(products, skip_validation: true) expect(widget.contents.to_s).to include("selector_widget") end end