Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2018-05-01 22:40:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Tue May 1 22:40:03 2018 rev:426 rq:602085 version:4.0.72 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2018-04-26 13:28:56.540060962 +0200 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2018-05-01 22:40:06.299510864 +0200 @@ -1,0 +2,7 @@ +Mon Apr 23 19:03:40 UTC 2018 - igonzalezs...@suse.com + +- Add a text helper to wrap richtext in directional markers + (bsc#1089846). +- 4.0.72 + +------------------------------------------------------------------- Old: ---- yast2-4.0.71.tar.bz2 New: ---- yast2-4.0.72.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.ZQxK3i/_old 2018-05-01 22:40:07.223477227 +0200 +++ /var/tmp/diff_new_pack.ZQxK3i/_new 2018-05-01 22:40:07.227477082 +0200 @@ -17,10 +17,10 @@ Name: yast2 -Version: 4.0.71 +Version: 4.0.72 Release: 0 Summary: YaST2 - Main Package -License: GPL-2.0 +License: GPL-2.0-only Group: System/YaST Url: https://github.com/yast/yast-yast2 Source0: %{name}-%{version}.tar.bz2 ++++++ yast2-4.0.71.tar.bz2 -> yast2-4.0.72.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.0.71/library/general/src/lib/ui/text_helpers.rb new/yast2-4.0.72/library/general/src/lib/ui/text_helpers.rb --- old/yast2-4.0.71/library/general/src/lib/ui/text_helpers.rb 2018-04-16 16:35:04.000000000 +0200 +++ new/yast2-4.0.72/library/general/src/lib/ui/text_helpers.rb 2018-04-27 16:57:00.000000000 +0200 @@ -53,5 +53,18 @@ lines.join("\n") end + + # Wrap a given text in direction markers + # + # @param [String] text to be wrapped. This text may contain tags and they + # will not be escaped + # @param [String] language code (it gets the current one by default) + # @return [String] wrapped text + def div_with_direction(text, lang = nil) + Yast.import "Language" + lang ||= Yast::Language.language + direction = lang.start_with?("ar", "he") ? "rtl" : "ltr" + "<div dir=\"#{direction}\">#{text}</div>" + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.0.71/library/general/test/text_helpers_test.rb new/yast2-4.0.72/library/general/test/text_helpers_test.rb --- old/yast2-4.0.71/library/general/test/text_helpers_test.rb 2018-04-16 16:35:04.000000000 +0200 +++ new/yast2-4.0.72/library/general/test/text_helpers_test.rb 2018-04-27 16:57:00.000000000 +0200 @@ -9,8 +9,9 @@ end describe ::UI::TextHelpers do - describe ".wrap_text" do - subject { TestTextHelpers.new } + subject { TestTextHelpers.new } + + describe "#wrap_text" do let(:devices) { ["eth0", "eth1", "eth2", "eth3", "a_very_long_device_name"] } let(:more_devices) do [ @@ -49,4 +50,56 @@ end end end + + describe "#div_with_direction" do + let(:language) { double("Yast::Language") } + let(:lang) { "de_DE" } + + before do + stub_const("Yast::Language", language) + allow(language).to receive(:language).and_return(lang) + allow(Yast).to receive(:import).with("Language") + end + + context "when language is not 'arabic' or 'hebrew'" do + let(:lang) { "de_DE" } + + it "wraps the text in a 'ltr' marker" do + expect(subject.div_with_direction("sample")) + .to eq("<div dir=\"ltr\">sample</div>") + end + end + + context "when current language is 'arabic'" do + let(:lang) { "ar_AR" } + + it "wraps the text in a 'rtl' marker" do + expect(subject.div_with_direction("sample")) + .to eq("<div dir=\"rtl\">sample</div>") + end + end + + context "when current language is 'arabic'" do + let(:lang) { "he_HE" } + + it "wraps the text in a 'rtl' marker" do + expect(subject.div_with_direction("sample")) + .to eq("<div dir=\"rtl\">sample</div>") + end + end + + context "when the language is specified as argument" do + it "wraps the text according to the given language" do + expect(subject.div_with_direction("sample", "ar_AR")) + .to eq("<div dir=\"rtl\">sample</div>") + end + end + + context "when the text contains tags" do + it "does not escape those tags" do + expect(subject.div_with_direction("<strong>SAMPLE</strong>", "ar_AR")) + .to eq("<div dir=\"rtl\"><strong>SAMPLE</strong></div>") + end + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.0.71/package/yast2.changes new/yast2-4.0.72/package/yast2.changes --- old/yast2-4.0.71/package/yast2.changes 2018-04-16 16:35:04.000000000 +0200 +++ new/yast2-4.0.72/package/yast2.changes 2018-04-27 16:57:00.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Apr 23 19:03:40 UTC 2018 - igonzalezs...@suse.com + +- Add a text helper to wrap richtext in directional markers + (bsc#1089846). +- 4.0.72 + +------------------------------------------------------------------- Mon Apr 16 13:47:10 UTC 2018 - igonzalezs...@suse.com - Do not crash when reading trying to determine available locales diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.0.71/package/yast2.spec new/yast2-4.0.72/package/yast2.spec --- old/yast2-4.0.71/package/yast2.spec 2018-04-16 16:35:04.000000000 +0200 +++ new/yast2-4.0.72/package/yast2.spec 2018-04-27 16:57:00.000000000 +0200 @@ -16,7 +16,7 @@ # Name: yast2 -Version: 4.0.71 +Version: 4.0.72 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0