diff --git a/lib/vedeu/output/presentation/colour.rb b/lib/vedeu/output/presentation/colour.rb index 65d764570..ccb796290 100644 --- a/lib/vedeu/output/presentation/colour.rb +++ b/lib/vedeu/output/presentation/colour.rb @@ -15,6 +15,9 @@ def background @background ||= if colour colour.background + elsif self.is_a?(Vedeu::Views::Char) && name + interface.colour.background + elsif parent parent.background @@ -39,6 +42,9 @@ def colour @colour ||= if attributes[:colour] Vedeu::Colours::Colour.coerce(attributes[:colour]) + elsif self.is_a?(Vedeu::Views::Char) && name + Vedeu::Colours::Colour.coerce(interface.colour) + elsif parent Vedeu::Colours::Colour.coerce(parent.colour) @@ -65,6 +71,9 @@ def foreground @foreground ||= if colour colour.foreground + elsif self.is_a?(Vedeu::Views::Char) && name + interface.colour.background + elsif parent parent.foreground diff --git a/lib/vedeu/output/presentation/styles.rb b/lib/vedeu/output/presentation/styles.rb index 3786adf69..a70b432b3 100644 --- a/lib/vedeu/output/presentation/styles.rb +++ b/lib/vedeu/output/presentation/styles.rb @@ -15,6 +15,9 @@ def style @style ||= if attributes[:style] Vedeu::Presentation::Style.coerce(attributes[:style]) + elsif self.is_a?(Vedeu::Views::Char) && name + Vedeu::Presentation::Style.coerce(interface.style) + elsif parent Vedeu::Presentation::Style.coerce(parent.style) diff --git a/test/lib/vedeu/models/views/char_test.rb b/test/lib/vedeu/models/views/char_test.rb index f79403350..7622b7086 100644 --- a/test/lib/vedeu/models/views/char_test.rb +++ b/test/lib/vedeu/models/views/char_test.rb @@ -44,7 +44,7 @@ module Views } let(:border) { nil } let(:colour) { nil } - let(:_name) { nil } + let(:_name) { 'Vedeu::Views::Char' } let(:style) { nil } let(:position) { nil } let(:parent_colour) { nil } @@ -128,7 +128,7 @@ module Views background: '', foreground: '', }, - name: '', + name: 'Vedeu::Views::Char', parent: { background: '', foreground: '', diff --git a/test/lib/vedeu/models/views/html_char_test.rb b/test/lib/vedeu/models/views/html_char_test.rb index beee70146..a625e7b68 100644 --- a/test/lib/vedeu/models/views/html_char_test.rb +++ b/test/lib/vedeu/models/views/html_char_test.rb @@ -26,7 +26,7 @@ module Views } let(:border) {} let(:colour) {} - let(:_name) {} + let(:_name) { 'Vedeu::Views::HTMLChar' } let(:parent) { Vedeu::Views::Line.new(colour: parent_colour) } let(:parent_colour) {} let(:_value) {} @@ -63,25 +63,36 @@ module Views end context 'when there is no colour' do - context 'when there is a parent colour' do - let(:parent_colour) { - Vedeu::Colours::Colour.new(background: '#002222', - foreground: '#dd2200') - } - - it { subject.must_equal( - " " - ) } + context 'when there is an interface' do + it { subject.must_equal(" ") } end - context 'when there is no parent colour' do - it { subject.must_equal(" ") } + context 'when there is no interface' do + let(:_name) {} + + context 'when there is a parent colour' do + let(:parent_colour) { + Vedeu::Colours::Colour.new(background: '#002222', + foreground: '#dd2200') + } + + it { subject.must_equal( + " " + ) } + end + + context 'when there is no parent colour' do + let(:parent) {} + let(:parent_colour) {} + + it { subject.must_equal(" ") } + end end end end diff --git a/test/lib/vedeu/output/renderers/json_test.rb b/test/lib/vedeu/output/renderers/json_test.rb index 329ff3699..b17974d51 100644 --- a/test/lib/vedeu/output/renderers/json_test.rb +++ b/test/lib/vedeu/output/renderers/json_test.rb @@ -10,7 +10,7 @@ module Renderers let(:instance) { described.new(options) } let(:options) { {} } let(:output) { Vedeu::Models::Page.new } - let(:_name) {} + let(:_name) { 'Vedeu::Renderers::JSON' } before do ::File.stubs(:write) @@ -49,7 +49,7 @@ module Renderers " \"background\": \"\\u001b[48;2;255;0;0m\",\n" \ " \"foreground\": \"\\u001b[38;2;255;255;255m\"\n" \ " },\n" \ - " \"name\": \"\",\n" \ + " \"name\": \"Vedeu::Renderers::JSON\",\n" \ " \"parent\": {\n" \ " },\n" \ " \"position\": {\n" \