vedeu 0.6.71 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/api.md +1 -1
- data/lib/vedeu/all.rb +1 -0
- data/lib/vedeu/borders/border.rb +66 -55
- data/lib/vedeu/borders/caption.rb +10 -20
- data/lib/vedeu/borders/dsl.rb +57 -13
- data/lib/vedeu/borders/refresh.rb +123 -64
- data/lib/vedeu/borders/set_attribute.rb +1 -3
- data/lib/vedeu/borders/title.rb +68 -25
- data/lib/vedeu/cells/all.rb +23 -0
- data/lib/vedeu/cells/border.rb +72 -0
- data/lib/vedeu/cells/borders/all.rb +18 -0
- data/lib/vedeu/cells/borders/bottom_horizontal.rb +28 -0
- data/lib/vedeu/cells/borders/bottom_left.rb +34 -0
- data/lib/vedeu/cells/borders/bottom_right.rb +34 -0
- data/lib/vedeu/cells/borders/horizontal.rb +28 -0
- data/lib/vedeu/cells/borders/left_vertical.rb +28 -0
- data/lib/vedeu/cells/borders/right_vertical.rb +28 -0
- data/lib/vedeu/cells/borders/top_horizontal.rb +28 -0
- data/lib/vedeu/cells/borders/top_left.rb +34 -0
- data/lib/vedeu/cells/borders/top_right.rb +34 -0
- data/lib/vedeu/cells/borders/vertical.rb +28 -0
- data/lib/vedeu/cells/char.rb +24 -0
- data/lib/vedeu/cells/clear.rb +29 -0
- data/lib/vedeu/cells/empty.rb +78 -0
- data/lib/vedeu/cells/escape.rb +24 -0
- data/lib/vedeu/cells/html.rb +19 -0
- data/lib/vedeu/cells/json.rb +19 -0
- data/lib/vedeu/colours/colour.rb +6 -6
- data/lib/vedeu/common.rb +9 -0
- data/lib/vedeu/cursors/move.rb +2 -3
- data/lib/vedeu/editor/insert.rb +1 -1
- data/lib/vedeu/editor/item.rb +2 -3
- data/lib/vedeu/input/mouse.rb +1 -1
- data/lib/vedeu/interfaces/clear.rb +3 -4
- data/lib/vedeu/output/compressor.rb +1 -0
- data/lib/vedeu/presentation/colour.rb +3 -0
- data/lib/vedeu/repositories/defaults.rb +10 -1
- data/lib/vedeu/templating/decoder.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/templating/template.rb +2 -2
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +9 -0
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/html_char.rb +1 -1
- data/test/lib/vedeu/application/application_controller_test.rb +2 -2
- data/test/lib/vedeu/application/controller_test.rb +4 -4
- data/test/lib/vedeu/borders/border_test.rb +10 -2
- data/test/lib/vedeu/borders/caption_test.rb +29 -13
- data/test/lib/vedeu/borders/dsl_test.rb +44 -25
- data/test/lib/vedeu/borders/refresh_test.rb +2 -2
- data/test/lib/vedeu/borders/title_test.rb +17 -15
- data/test/lib/vedeu/buffers/buffer_test.rb +8 -8
- data/test/lib/vedeu/buffers/refresh_test.rb +10 -10
- data/test/lib/vedeu/buffers/terminal_test.rb +6 -6
- data/test/lib/vedeu/cells/border_test.rb +72 -0
- data/test/lib/vedeu/cells/borders/bottom_horizontal_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/bottom_left_test.rb +36 -0
- data/test/lib/vedeu/cells/borders/bottom_right_test.rb +36 -0
- data/test/lib/vedeu/cells/borders/horizontal_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/left_vertical_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/right_vertical_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/top_horizontal_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/top_left_test.rb +36 -0
- data/test/lib/vedeu/cells/borders/top_right_test.rb +36 -0
- data/test/lib/vedeu/cells/borders/vertical_test.rb +22 -0
- data/test/lib/vedeu/cells/char_test.rb +22 -0
- data/test/lib/vedeu/cells/clear_test.rb +34 -0
- data/test/lib/vedeu/cells/empty_test.rb +55 -0
- data/test/lib/vedeu/cells/escape_test.rb +13 -0
- data/test/lib/vedeu/cells/html_test.rb +13 -0
- data/test/lib/vedeu/cells/json_test.rb +13 -0
- data/test/lib/vedeu/colours/colour_test.rb +2 -6
- data/test/lib/vedeu/colours/translator_test.rb +4 -4
- data/test/lib/vedeu/common_test.rb +10 -0
- data/test/lib/vedeu/configuration/api_test.rb +24 -24
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/dsl_test.rb +16 -16
- data/test/lib/vedeu/cursors/reposition_test.rb +2 -2
- data/test/lib/vedeu/cursors/repository_test.rb +2 -2
- data/test/lib/vedeu/distributed/client_test.rb +2 -2
- data/test/lib/vedeu/distributed/server_test.rb +8 -8
- data/test/lib/vedeu/distributed/subprocess_test.rb +2 -2
- data/test/lib/vedeu/distributed/test_application_test.rb +2 -2
- data/test/lib/vedeu/dsl/line_test.rb +2 -2
- data/test/lib/vedeu/dsl/presentation_test.rb +4 -4
- data/test/lib/vedeu/editor/cursor_test.rb +2 -2
- data/test/lib/vedeu/editor/document_test.rb +4 -4
- data/test/lib/vedeu/editor/editor_test.rb +20 -20
- data/test/lib/vedeu/events/aliases_test.rb +2 -2
- data/test/lib/vedeu/events/repository_test.rb +2 -2
- data/test/lib/vedeu/geometries/area/area_test.rb +2 -2
- data/test/lib/vedeu/geometries/geometry_test.rb +2 -2
- data/test/lib/vedeu/geometries/move_test.rb +2 -2
- data/test/lib/vedeu/geometries/position_test.rb +2 -2
- data/test/lib/vedeu/groups/clear_test.rb +2 -2
- data/test/lib/vedeu/groups/group_test.rb +4 -4
- data/test/lib/vedeu/groups/refresh_test.rb +2 -2
- data/test/lib/vedeu/input/capture_test.rb +42 -40
- data/test/lib/vedeu/input/mouse_test.rb +13 -11
- data/test/lib/vedeu/input/read_test.rb +10 -10
- data/test/lib/vedeu/interfaces/clear_test.rb +15 -6
- data/test/lib/vedeu/interfaces/dsl_test.rb +14 -14
- data/test/lib/vedeu/interfaces/interface_test.rb +12 -9
- data/test/lib/vedeu/logging/debug_test.rb +2 -2
- data/test/lib/vedeu/logging/lockless_log_device_test.rb +2 -2
- data/test/lib/vedeu/logging/log_test.rb +4 -4
- data/test/lib/vedeu/logging/mono_logger_test.rb +8 -8
- data/test/lib/vedeu/logging/timer_test.rb +2 -2
- data/test/lib/vedeu/menus/menu_test.rb +4 -4
- data/test/lib/vedeu/models/cell_test.rb +2 -2
- data/test/lib/vedeu/models/focus_test.rb +6 -6
- data/test/lib/vedeu/models/toggleable_test.rb +10 -10
- data/test/lib/vedeu/null/generic_test.rb +2 -2
- data/test/lib/vedeu/output/output_test.rb +8 -8
- data/test/lib/vedeu/output/refresh_test.rb +2 -2
- data/test/lib/vedeu/output/viewport_test.rb +2 -2
- data/test/lib/vedeu/plugins/plugin_test.rb +4 -4
- data/test/lib/vedeu/presentation/background_test.rb +2 -2
- data/test/lib/vedeu/presentation/foreground_test.rb +2 -2
- data/test/lib/vedeu/presentation/style_test.rb +2 -2
- data/test/lib/vedeu/renderers/all_test.rb +2 -2
- data/test/lib/vedeu/renderers/file_test.rb +6 -6
- data/test/lib/vedeu/renderers/terminal_test.rb +2 -2
- data/test/lib/vedeu/repositories/collection_test.rb +2 -2
- data/test/lib/vedeu/repositories/defaults_test.rb +35 -0
- data/test/lib/vedeu/repositories/registerable_test.rb +2 -2
- data/test/lib/vedeu/runtime/bootstrap_test.rb +2 -2
- data/test/lib/vedeu/runtime/flags_test.rb +2 -2
- data/test/lib/vedeu/runtime/launcher_test.rb +4 -4
- data/test/lib/vedeu/runtime/main_loop_test.rb +2 -2
- data/test/lib/vedeu/runtime/router_test.rb +12 -12
- data/test/lib/vedeu/terminal/mode_test.rb +4 -4
- data/test/lib/vedeu/terminal/terminal_test.rb +19 -9
- data/test/lib/vedeu/views/char_test.rb +2 -2
- data/test/lib/vedeu/views/composition_test.rb +2 -2
- data/test/lib/vedeu/views/line_test.rb +2 -2
- data/test/lib/vedeu/views/stream_test.rb +2 -2
- data/test/lib/vedeu/views/view_test.rb +4 -4
- data/vedeu.gemspec +1 -1
- metadata +57 -4
data/lib/vedeu/input/mouse.rb
CHANGED
@@ -160,10 +160,9 @@ module Vedeu
|
|
160
160
|
Vedeu.timer("Clearing #{clearing}: '#{name}'".freeze) do
|
161
161
|
@clear ||= Array.new(height) do |iy|
|
162
162
|
Array.new(width) do |ix|
|
163
|
-
Vedeu::
|
164
|
-
|
165
|
-
|
166
|
-
position: [y + iy, x + ix])
|
163
|
+
Vedeu::Cells::Clear.new(colour: colour,
|
164
|
+
name: name,
|
165
|
+
position: [y + iy, x + ix])
|
167
166
|
end
|
168
167
|
end
|
169
168
|
end
|
@@ -18,6 +18,9 @@ module Vedeu
|
|
18
18
|
elsif self.is_a?(Vedeu::Views::Char) && name
|
19
19
|
Vedeu::Colours::Colour.coerce(interface.colour)
|
20
20
|
|
21
|
+
elsif self.respond_to?(:named_parent) && name
|
22
|
+
Vedeu::Colours::Colour.coerce(named_parent.colour)
|
23
|
+
|
21
24
|
elsif parent && present?(parent.colour)
|
22
25
|
Vedeu::Colours::Colour.coerce(parent.colour)
|
23
26
|
|
@@ -21,11 +21,20 @@ module Vedeu
|
|
21
21
|
# @return [void] A new instance of the class including this
|
22
22
|
# module.
|
23
23
|
def initialize(attributes = {})
|
24
|
-
|
24
|
+
attrs = attributes.to_h.keep_if { |key, _| defaults.key?(key) }
|
25
|
+
|
26
|
+
defaults.merge!(attrs).each do |key, value|
|
25
27
|
instance_variable_set("@#{key}", value || defaults.fetch(key))
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
31
|
+
private
|
32
|
+
|
33
|
+
# @return [Hash<void>]
|
34
|
+
def defaults
|
35
|
+
{}
|
36
|
+
end
|
37
|
+
|
29
38
|
end # Defaults
|
30
39
|
|
31
40
|
end # Repositories
|
@@ -65,6 +65,15 @@ module Vedeu
|
|
65
65
|
yield if block_given?
|
66
66
|
end
|
67
67
|
|
68
|
+
# Disables the mouse and shows the cursor. Used by the debugging
|
69
|
+
# snippet in {file:docs/debugging.md}.
|
70
|
+
#
|
71
|
+
# @return [String]
|
72
|
+
def debugging!
|
73
|
+
output(Vedeu::EscapeSequences::Esc.mouse_x10_off +
|
74
|
+
Vedeu::EscapeSequences::Esc.show_cursor)
|
75
|
+
end
|
76
|
+
|
68
77
|
# Clears the entire terminal space.
|
69
78
|
#
|
70
79
|
# @example
|
data/lib/vedeu/version.rb
CHANGED
@@ -24,10 +24,10 @@ module Vedeu
|
|
24
24
|
|
25
25
|
subject { instance.redirect_to(controller, action, params) }
|
26
26
|
|
27
|
-
it
|
27
|
+
it do
|
28
28
|
Vedeu.expects(:trigger).with(:_goto_, controller, action, params)
|
29
29
|
subject
|
30
|
-
|
30
|
+
end
|
31
31
|
|
32
32
|
it { instance.must_respond_to(:redirect) }
|
33
33
|
it { instance.must_respond_to(:goto) }
|
@@ -29,11 +29,11 @@ module Vedeu
|
|
29
29
|
describe '.controller' do
|
30
30
|
subject { described_model.controller(:some_controller) }
|
31
31
|
|
32
|
-
it
|
32
|
+
it do
|
33
33
|
Vedeu::Runtime::Router.expects(:add_controller).
|
34
34
|
with(:some_controller, 'Vedeu::ControllerTestKlass')
|
35
35
|
subject
|
36
|
-
|
36
|
+
end
|
37
37
|
|
38
38
|
it { subject.must_be_instance_of(Hash) }
|
39
39
|
end
|
@@ -41,13 +41,13 @@ module Vedeu
|
|
41
41
|
describe '.action' do
|
42
42
|
subject { described_model.action(:some_action, :other_action) }
|
43
43
|
|
44
|
-
it
|
44
|
+
it do
|
45
45
|
Vedeu::Runtime::Router.expects(:add_action).
|
46
46
|
with(:some_controller, :some_action)
|
47
47
|
Vedeu::Runtime::Router.expects(:add_action).
|
48
48
|
with(:some_controller, :other_action)
|
49
49
|
subject
|
50
|
-
|
50
|
+
end
|
51
51
|
|
52
52
|
it { subject.must_be_instance_of(Array) }
|
53
53
|
end
|
@@ -49,8 +49,10 @@ module Vedeu
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe 'accessors' do
|
52
|
-
it
|
52
|
+
it do
|
53
53
|
instance.must_respond_to(:attributes)
|
54
|
+
instance.must_respond_to(:bottom_horizontal)
|
55
|
+
instance.must_respond_to(:bottom_horizontal=)
|
54
56
|
instance.must_respond_to(:bottom_left)
|
55
57
|
instance.must_respond_to(:bottom_left=)
|
56
58
|
instance.must_respond_to(:bottom_right)
|
@@ -73,17 +75,23 @@ module Vedeu
|
|
73
75
|
instance.must_respond_to(:show_top=)
|
74
76
|
instance.must_respond_to(:title)
|
75
77
|
instance.must_respond_to(:title=)
|
78
|
+
instance.must_respond_to(:top_horizontal)
|
79
|
+
instance.must_respond_to(:top_horizontal=)
|
76
80
|
instance.must_respond_to(:top_left)
|
77
81
|
instance.must_respond_to(:top_left=)
|
78
82
|
instance.must_respond_to(:top_right)
|
79
83
|
instance.must_respond_to(:top_right=)
|
84
|
+
instance.must_respond_to(:left_vertical)
|
85
|
+
instance.must_respond_to(:left_vertical=)
|
86
|
+
instance.must_respond_to(:right_vertical)
|
87
|
+
instance.must_respond_to(:right_vertical=)
|
80
88
|
instance.must_respond_to(:vertical)
|
81
89
|
instance.must_respond_to(:vertical=)
|
82
90
|
instance.must_respond_to(:name)
|
83
91
|
instance.must_respond_to(:enabled)
|
84
92
|
instance.must_respond_to(:enabled=)
|
85
93
|
instance.must_respond_to(:enabled?)
|
86
|
-
|
94
|
+
end
|
87
95
|
end
|
88
96
|
|
89
97
|
describe '#deputy' do
|
@@ -6,10 +6,11 @@ module Vedeu
|
|
6
6
|
|
7
7
|
describe Caption do
|
8
8
|
|
9
|
-
let(:described)
|
10
|
-
let(:instance)
|
11
|
-
let(:
|
12
|
-
let(:
|
9
|
+
let(:described) { Vedeu::Borders::Caption }
|
10
|
+
let(:instance) { described.new(_name, _value, horizontal) }
|
11
|
+
let(:_name) { 'Vedeu::Borders::Caption' }
|
12
|
+
let(:_value) { 'Bismuth' }
|
13
|
+
let(:horizontal) {
|
13
14
|
[
|
14
15
|
Vedeu::Views::Char.new(value: '-', position: [4, 1], border: type),
|
15
16
|
Vedeu::Views::Char.new(value: '-', position: [4, 2], border: type),
|
@@ -31,25 +32,40 @@ module Vedeu
|
|
31
32
|
context 'when the caption is empty' do
|
32
33
|
let(:_value) {}
|
33
34
|
|
34
|
-
it { subject.must_equal(
|
35
|
+
it { subject.must_equal(horizontal) }
|
35
36
|
end
|
36
37
|
|
37
38
|
context 'when the caption is not empty' do
|
39
|
+
let(:border) {
|
40
|
+
Vedeu::Borders::Border.new(name: _name)
|
41
|
+
}
|
42
|
+
let(:geometry) {
|
43
|
+
Vedeu::Geometries::Geometry.new(name: _name,
|
44
|
+
x: 1,
|
45
|
+
xn: 10,
|
46
|
+
y: 1,
|
47
|
+
yn: 4)
|
48
|
+
}
|
38
49
|
let(:expected) {
|
39
50
|
[
|
40
51
|
Vedeu::Views::Char.new(value: '-', position: [4, 1], border: type),
|
41
|
-
Vedeu::
|
42
|
-
Vedeu::
|
43
|
-
Vedeu::
|
44
|
-
Vedeu::
|
45
|
-
Vedeu::
|
46
|
-
Vedeu::
|
47
|
-
Vedeu::
|
48
|
-
Vedeu::
|
52
|
+
Vedeu::Cells::Char.new(value: ' ', position: [4, 2]),
|
53
|
+
Vedeu::Cells::Char.new(value: 'B', position: [4, 3]),
|
54
|
+
Vedeu::Cells::Char.new(value: 'i', position: [4, 4]),
|
55
|
+
Vedeu::Cells::Char.new(value: 's', position: [4, 5]),
|
56
|
+
Vedeu::Cells::Char.new(value: 'm', position: [4, 6]),
|
57
|
+
Vedeu::Cells::Char.new(value: 'u', position: [4, 7]),
|
58
|
+
Vedeu::Cells::Char.new(value: 't', position: [4, 8]),
|
59
|
+
Vedeu::Cells::Char.new(value: ' ', position: [4, 9]),
|
49
60
|
Vedeu::Views::Char.new(value: '-', position: [4, 10], border: type),
|
50
61
|
]
|
51
62
|
}
|
52
63
|
|
64
|
+
before do
|
65
|
+
Vedeu.borders.stubs(:by_name).returns(border)
|
66
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
67
|
+
end
|
68
|
+
|
53
69
|
it { subject.must_equal(expected) }
|
54
70
|
end
|
55
71
|
end
|
@@ -14,26 +14,45 @@ module Vedeu
|
|
14
14
|
let(:boolean) { true }
|
15
15
|
|
16
16
|
describe '.border' do
|
17
|
-
|
17
|
+
let(:_name) { 'Vedeu::Borders::DSL' }
|
18
|
+
|
19
|
+
after { Vedeu.borders.reset! }
|
20
|
+
|
21
|
+
subject { described.border(_name) { } }
|
22
|
+
|
23
|
+
it { subject.must_be_instance_of(Vedeu::Borders::Border) }
|
24
|
+
|
25
|
+
context 'when the name is not given' do
|
26
|
+
let(:_name) {}
|
27
|
+
|
28
|
+
it { proc { subject}.must_raise(Vedeu::Error::MissingRequired) }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when the block is not given' do
|
32
|
+
subject { described.border(name) }
|
33
|
+
|
34
|
+
it { proc { subject}.must_raise(Vedeu::Error::RequiresBlock) }
|
35
|
+
end
|
36
|
+
|
18
37
|
end
|
19
38
|
|
20
39
|
describe '#bottom_left' do
|
21
|
-
let(:char)
|
40
|
+
let(:char) { 'C' }
|
41
|
+
let(:options) { {} }
|
22
42
|
|
23
|
-
subject { instance.bottom_left(char) }
|
43
|
+
subject { instance.bottom_left(char, options) }
|
24
44
|
|
25
|
-
it { subject.must_be_instance_of(
|
26
|
-
it { subject.must_equal('C') }
|
45
|
+
it { subject.must_be_instance_of(Vedeu::Cells::BottomLeft) }
|
27
46
|
it { instance.must_respond_to(:bottom_left=) }
|
28
47
|
end
|
29
48
|
|
30
49
|
describe '#bottom_right' do
|
31
|
-
let(:char)
|
50
|
+
let(:char) { 'D' }
|
51
|
+
let(:options) { {} }
|
32
52
|
|
33
|
-
subject { instance.bottom_right(char) }
|
53
|
+
subject { instance.bottom_right(char, options) }
|
34
54
|
|
35
|
-
it { subject.must_be_instance_of(
|
36
|
-
it { subject.must_equal('D') }
|
55
|
+
it { subject.must_be_instance_of(Vedeu::Cells::BottomRight) }
|
37
56
|
it { instance.must_respond_to(:bottom_right=) }
|
38
57
|
end
|
39
58
|
|
@@ -50,12 +69,12 @@ module Vedeu
|
|
50
69
|
end
|
51
70
|
|
52
71
|
describe '#horizontal' do
|
53
|
-
let(:char)
|
72
|
+
let(:char) { 'H' }
|
73
|
+
let(:options) { {} }
|
54
74
|
|
55
|
-
subject { instance.horizontal(char) }
|
75
|
+
subject { instance.horizontal(char, options) }
|
56
76
|
|
57
|
-
it { subject.must_be_instance_of(
|
58
|
-
it { subject.must_equal('H') }
|
77
|
+
it { subject.must_be_instance_of(Vedeu::Cells::Horizontal) }
|
59
78
|
it { instance.must_respond_to(:horizontal=) }
|
60
79
|
end
|
61
80
|
|
@@ -189,22 +208,22 @@ module Vedeu
|
|
189
208
|
end
|
190
209
|
|
191
210
|
describe '#top_left' do
|
192
|
-
let(:char)
|
211
|
+
let(:char) { 'A' }
|
212
|
+
let(:options) { {} }
|
193
213
|
|
194
|
-
subject { instance.top_left(char) }
|
214
|
+
subject { instance.top_left(char, options) }
|
195
215
|
|
196
|
-
it { subject.must_be_instance_of(
|
197
|
-
it { subject.must_equal('A') }
|
216
|
+
it { subject.must_be_instance_of(Vedeu::Cells::TopLeft) }
|
198
217
|
it { instance.must_respond_to(:top_left=) }
|
199
218
|
end
|
200
219
|
|
201
220
|
describe '#top_right' do
|
202
|
-
let(:char)
|
221
|
+
let(:char) { 'B' }
|
222
|
+
let(:options) { {} }
|
203
223
|
|
204
|
-
subject { instance.top_right(char) }
|
224
|
+
subject { instance.top_right(char, options) }
|
205
225
|
|
206
|
-
it { subject.must_be_instance_of(
|
207
|
-
it { subject.must_equal('B') }
|
226
|
+
it { subject.must_be_instance_of(Vedeu::Cells::TopRight) }
|
208
227
|
it { instance.must_respond_to(:top_right=) }
|
209
228
|
end
|
210
229
|
|
@@ -228,12 +247,12 @@ module Vedeu
|
|
228
247
|
end
|
229
248
|
|
230
249
|
describe '#vertical' do
|
231
|
-
let(:char)
|
250
|
+
let(:char) { 'V' }
|
251
|
+
let(:options) { {} }
|
232
252
|
|
233
|
-
subject { instance.vertical(char) }
|
253
|
+
subject { instance.vertical(char, options) }
|
234
254
|
|
235
|
-
it { subject.must_be_instance_of(
|
236
|
-
it { subject.must_equal('V') }
|
255
|
+
it { subject.must_be_instance_of(Vedeu::Cells::Vertical) }
|
237
256
|
it { instance.must_respond_to(:vertical=) }
|
238
257
|
end
|
239
258
|
|
@@ -6,10 +6,11 @@ module Vedeu
|
|
6
6
|
|
7
7
|
describe Title do
|
8
8
|
|
9
|
-
let(:described)
|
10
|
-
let(:instance)
|
11
|
-
let(:
|
12
|
-
let(:
|
9
|
+
let(:described) { Vedeu::Borders::Title }
|
10
|
+
let(:instance) { described.new(_name, _value, horizontal) }
|
11
|
+
let(:_name) { 'Vedeu::Borders::Title' }
|
12
|
+
let(:_value) { 'Aluminium' }
|
13
|
+
let(:horizontal) {
|
13
14
|
[
|
14
15
|
Vedeu::Views::Char.new(value: '-', position: [1, 1], border: type),
|
15
16
|
Vedeu::Views::Char.new(value: '-', position: [1, 2], border: type),
|
@@ -27,31 +28,32 @@ module Vedeu
|
|
27
28
|
|
28
29
|
describe '#initialize' do
|
29
30
|
it { instance.must_be_instance_of(described) }
|
31
|
+
it { instance.instance_variable_get('@name').must_equal(_name) }
|
30
32
|
it { instance.instance_variable_get('@value').must_equal(_value) }
|
31
|
-
it { instance.instance_variable_get('@
|
33
|
+
it { instance.instance_variable_get('@horizontal').must_equal(horizontal) }
|
32
34
|
end
|
33
35
|
|
34
36
|
describe '.render' do
|
35
|
-
subject { described.render(_value,
|
37
|
+
subject { described.render(_name, _value, horizontal) }
|
36
38
|
|
37
39
|
context 'when the title is empty' do
|
38
40
|
let(:_value) {}
|
39
41
|
|
40
|
-
it { subject.must_equal(
|
42
|
+
it { subject.must_equal(horizontal) }
|
41
43
|
end
|
42
44
|
|
43
45
|
context 'when the title is not empty' do
|
44
46
|
let(:expected) {
|
45
47
|
[
|
46
48
|
Vedeu::Views::Char.new(value: '-', position: [1, 1], border: type),
|
47
|
-
Vedeu::
|
48
|
-
Vedeu::
|
49
|
-
Vedeu::
|
50
|
-
Vedeu::
|
51
|
-
Vedeu::
|
52
|
-
Vedeu::
|
53
|
-
Vedeu::
|
54
|
-
Vedeu::
|
49
|
+
Vedeu::Cells::Char.new(value: ' ', position: [1, 2]),
|
50
|
+
Vedeu::Cells::Char.new(value: 'A', position: [1, 3]),
|
51
|
+
Vedeu::Cells::Char.new(value: 'l', position: [1, 4]),
|
52
|
+
Vedeu::Cells::Char.new(value: 'u', position: [1, 5]),
|
53
|
+
Vedeu::Cells::Char.new(value: 'm', position: [1, 6]),
|
54
|
+
Vedeu::Cells::Char.new(value: 'i', position: [1, 7]),
|
55
|
+
Vedeu::Cells::Char.new(value: 'n', position: [1, 8]),
|
56
|
+
Vedeu::Cells::Char.new(value: ' ', position: [1, 9]),
|
55
57
|
Vedeu::Views::Char.new(value: '-', position: [1, 10], border: type),
|
56
58
|
]
|
57
59
|
}
|