From cd11314a3a086dd9f303a9d49b04c82887ac718c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Tue, 17 Mar 2020 16:47:29 +0100 Subject: [PATCH] Fixed CWM::MultiStatusSelector help text icons - 4.2.74 --- .../cwm/src/lib/cwm/multi_status_selector.rb | 44 +++++++++---------- .../cwm/test/multi_status_selector_test.rb | 24 ++++++++++ package/yast2.changes | 7 +++ package/yast2.spec | 2 +- 4 files changed, 54 insertions(+), 23 deletions(-) diff --git a/library/cwm/src/lib/cwm/multi_status_selector.rb b/library/cwm/src/lib/cwm/multi_status_selector.rb index e0857d22a..87c4202c1 100644 --- a/library/cwm/src/lib/cwm/multi_status_selector.rb +++ b/library/cwm/src/lib/cwm/multi_status_selector.rb @@ -299,12 +299,12 @@ def self.event_id def self.help help_text = "

" # TRANSLATORS: help text for a not selected check box - help_text << "#{icon_for(UNSELECTED)} = #{_("Not selected")}
" + help_text << "#{icon_for(UNSELECTED, mode: mode)} = #{_("Not selected")}
" # TRANSLATORS: help text for a selected check box - help_text << "#{icon_for(SELECTED)} = #{_("Selected")}
" + help_text << "#{icon_for(SELECTED, mode: mode)} = #{_("Selected")}
" # TRANSLATORS: help text for an automatically selected check box # (it has a different look that a user selected check box) - help_text << "#{icon_for(AUTO_SELECTED)} = #{_("Auto selected")}" + help_text << "#{icon_for(AUTO_SELECTED, mode: mode)} = #{_("Auto selected")}" help_text << "

" help_text end @@ -405,11 +405,28 @@ def to_richtext "#{checkbox_input} #{checkbox_label}" end + # Determines whether running in installation mode + # + # We do not use Stage.initial because of firstboot, which runs in 'installation' mode + # but in 'firstboot' stage. + # + # @return [Boolean] Boolean if running in installation or update mode + def self.installation? + Yast::Mode.installation || Yast::Mode.update + end + + # Returns the current mode + # + # @return [String] "normal" in a running system; "inst" during the installation + def self.mode + installation? ? "inst" : "normal" + end + private # @see .icon_for def icon - self.class.icon_for(status, mode: mode, state: state) + self.class.icon_for(status, mode: self.class.mode, state: state) end # Builds the check box input representation @@ -434,13 +451,6 @@ def checkbox_label end end - # Returns the current mode - # - # @return [String] "normal" in a running system; "inst" during the installation - def mode - installation? ? "inst" : "normal" - end - # Returns the current input state # # @return [String] "enabled" when item must be enabled; "disabled" otherwise @@ -462,20 +472,10 @@ def text_style # "black" otherwise def color return "grey" unless enabled? - return "white" if installation? + return "white" if self.class.installation? "black" end - - # Determines whether running in installation mode - # - # We do not use Stage.initial because of firstboot, which runs in 'installation' mode - # but in 'firstboot' stage. - # - # @return [Boolean] Boolean if running in installation or update mode - def installation? - Yast::Mode.installation || Yast::Mode.update - end end end end diff --git a/library/cwm/test/multi_status_selector_test.rb b/library/cwm/test/multi_status_selector_test.rb index 509d2f615..defd18d89 100644 --- a/library/cwm/test/multi_status_selector_test.rb +++ b/library/cwm/test/multi_status_selector_test.rb @@ -436,4 +436,28 @@ def initialize(id, status, enabled) end end end + + describe ".help" do + context "in installation" do + before do + allow(Yast::Mode).to receive(:installation).and_return(true) + allow(Yast::Mode).to receive(:update).and_return(false) + end + + it "uses the installation icon" do + expect(subject.class.help).to include("inst_checkbox-on.svg") + end + end + + context "in installed system" do + before do + allow(Yast::Mode).to receive(:installation).and_return(false) + allow(Yast::Mode).to receive(:update).and_return(false) + end + + it "uses the standard icon" do + expect(subject.class.help).to include("checkbox-on.svg") + end + end + end end diff --git a/package/yast2.changes b/package/yast2.changes index 6b83323ad..5b291202b 100644 --- a/package/yast2.changes +++ b/package/yast2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Mar 17 15:46:35 UTC 2020 - Ladislav Slezák + +- Fixed CWM::MultiStatusSelector help text icons displayed during + installation (related to bsc#1157780, bsc#1161308, bsc#1161200) +- 4.2.74 + ------------------------------------------------------------------- Fri Mar 13 01:54:58 UTC 2020 - David Diaz diff --git a/package/yast2.spec b/package/yast2.spec index 62ff51411..300b349ac 100644 --- a/package/yast2.spec +++ b/package/yast2.spec @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.2.73 +Version: 4.2.74 Release: 0 Summary: YaST2 Main Package License: GPL-2.0-only