diff --git a/lib/vedeu/borders/refresh.rb b/lib/vedeu/borders/refresh.rb index 3f183f249..aba4543a6 100644 --- a/lib/vedeu/borders/refresh.rb +++ b/lib/vedeu/borders/refresh.rb @@ -104,6 +104,7 @@ def build(value, type = :border, iy = 0, ix = 0) Vedeu::Views::Char.new(value: value, parent: interface, colour: colour, + name: name, style: style, position: [iy, ix], border: type) diff --git a/lib/vedeu/editor/cropper.rb b/lib/vedeu/editor/cropper.rb index 9464c1d89..a9e4744fc 100644 --- a/lib/vedeu/editor/cropper.rb +++ b/lib/vedeu/editor/cropper.rb @@ -43,7 +43,8 @@ def viewport visible.each_with_index do |line, iy| line.chars.each_with_index do |char, ix| - out << Vedeu::Views::Char.new(parent: interface, + out << Vedeu::Views::Char.new(name: name, + parent: interface, position: [(by + iy), (bx + ix)], value: char.freeze) end diff --git a/lib/vedeu/interfaces/clear.rb b/lib/vedeu/interfaces/clear.rb index 096bf761e..968625389 100644 --- a/lib/vedeu/interfaces/clear.rb +++ b/lib/vedeu/interfaces/clear.rb @@ -167,6 +167,7 @@ def output Array.new(width) do |ix| Vedeu::Views::Char.new(value: ' '.freeze, colour: colour, + name: name, position: [y + iy, x + ix]) end end diff --git a/test/lib/vedeu/interfaces/clear_test.rb b/test/lib/vedeu/interfaces/clear_test.rb index 0101f797c..5de5285d2 100644 --- a/test/lib/vedeu/interfaces/clear_test.rb +++ b/test/lib/vedeu/interfaces/clear_test.rb @@ -44,13 +44,11 @@ module Interfaces let(:output) { [ [ - Vedeu::Views::Char.new(value: ' ', position: [1, 1]), - Vedeu::Views::Char.new(value: ' ', position: [1, 2]), - + Vedeu::Views::Char.new(name: _name, value: ' ', position: [1, 1]), + Vedeu::Views::Char.new(name: _name, value: ' ', position: [1, 2]), ], [ - Vedeu::Views::Char.new(value: ' ', position: [2, 1]), - Vedeu::Views::Char.new(value: ' ', position: [2, 2]), - + Vedeu::Views::Char.new(name: _name, value: ' ', position: [2, 1]), + Vedeu::Views::Char.new(name: _name, value: ' ', position: [2, 2]), ] ] } diff --git a/test/lib/vedeu/models/views/html_char_test.rb b/test/lib/vedeu/models/views/html_char_test.rb index ab3f20bb7..beee70146 100644 --- a/test/lib/vedeu/models/views/html_char_test.rb +++ b/test/lib/vedeu/models/views/html_char_test.rb @@ -19,12 +19,14 @@ module Views { border: border, colour: colour, + name: _name, parent: parent, value: _value } } let(:border) {} let(:colour) {} + let(:_name) {} let(:parent) { Vedeu::Views::Line.new(colour: parent_colour) } let(:parent_colour) {} let(:_value) {} diff --git a/test/lib/vedeu/output/compressor_test.rb b/test/lib/vedeu/output/compressor_test.rb index e533c50dc..57cfd9b6f 100644 --- a/test/lib/vedeu/output/compressor_test.rb +++ b/test/lib/vedeu/output/compressor_test.rb @@ -9,6 +9,7 @@ module Output let(:described) { Vedeu::Output::Compressor } let(:instance) { described.new(output) } let(:output) {} + let(:_name) {} describe '#initialize' do it { instance.must_be_instance_of(described) } @@ -29,10 +30,13 @@ module Output let(:output) { Vedeu::Models::Page.coerce([ Vedeu::Views::Char.new(value: 'Y', + name: _name, colour: { foreground: '#ff0000' }), Vedeu::Views::Char.new(value: 'e', + name: _name, colour: { foreground: '#ff0000' }), Vedeu::Views::Char.new(value: 's', + name: _name, colour: { foreground: '#ff0000' }), ]) } @@ -46,12 +50,16 @@ module Output let(:output) { Vedeu::Models::Page.coerce([ Vedeu::Views::Char.new(value: 'a', + name: _name, colour: { foreground: '#ff0000' }), Vedeu::Views::Char.new(value: 'b', + name: _name, colour: { foreground: '#ff0000' }), Vedeu::Views::Char.new(value: 'c', + name: _name, colour: { foreground: '#0000ff' }), Vedeu::Views::Char.new(value: 'd', + name: _name, colour: { foreground: '#0000ff' }), ]) } @@ -64,9 +72,9 @@ module Output 'elements' do let(:output) { Vedeu::Models::Page.coerce([ - Vedeu::Views::Char.new(value: 'N'), + Vedeu::Views::Char.new(name: _name, value: 'N'), Vedeu::Models::Escape.new(value: "\e[?25l"), - Vedeu::Views::Char.new(value: 't'), + Vedeu::Views::Char.new(name: _name, value: 't'), ]) } it 'converts the non-Vedeu::Views::Char elements into String ' \ @@ -83,10 +91,13 @@ module Output let(:output) { Vedeu::Models::Page.coerce([ Vedeu::Views::Char.new(value: 'Y', + name: _name, colour: { foreground: '#ff0000' }), Vedeu::Views::Char.new(value: 'e', + name: _name, colour: { foreground: '#ff0000' }), Vedeu::Views::Char.new(value: 's', + name: _name, colour: { foreground: '#ff0000' }), ]) } @@ -102,12 +113,16 @@ module Output let(:output) { Vedeu::Models::Page.coerce([ Vedeu::Views::Char.new(value: 'a', + name: _name, colour: { foreground: '#ff0000' }), Vedeu::Views::Char.new(value: 'b', + name: _name, colour: { foreground: '#ff0000' }), Vedeu::Views::Char.new(value: 'c', + name: _name, colour: { foreground: '#0000ff' }), Vedeu::Views::Char.new(value: 'd', + name: _name, colour: { foreground: '#0000ff' }), ]) } @@ -124,9 +139,9 @@ module Output context 'when the output is not all Vedeu::Views::Char elements' do let(:output) { Vedeu::Models::Page.coerce([ - Vedeu::Views::Char.new(value: 'N'), + Vedeu::Views::Char.new(name: _name, value: 'N'), Vedeu::Models::Escape.new(value: "\e[?25l"), - Vedeu::Views::Char.new(value: 't'), + Vedeu::Views::Char.new(name: _name, value: 't'), ]) } it 'converts the non-Vedeu::Views::Char elements into String ' \ diff --git a/test/lib/vedeu/output/renderers/json_test.rb b/test/lib/vedeu/output/renderers/json_test.rb index 811e35ba1..329ff3699 100644 --- a/test/lib/vedeu/output/renderers/json_test.rb +++ b/test/lib/vedeu/output/renderers/json_test.rb @@ -10,6 +10,7 @@ module Renderers let(:instance) { described.new(options) } let(:options) { {} } let(:output) { Vedeu::Models::Page.new } + let(:_name) {} before do ::File.stubs(:write) @@ -33,7 +34,8 @@ module Renderers describe '#render' do let(:output) { Vedeu::Models::Page.coerce([ - Vedeu::Views::Char.new(value: 'a', + Vedeu::Views::Char.new(value: 'a', + name: _name, colour: { background: '#ff0000', foreground: '#ffffff' }), diff --git a/test/lib/vedeu/output/renderers/terminal_test.rb b/test/lib/vedeu/output/renderers/terminal_test.rb index f459fb95c..3b399f488 100644 --- a/test/lib/vedeu/output/renderers/terminal_test.rb +++ b/test/lib/vedeu/output/renderers/terminal_test.rb @@ -9,19 +9,20 @@ module Renderers let(:described) { Vedeu::Renderers::Terminal } let(:instance) { described.new(options) } let(:options) { {} } + let(:_name) {} let(:output) { Vedeu::Models::Page.coerce([ [ Vedeu::Models::Cell.new(position: [1, 1]), - Vedeu::Views::Char.new(value: 'a', position: [1, 2]), + Vedeu::Views::Char.new(name: _name, value: 'a', position: [1, 2]), Vedeu::Models::Cell.new(position: [1, 3]), ], [ Vedeu::Models::Cell.new(position: [2, 1]), - Vedeu::Views::Char.new(value: 'b', position: [2, 2]), + Vedeu::Views::Char.new(name: _name, value: 'b', position: [2, 2]), Vedeu::Models::Cell.new(position: [2, 3]), ], [ Vedeu::Models::Cell.new(position: [3, 1]), - Vedeu::Views::Char.new(value: 'c', position: [3, 2]), + Vedeu::Views::Char.new(name: _name, value: 'c', position: [3, 2]), Vedeu::Models::Cell.new(position: [3, 3]), ], ])