vedeu 0.6.56 → 0.6.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Guardfile +1 -1
- data/Rakefile +3 -3
- data/lib/vedeu/borders/all.rb +1 -0
- data/lib/vedeu/borders/border.rb +14 -80
- data/lib/vedeu/borders/caption.rb +17 -0
- data/lib/vedeu/borders/dsl.rb +2 -2
- data/lib/vedeu/borders/null.rb +14 -34
- data/lib/vedeu/borders/refresh.rb +28 -14
- data/lib/vedeu/borders/title.rb +0 -10
- data/lib/vedeu/buffers/buffer.rb +1 -1
- data/lib/vedeu/buffers/view.rb +7 -6
- data/lib/vedeu/colours/repository.rb +0 -15
- data/lib/vedeu/cursors/cursor.rb +6 -6
- data/lib/vedeu/cursors/refresh.rb +11 -19
- data/lib/vedeu/cursors/reposition.rb +3 -5
- data/lib/vedeu/editor/cropper.rb +9 -9
- data/lib/vedeu/editor/cursor.rb +5 -5
- data/lib/vedeu/editor/editor.rb +1 -1
- data/lib/vedeu/events/event.rb +1 -1
- data/lib/vedeu/events/trigger.rb +1 -1
- data/lib/vedeu/geometry/area.rb +94 -17
- data/lib/vedeu/geometry/coordinate.rb +15 -15
- data/lib/vedeu/geometry/dimension.rb +2 -2
- data/lib/vedeu/geometry/geometry.rb +30 -27
- data/lib/vedeu/geometry/null.rb +17 -11
- data/lib/vedeu/interfaces/clear.rb +5 -12
- data/lib/vedeu/output/viewport.rb +13 -13
- data/lib/vedeu/plugins/plugin.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +1 -3
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/border_test.rb +4 -230
- data/test/lib/vedeu/borders/caption_test.rb +15 -0
- data/test/lib/vedeu/borders/dsl_test.rb +4 -4
- data/test/lib/vedeu/borders/null_test.rb +3 -39
- data/test/lib/vedeu/buffers/view_test.rb +2 -0
- data/test/lib/vedeu/colours/repository_test.rb +0 -19
- data/test/lib/vedeu/cursors/reposition_test.rb +17 -4
- data/test/lib/vedeu/dsl/shared_test.rb +34 -0
- data/test/lib/vedeu/geometry/area_test.rb +196 -3
- data/test/lib/vedeu/geometry/dimension_test.rb +79 -79
- data/test/lib/vedeu/geometry/geometry_test.rb +4 -0
- data/test/lib/vedeu/groups/refresh_test.rb +1 -1
- data/test/lib/vedeu/logging/clock_time_test.rb +14 -0
- data/test/lib/vedeu/logging/ips_test.rb +43 -0
- data/test/lib/vedeu/output/presentation/colour_test.rb +4 -0
- data/test/lib/vedeu/repositories/repositories_test.rb +7 -1
- data/test/lib/vedeu/terminal/buffer_test.rb +10 -0
- data/test/support/examples/material_colours_app.rb +306 -47
- data/test/test_helper.rb +5 -5
- metadata +7 -4
- data/test/support/examples/borders_app.rb +0 -330
@@ -28,6 +28,7 @@ module Vedeu
|
|
28
28
|
# Returns a new instance of Vedeu::Geometry::Dimension.
|
29
29
|
#
|
30
30
|
# @param attributes [Hash<Symbol => Fixnum, NilClass>]
|
31
|
+
# @option attributes alignment [Symbol]
|
31
32
|
# @option attributes d [Fixnum|NilClass]
|
32
33
|
# The starting value (y or x).
|
33
34
|
# @option attributes dn [Fixnum|NilClass]
|
@@ -36,7 +37,6 @@ module Vedeu
|
|
36
37
|
# @option attributes default [Fixnum|NilClass]
|
37
38
|
# The terminal width or height.
|
38
39
|
# @option attributes maximised [Boolean]
|
39
|
-
# @option attributes alignment [Symbol]
|
40
40
|
# @return [Vedeu::Geometry::Dimension]
|
41
41
|
def initialize(attributes = {})
|
42
42
|
defaults.merge!(attributes).each do |key, value|
|
@@ -127,7 +127,7 @@ module Vedeu
|
|
127
127
|
# @return [Fixnum|NilClass]
|
128
128
|
def length
|
129
129
|
if d && dn
|
130
|
-
(d
|
130
|
+
(dn - d) + 1
|
131
131
|
|
132
132
|
elsif d_dn
|
133
133
|
d_dn
|
@@ -16,20 +16,26 @@ module Vedeu
|
|
16
16
|
include Vedeu::Repositories::Model
|
17
17
|
|
18
18
|
def_delegators :area,
|
19
|
-
:
|
19
|
+
:bordered_height,
|
20
|
+
:bordered_width,
|
21
|
+
:bottom,
|
22
|
+
:bx,
|
23
|
+
:bxn,
|
24
|
+
:by,
|
25
|
+
:byn,
|
20
26
|
:east,
|
27
|
+
:height,
|
28
|
+
:left,
|
29
|
+
:north,
|
30
|
+
:right,
|
21
31
|
:south,
|
22
|
-
:west,
|
23
32
|
:top,
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:left,
|
27
|
-
:y,
|
28
|
-
:xn,
|
29
|
-
:yn,
|
33
|
+
:west,
|
34
|
+
:width,
|
30
35
|
:x,
|
31
|
-
:
|
32
|
-
:
|
36
|
+
:xn,
|
37
|
+
:y,
|
38
|
+
:yn
|
33
39
|
|
34
40
|
# @!attribute [rw] horizontal_alignment
|
35
41
|
# @return [Symbol]
|
@@ -40,7 +46,7 @@ module Vedeu
|
|
40
46
|
attr_accessor :vertical_alignment
|
41
47
|
|
42
48
|
# @!attribute [rw] name
|
43
|
-
# @return [String]
|
49
|
+
# @return [String|Symbol]
|
44
50
|
attr_accessor :name
|
45
51
|
|
46
52
|
# @!attribute [w] height
|
@@ -165,50 +171,47 @@ module Vedeu
|
|
165
171
|
|
166
172
|
# Moves the geometry down by one row.
|
167
173
|
#
|
168
|
-
# @todo Move cursor also.
|
169
174
|
# @return [Vedeu::Geometry::Geometry]
|
170
175
|
def move_down
|
171
176
|
return self if yn + 1 > Vedeu.height
|
172
177
|
|
173
|
-
move(y: y + 1, yn: yn + 1)
|
178
|
+
move(y: y + 1, yn: yn + 1) { Vedeu.trigger(:_cursor_down_, name) }
|
174
179
|
end
|
175
180
|
|
176
181
|
# Moves the geometry left by one column.
|
177
182
|
#
|
178
|
-
# @todo Move cursor also.
|
179
183
|
# @return [Vedeu::Geometry::Geometry]
|
180
184
|
def move_left
|
181
185
|
return self if x - 1 < 1
|
182
186
|
|
183
|
-
move(x: x - 1, xn: xn - 1)
|
187
|
+
move(x: x - 1, xn: xn - 1) { Vedeu.trigger(:_cursor_left_, name) }
|
184
188
|
end
|
185
189
|
|
186
190
|
# Moves the geometry to the top left of the terminal.
|
187
191
|
#
|
188
|
-
# @todo Move cursor also.
|
189
192
|
# @return [Vedeu::Geometry::Geometry]
|
190
193
|
def move_origin
|
191
|
-
move(x: 1, xn: (xn - x + 1), y: 1, yn: (yn - y + 1))
|
194
|
+
move(x: 1, xn: (xn - x + 1), y: 1, yn: (yn - y + 1)) do
|
195
|
+
Vedeu.trigger(:_cursor_origin_, name)
|
196
|
+
end
|
192
197
|
end
|
193
198
|
|
194
199
|
# Moves the geometry right by one column.
|
195
200
|
#
|
196
|
-
# @todo Move cursor also.
|
197
201
|
# @return [Vedeu::Geometry::Geometry]
|
198
202
|
def move_right
|
199
203
|
return self if xn + 1 > Vedeu.width
|
200
204
|
|
201
|
-
move(x: x + 1, xn: xn + 1)
|
205
|
+
move(x: x + 1, xn: xn + 1) { Vedeu.trigger(:_cursor_right_, name) }
|
202
206
|
end
|
203
207
|
|
204
208
|
# Moves the geometry up by one column.
|
205
209
|
#
|
206
|
-
# @todo Move cursor also.
|
207
210
|
# @return [Vedeu::Geometry::Geometry]
|
208
211
|
def move_up
|
209
212
|
return self if y - 1 < 1
|
210
213
|
|
211
|
-
move(y: y - 1, yn: yn - 1)
|
214
|
+
move(y: y - 1, yn: yn - 1) { Vedeu.trigger(:_cursor_up_, name) }
|
212
215
|
end
|
213
216
|
|
214
217
|
# Will unmaximise the named interface geometry. Previously, when
|
@@ -245,6 +248,7 @@ module Vedeu
|
|
245
248
|
{
|
246
249
|
horizontal_alignment: @horizontal_alignment,
|
247
250
|
maximised: @maximised,
|
251
|
+
name: name,
|
248
252
|
vertical_alignment: @vertical_alignment,
|
249
253
|
x: @x.is_a?(Proc) ? @x.call : @x,
|
250
254
|
xn: @xn.is_a?(Proc) ? @xn.call : @xn,
|
@@ -255,11 +259,6 @@ module Vedeu
|
|
255
259
|
}
|
256
260
|
end
|
257
261
|
|
258
|
-
# @return [Vedeu::Borders::Border]
|
259
|
-
def border
|
260
|
-
@border = Vedeu.borders.by_name(name)
|
261
|
-
end
|
262
|
-
|
263
262
|
# When moving an interface;
|
264
263
|
# 1) Reset the alignment and maximised states to false;
|
265
264
|
# it wont be aligned to a side if moved, and cannot be moved
|
@@ -283,7 +282,11 @@ module Vedeu
|
|
283
282
|
vertical_alignment: :none)
|
284
283
|
.merge!(coordinates)
|
285
284
|
|
286
|
-
Vedeu::Geometry::Geometry.store(attrs)
|
285
|
+
geometry = Vedeu::Geometry::Geometry.store(attrs)
|
286
|
+
|
287
|
+
yield if block_given?
|
288
|
+
|
289
|
+
geometry
|
287
290
|
end
|
288
291
|
|
289
292
|
# Returns the default options/attributes for this class.
|
data/lib/vedeu/geometry/null.rb
CHANGED
@@ -11,27 +11,33 @@ module Vedeu
|
|
11
11
|
extend Forwardable
|
12
12
|
|
13
13
|
def_delegators :area,
|
14
|
-
:
|
14
|
+
:bordered_height,
|
15
|
+
:bordered_width,
|
16
|
+
:bottom,
|
17
|
+
:bx,
|
18
|
+
:bxn,
|
19
|
+
:by,
|
20
|
+
:byn,
|
15
21
|
:east,
|
22
|
+
:height,
|
23
|
+
:left,
|
24
|
+
:north,
|
25
|
+
:right,
|
16
26
|
:south,
|
17
|
-
:west,
|
18
27
|
:top,
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:left,
|
22
|
-
:y,
|
23
|
-
:xn,
|
24
|
-
:yn,
|
28
|
+
:west,
|
29
|
+
:width,
|
25
30
|
:x,
|
26
|
-
:
|
27
|
-
:
|
31
|
+
:xn,
|
32
|
+
:y,
|
33
|
+
:yn
|
28
34
|
|
29
35
|
# @!attribute [rw] maximised
|
30
36
|
# @return [Boolean]
|
31
37
|
attr_accessor :maximised
|
32
38
|
|
33
39
|
# @!attribute [r] name
|
34
|
-
# @return [String|
|
40
|
+
# @return [NilClass|String|Symbol]
|
35
41
|
attr_reader :name
|
36
42
|
|
37
43
|
# Returns a new instance of Vedeu::Geometry::Null.
|
@@ -76,18 +76,11 @@ module Vedeu
|
|
76
76
|
protected
|
77
77
|
|
78
78
|
# @!attribute [r] name
|
79
|
-
# @return [String]
|
79
|
+
# @return [String|Symbol]
|
80
80
|
attr_reader :name
|
81
81
|
|
82
82
|
private
|
83
83
|
|
84
|
-
# Returns the border for the interface.
|
85
|
-
#
|
86
|
-
# @return (see Vedeu::Borders::Repository#by_name)
|
87
|
-
def border
|
88
|
-
@border ||= Vedeu.borders.by_name(name)
|
89
|
-
end
|
90
|
-
|
91
84
|
# @return [String] A string of blank characters.
|
92
85
|
def chars
|
93
86
|
@chars ||= (' ' * width).freeze
|
@@ -126,7 +119,7 @@ module Vedeu
|
|
126
119
|
# @return [Fixnum]
|
127
120
|
def height
|
128
121
|
@height ||= if content_only?
|
129
|
-
|
122
|
+
geometry.bordered_height
|
130
123
|
|
131
124
|
else
|
132
125
|
geometry.height
|
@@ -188,7 +181,7 @@ module Vedeu
|
|
188
181
|
# @return [Fixnum]
|
189
182
|
def width
|
190
183
|
@width ||= if content_only?
|
191
|
-
|
184
|
+
geometry.bordered_width
|
192
185
|
|
193
186
|
else
|
194
187
|
geometry.width
|
@@ -199,7 +192,7 @@ module Vedeu
|
|
199
192
|
# @return [Fixnum]
|
200
193
|
def y
|
201
194
|
@y ||= if content_only?
|
202
|
-
|
195
|
+
geometry.by
|
203
196
|
|
204
197
|
else
|
205
198
|
geometry.y
|
@@ -210,7 +203,7 @@ module Vedeu
|
|
210
203
|
# @return [Fixnum]
|
211
204
|
def x
|
212
205
|
@x ||= if content_only?
|
213
|
-
|
206
|
+
geometry.bx
|
214
207
|
|
215
208
|
else
|
216
209
|
geometry.x
|
@@ -20,9 +20,9 @@ module Vedeu
|
|
20
20
|
:name,
|
21
21
|
:visible?
|
22
22
|
|
23
|
-
def_delegators :
|
24
|
-
:
|
25
|
-
:
|
23
|
+
def_delegators :geometry,
|
24
|
+
:bordered_height,
|
25
|
+
:bordered_width
|
26
26
|
|
27
27
|
def_delegators :cursor,
|
28
28
|
:ox,
|
@@ -106,7 +106,7 @@ module Vedeu
|
|
106
106
|
#
|
107
107
|
# @return [Range]
|
108
108
|
def rows
|
109
|
-
top...(top +
|
109
|
+
top...(top + bordered_height)
|
110
110
|
end
|
111
111
|
|
112
112
|
# Using the current cursor's x position, return a range of
|
@@ -121,17 +121,17 @@ module Vedeu
|
|
121
121
|
#
|
122
122
|
# @return [Range]
|
123
123
|
def columns
|
124
|
-
left...(left +
|
124
|
+
left...(left + bordered_width)
|
125
125
|
end
|
126
126
|
|
127
127
|
# @return [Fixnum]
|
128
128
|
def left
|
129
|
-
@left ||= content_offset(ox,
|
129
|
+
@left ||= content_offset(ox, bordered_width)
|
130
130
|
end
|
131
131
|
|
132
132
|
# @return [Fixnum]
|
133
133
|
def top
|
134
|
-
@top ||= content_offset(oy,
|
134
|
+
@top ||= content_offset(oy, bordered_height)
|
135
135
|
end
|
136
136
|
|
137
137
|
# Returns the offset for the content (the number of rows or
|
@@ -147,21 +147,21 @@ module Vedeu
|
|
147
147
|
offset - dimension
|
148
148
|
end
|
149
149
|
|
150
|
-
# Returns the
|
150
|
+
# Returns the geometry for the interface.
|
151
151
|
#
|
152
|
-
# @return (see Vedeu::
|
153
|
-
def
|
154
|
-
@
|
152
|
+
# @return (see Vedeu::Geometry::Repository#by_name)
|
153
|
+
def geometry
|
154
|
+
@geometry ||= Vedeu.geometries.by_name(name)
|
155
155
|
end
|
156
156
|
|
157
157
|
# @return [Fixnum]
|
158
158
|
def bx
|
159
|
-
@bx ||=
|
159
|
+
@bx ||= geometry.bx
|
160
160
|
end
|
161
161
|
|
162
162
|
# @return [Fixnum]
|
163
163
|
def by
|
164
|
-
@by ||=
|
164
|
+
@by ||= geometry.by
|
165
165
|
end
|
166
166
|
|
167
167
|
# @return [Vedeu::Cursors::Cursor]
|
data/lib/vedeu/plugins/plugin.rb
CHANGED
@@ -63,9 +63,7 @@ module Vedeu
|
|
63
63
|
# @param name [String|Symbol] The name of the stored model.
|
64
64
|
# @return [void]
|
65
65
|
def by_name(name = Vedeu.focus)
|
66
|
-
name
|
67
|
-
|
68
|
-
return find(name) if registered?(name)
|
66
|
+
return find(name) if present?(name) && registered?(name)
|
69
67
|
|
70
68
|
null_model.new(name: name)
|
71
69
|
end
|
data/lib/vedeu/version.rb
CHANGED
@@ -55,6 +55,8 @@ module Vedeu
|
|
55
55
|
instance.must_respond_to(:bottom_left=)
|
56
56
|
instance.must_respond_to(:bottom_right)
|
57
57
|
instance.must_respond_to(:bottom_right=)
|
58
|
+
instance.must_respond_to(:caption)
|
59
|
+
instance.must_respond_to(:caption=)
|
58
60
|
instance.must_respond_to(:horizontal)
|
59
61
|
instance.must_respond_to(:horizontal=)
|
60
62
|
instance.must_respond_to(:show_bottom)
|
@@ -69,6 +71,8 @@ module Vedeu
|
|
69
71
|
instance.must_respond_to(:show_top)
|
70
72
|
instance.must_respond_to(:top?)
|
71
73
|
instance.must_respond_to(:show_top=)
|
74
|
+
instance.must_respond_to(:title)
|
75
|
+
instance.must_respond_to(:title=)
|
72
76
|
instance.must_respond_to(:top_left)
|
73
77
|
instance.must_respond_to(:top_left=)
|
74
78
|
instance.must_respond_to(:top_right)
|
@@ -82,128 +86,6 @@ module Vedeu
|
|
82
86
|
}
|
83
87
|
end
|
84
88
|
|
85
|
-
describe 'border offset methods; bx, bxn, by, byn' do
|
86
|
-
let(:attributes) {
|
87
|
-
{
|
88
|
-
bottom_left: 'C',
|
89
|
-
bottom_right: 'D',
|
90
|
-
enabled: enabled,
|
91
|
-
horizontal: 'H',
|
92
|
-
name: _name,
|
93
|
-
show_top: top,
|
94
|
-
show_bottom: bottom,
|
95
|
-
show_left: left,
|
96
|
-
show_right: right,
|
97
|
-
top_left: 'A',
|
98
|
-
top_right: 'B',
|
99
|
-
vertical: 'V'
|
100
|
-
}
|
101
|
-
}
|
102
|
-
let(:_name) { 'Border#bxbxnbybyn' }
|
103
|
-
let(:enabled) { false }
|
104
|
-
let(:top) { false }
|
105
|
-
let(:bottom) { false }
|
106
|
-
let(:left) { false }
|
107
|
-
let(:right) { false }
|
108
|
-
let(:geometry) {
|
109
|
-
Vedeu::Geometry::Geometry.new(name: _name,
|
110
|
-
x: 2,
|
111
|
-
xn: 6,
|
112
|
-
y: 2,
|
113
|
-
yn: 6)
|
114
|
-
}
|
115
|
-
|
116
|
-
before { Vedeu.geometries.stubs(:by_name).returns(geometry) }
|
117
|
-
|
118
|
-
describe '#bx' do
|
119
|
-
subject { instance.bx }
|
120
|
-
|
121
|
-
context 'when enabled' do
|
122
|
-
let(:enabled) { true }
|
123
|
-
|
124
|
-
context 'with left' do
|
125
|
-
let(:left) { true }
|
126
|
-
|
127
|
-
it { subject.must_equal(3) }
|
128
|
-
end
|
129
|
-
|
130
|
-
context 'without left' do
|
131
|
-
it { subject.must_equal(2) }
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
context 'when not enabled' do
|
136
|
-
it { subject.must_equal(2) }
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
describe '#bxn' do
|
141
|
-
subject { instance.bxn }
|
142
|
-
|
143
|
-
context 'when enabled' do
|
144
|
-
let(:enabled) { true }
|
145
|
-
|
146
|
-
context 'with right' do
|
147
|
-
let(:right) { true }
|
148
|
-
|
149
|
-
it { subject.must_equal(5) }
|
150
|
-
end
|
151
|
-
|
152
|
-
context 'without right' do
|
153
|
-
it { subject.must_equal(6) }
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
context 'when not enabled' do
|
158
|
-
it { subject.must_equal(6) }
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
describe '#by' do
|
163
|
-
subject { instance.by }
|
164
|
-
|
165
|
-
context 'when enabled' do
|
166
|
-
let(:enabled) { true }
|
167
|
-
|
168
|
-
context 'with top' do
|
169
|
-
let(:top) { true }
|
170
|
-
|
171
|
-
it { subject.must_equal(3) }
|
172
|
-
end
|
173
|
-
|
174
|
-
context 'without top' do
|
175
|
-
it { subject.must_equal(2) }
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
context 'when not enabled' do
|
180
|
-
it { subject.must_equal(2) }
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
describe '#byn' do
|
185
|
-
subject { instance.byn }
|
186
|
-
|
187
|
-
context 'when enabled' do
|
188
|
-
let(:enabled) { true }
|
189
|
-
|
190
|
-
context 'with bottom' do
|
191
|
-
let(:bottom) { true }
|
192
|
-
|
193
|
-
it { subject.must_equal(5) }
|
194
|
-
end
|
195
|
-
|
196
|
-
context 'without bottom' do
|
197
|
-
it { subject.must_equal(6) }
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
context 'when not enabled' do
|
202
|
-
it { subject.must_equal(6) }
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
89
|
describe '#deputy' do
|
208
90
|
subject { instance.deputy }
|
209
91
|
|
@@ -212,114 +94,6 @@ module Vedeu
|
|
212
94
|
end
|
213
95
|
end
|
214
96
|
|
215
|
-
describe '#width' do
|
216
|
-
let(:geometry) {
|
217
|
-
Vedeu::Geometry::Geometry.new(name: _name, width: 8)
|
218
|
-
}
|
219
|
-
|
220
|
-
before { Vedeu.geometries.stubs(:by_name).returns(geometry) }
|
221
|
-
|
222
|
-
subject { instance.width }
|
223
|
-
|
224
|
-
context 'when the border is not enabled' do
|
225
|
-
it 'returns the interface width' do
|
226
|
-
subject.must_equal(8)
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
context 'when the border is enabled' do
|
231
|
-
context 'when both left and right borders are shown' do
|
232
|
-
let(:attributes) {
|
233
|
-
{
|
234
|
-
enabled: true,
|
235
|
-
name: _name,
|
236
|
-
}
|
237
|
-
}
|
238
|
-
|
239
|
-
it { subject.must_equal(6) }
|
240
|
-
end
|
241
|
-
|
242
|
-
context 'when either the left or right border is shown' do
|
243
|
-
let(:attributes) {
|
244
|
-
{
|
245
|
-
enabled: true,
|
246
|
-
name: _name,
|
247
|
-
show_left: false
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
|
-
it { subject.must_equal(7) }
|
252
|
-
end
|
253
|
-
|
254
|
-
context 'when neither left nor right borders are shown' do
|
255
|
-
let(:attributes) {
|
256
|
-
{
|
257
|
-
enabled: true,
|
258
|
-
name: _name,
|
259
|
-
show_left: false,
|
260
|
-
show_right: false
|
261
|
-
}
|
262
|
-
}
|
263
|
-
|
264
|
-
it { subject.must_equal(8) }
|
265
|
-
end
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
describe '#height' do
|
270
|
-
let(:geometry) {
|
271
|
-
Vedeu::Geometry::Geometry.new(name: _name, height: 5)
|
272
|
-
}
|
273
|
-
|
274
|
-
before { Vedeu.geometries.stubs(:by_name).returns(geometry) }
|
275
|
-
|
276
|
-
subject { instance.height }
|
277
|
-
|
278
|
-
context 'when the border is not enabled' do
|
279
|
-
it 'returns the interface height' do
|
280
|
-
subject.must_equal(5)
|
281
|
-
end
|
282
|
-
end
|
283
|
-
|
284
|
-
context 'when the border is enabled' do
|
285
|
-
context 'when both top and bottom borders are shown' do
|
286
|
-
let(:attributes) {
|
287
|
-
{
|
288
|
-
enabled: true,
|
289
|
-
name: _name,
|
290
|
-
}
|
291
|
-
}
|
292
|
-
|
293
|
-
it { subject.must_equal(3) }
|
294
|
-
end
|
295
|
-
|
296
|
-
context 'when either the top or bottom border is shown' do
|
297
|
-
let(:attributes) {
|
298
|
-
{
|
299
|
-
enabled: true,
|
300
|
-
name: _name,
|
301
|
-
show_top: false
|
302
|
-
}
|
303
|
-
}
|
304
|
-
|
305
|
-
it { subject.must_equal(4) }
|
306
|
-
end
|
307
|
-
|
308
|
-
context 'when neither top nor bottom borders are shown' do
|
309
|
-
let(:attributes) {
|
310
|
-
{
|
311
|
-
enabled: true,
|
312
|
-
name: _name,
|
313
|
-
show_top: false,
|
314
|
-
show_bottom: false
|
315
|
-
}
|
316
|
-
}
|
317
|
-
|
318
|
-
it { subject.must_equal(5) }
|
319
|
-
end
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
97
|
describe '#enabled?' do
|
324
98
|
subject { instance.enabled? }
|
325
99
|
|