vedeu 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.md +4 -0
- data/docs/dsl.md +1 -11
- data/docs/dsl/by_method/geometry/align.md +1 -0
- data/docs/dsl/by_method/geometry/align_bottom.md +40 -0
- data/docs/dsl/by_method/geometry/align_centre.md +40 -0
- data/docs/dsl/by_method/geometry/align_left.md +40 -0
- data/docs/dsl/by_method/geometry/align_middle.md +40 -0
- data/docs/dsl/by_method/geometry/align_right.md +40 -0
- data/docs/dsl/by_method/geometry/align_top.md +40 -0
- data/docs/dsl/by_method/geometry/columns.md +1 -0
- data/docs/dsl/by_method/geometry/height.md +0 -0
- data/docs/dsl/by_method/geometry/horizontal_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/rows.md +1 -0
- data/docs/dsl/by_method/geometry/vertical_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/width.md +0 -0
- data/docs/dsl/by_method/geometry/x.md +1 -0
- data/docs/dsl/by_method/geometry/xn.md +1 -0
- data/docs/dsl/by_method/geometry/y.md +1 -0
- data/docs/dsl/by_method/geometry/yn.md +1 -0
- data/docs/dsl/by_method/render.md +5 -1
- data/docs/dsl/by_method/renders.md +31 -1
- data/docs/dsl/by_method/view.md +26 -0
- data/docs/dsl/by_method/view/stream.md +18 -0
- data/docs/dsl/by_method/views.md +32 -1
- data/docs/events/by_name/set_border_caption.md +2 -4
- data/docs/events/by_name/set_border_title.md +2 -4
- data/examples/views/empty_template.rb +0 -4
- data/examples/views/full_screen.rb +30 -5
- data/examples/views/misc_view.rb +464 -0
- data/examples/views/wordwrap.rb +72 -0
- data/examples/views/wordwrap.txt +8 -0
- data/integrations/dsl_app_021.rb +127 -0
- data/integrations/dsl_app_022.rb +133 -0
- data/integrations/expected/342_streams.out +1 -1
- data/integrations/expected/dsl_app_001.out +1 -1
- data/integrations/expected/dsl_app_002.out +1 -1
- data/integrations/expected/dsl_app_003.out +1 -1
- data/integrations/expected/dsl_app_004.out +1 -1
- data/integrations/expected/dsl_app_005.out +1 -1
- data/integrations/expected/dsl_app_006.out +1 -1
- data/integrations/expected/dsl_app_007.out +1 -1
- data/integrations/expected/dsl_app_008.out +1 -1
- data/integrations/expected/dsl_app_009.out +1 -1
- data/integrations/expected/dsl_app_010.out +1 -1
- data/integrations/expected/dsl_app_011.out +1 -1
- data/integrations/expected/dsl_app_012.out +1 -1
- data/integrations/expected/dsl_app_013.out +1 -1
- data/integrations/expected/dsl_app_014.out +1 -1
- data/integrations/expected/dsl_app_015.out +1 -1
- data/integrations/expected/dsl_app_016.out +1 -1
- data/integrations/expected/dsl_app_021.out +1 -0
- data/integrations/expected/dsl_app_022.out +1 -0
- data/integrations/support/test_interface_021.rb +7 -0
- data/integrations/support/test_interface_022.rb +15 -0
- data/lib/vedeu/all.rb +4 -2
- data/lib/vedeu/borders/border.rb +22 -6
- data/lib/vedeu/borders/repository.rb +4 -8
- data/lib/vedeu/buffers/buffer.rb +9 -6
- data/lib/vedeu/buffers/empty.rb +26 -23
- data/lib/vedeu/buffers/view.rb +44 -41
- data/lib/vedeu/cells/cursor.rb +0 -2
- data/lib/vedeu/cells/empty.rb +0 -1
- data/lib/vedeu/cells/escape.rb +0 -2
- data/lib/vedeu/coercers/alignment.rb +58 -8
- data/lib/vedeu/coercers/horizontal_alignment.rb +13 -9
- data/lib/vedeu/coercers/vertical_alignment.rb +13 -8
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/configuration/configuration.rb +41 -3
- data/lib/vedeu/cursors/coordinate.rb +1 -3
- data/lib/vedeu/cursors/cursor.rb +2 -6
- data/lib/vedeu/dsl/all.rb +1 -2
- data/lib/vedeu/dsl/border.rb +6 -6
- data/lib/vedeu/dsl/elements.rb +2 -2
- data/lib/vedeu/dsl/geometry.rb +7 -7
- data/lib/vedeu/dsl/{string → helpers}/align.rb +0 -0
- data/lib/vedeu/dsl/helpers/all.rb +17 -0
- data/lib/vedeu/dsl/{attributes.rb → helpers/attributes.rb} +0 -0
- data/lib/vedeu/dsl/{string → helpers}/text.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/truncate.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/wordwrap.rb +0 -0
- data/lib/vedeu/dsl/view.rb +11 -19
- data/lib/vedeu/dsl/views.rb +16 -106
- data/lib/vedeu/geometries/all.rb +0 -1
- data/lib/vedeu/geometries/area/area.rb +6 -12
- data/lib/vedeu/geometries/area/dimension.rb +21 -44
- data/lib/vedeu/geometries/dsl/all.rb +0 -1
- data/lib/vedeu/geometries/dsl/dsl.rb +22 -31
- data/lib/vedeu/geometries/geometry.rb +6 -0
- data/lib/vedeu/geometries/position.rb +6 -3
- data/lib/vedeu/geometries/repository.rb +1 -1
- data/lib/vedeu/input/mouse.rb +1 -0
- data/lib/vedeu/logging/log.rb +3 -6
- data/lib/vedeu/menus/dsl.rb +4 -5
- data/lib/vedeu/output/compressor.rb +11 -1
- data/lib/vedeu/output/viewport.rb +59 -59
- data/lib/vedeu/presentation/all.rb +1 -2
- data/lib/vedeu/presentation/colour.rb +75 -3
- data/lib/vedeu/{geometries/positionable.rb → presentation/position.rb} +4 -4
- data/lib/vedeu/presentation/presentation.rb +1 -3
- data/lib/vedeu/presentation/styles.rb +16 -1
- data/lib/vedeu/repositories/all.rb +0 -1
- data/lib/vedeu/sentence.rb +91 -0
- data/lib/vedeu/support/point.rb +72 -0
- data/lib/vedeu/terminal/terminal.rb +11 -53
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/composition.rb +11 -1
- data/lib/vedeu/views/default_attributes.rb +2 -0
- data/lib/vedeu/views/line.rb +16 -1
- data/lib/vedeu/views/stream.rb +16 -1
- data/lib/vedeu/views/view.rb +25 -17
- data/test/lib/vedeu/borders/border_test.rb +20 -2
- data/test/lib/vedeu/buffers/buffer_test.rb +15 -2
- data/test/lib/vedeu/buffers/empty_test.rb +51 -18
- data/test/lib/vedeu/buffers/view_test.rb +2 -2
- data/test/lib/vedeu/coercers/alignment_test.rb +32 -0
- data/test/lib/vedeu/coercers/horizontal_alignment_test.rb +16 -0
- data/test/lib/vedeu/coercers/vertical_alignment_test.rb +16 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/dsl_test.rb +35 -21
- data/test/lib/vedeu/dsl/elements_test.rb +94 -2
- data/test/lib/vedeu/dsl/{string → helpers}/align_test.rb +0 -0
- data/test/lib/vedeu/dsl/{attributes_test.rb → helpers/attributes_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/text_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/truncate_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/wordwrap_test.rb +0 -0
- data/test/lib/vedeu/dsl/view_test.rb +22 -4
- data/test/lib/vedeu/dsl/views_test.rb +8 -5
- data/test/lib/vedeu/geometries/dsl/dsl_test.rb +2 -159
- data/test/lib/vedeu/geometries/position_test.rb +118 -60
- data/test/lib/vedeu/input/mouse_test.rb +1 -6
- data/test/lib/vedeu/logging/log_test.rb +14 -3
- data/test/lib/vedeu/presentation/colour_test.rb +77 -0
- data/test/lib/vedeu/{geometries/positionable_test.rb → presentation/position_test.rb} +4 -4
- data/test/lib/vedeu/sentence_test.rb +49 -0
- data/test/lib/vedeu/support/point_test.rb +139 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +3 -44
- data/test/lib/vedeu/views/composition_test.rb +24 -4
- data/test/lib/vedeu/views/default_attributes_test.rb +10 -2
- data/test/lib/vedeu/views/view_test.rb +8 -15
- data/test/support/examples/material_colours_app.rb +0 -6
- data/vedeu.gemspec +1 -1
- metadata +58 -38
- data/examples/views/lines_line_stream.rb +0 -95
- data/examples/views/lines_line_streams.rb +0 -75
- data/examples/views/lines_line_streams_stream.rb +0 -78
- data/examples/views/lines_line_streams_stream_stream.rb +0 -50
- data/examples/views/lines_streams.rb +0 -93
- data/lib/vedeu/dsl/string/all.rb +0 -16
- data/lib/vedeu/geometries/dsl/validator.rb +0 -62
- data/lib/vedeu/presentation/background.rb +0 -54
- data/lib/vedeu/presentation/foreground.rb +0 -54
- data/lib/vedeu/repositories/parent.rb +0 -34
- data/test/lib/vedeu/geometries/dsl/validator_test.rb +0 -85
- data/test/lib/vedeu/presentation/background_test.rb +0 -74
- data/test/lib/vedeu/presentation/foreground_test.rb +0 -75
@@ -57,12 +57,7 @@ module Vedeu
|
|
57
57
|
context 'when the mouse input was not recognised' do
|
58
58
|
let(:input) { "\e[Mb0(" }
|
59
59
|
|
60
|
-
it
|
61
|
-
Vedeu.expects(:trigger).with(:_mouse_event_, input)
|
62
|
-
subject.
|
63
|
-
must_equal("\e[93m[input] \e[39m\e[33mVedeu does not " \
|
64
|
-
"support mouse button '66' yet.\e[39m")
|
65
|
-
end
|
60
|
+
it { subject.must_equal(false) }
|
66
61
|
end
|
67
62
|
end
|
68
63
|
|
@@ -20,9 +20,20 @@ module Vedeu
|
|
20
20
|
describe '.log' do
|
21
21
|
subject { described.log(message: _message, force: force, type: type) }
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
context 'when :force is true' do
|
24
|
+
let(:force) { true }
|
25
|
+
let(:expected) {
|
26
|
+
"\e[97m[info] \e[39m\e[37mSome message...\e[39m"
|
27
|
+
}
|
28
|
+
|
29
|
+
it { subject.must_equal(expected) }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'when :force is false' do
|
33
|
+
let(:force) { false }
|
34
|
+
|
35
|
+
it { subject.must_equal(nil) }
|
36
|
+
end
|
26
37
|
end
|
27
38
|
|
28
39
|
describe '.log_stdout' do
|
@@ -26,6 +26,44 @@ module Vedeu
|
|
26
26
|
let(:foreground) { '#aadd00' }
|
27
27
|
let(:parent) { Vedeu::ParentPresentationColourTestClass.new }
|
28
28
|
|
29
|
+
describe '#background' do
|
30
|
+
subject { includer.background }
|
31
|
+
|
32
|
+
it { subject.must_be_instance_of(Vedeu::Colours::Background) }
|
33
|
+
|
34
|
+
context 'when a colour is not set' do
|
35
|
+
let(:colour) {}
|
36
|
+
|
37
|
+
context 'when a parent is not available' do
|
38
|
+
let(:parent) {}
|
39
|
+
|
40
|
+
it { subject.colour.must_equal('') }
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'when a parent is available' do
|
44
|
+
it { subject.colour.must_equal('#330000') }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'when a colour is set' do
|
49
|
+
it { subject.colour.must_equal('#000033') }
|
50
|
+
end
|
51
|
+
|
52
|
+
# @todo Add more tests.
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#background=' do
|
56
|
+
subject { includer.background = '#987654' }
|
57
|
+
|
58
|
+
it do
|
59
|
+
includer.colour.background.colour.must_equal('#000033')
|
60
|
+
subject
|
61
|
+
includer.colour.background.colour.must_equal('#987654')
|
62
|
+
end
|
63
|
+
|
64
|
+
it { subject.must_equal('#987654') }
|
65
|
+
end
|
66
|
+
|
29
67
|
describe '#colour' do
|
30
68
|
subject { includer.colour }
|
31
69
|
|
@@ -63,6 +101,45 @@ module Vedeu
|
|
63
101
|
it { subject.must_be_instance_of(Vedeu::Colours::Colour) }
|
64
102
|
end
|
65
103
|
|
104
|
+
describe '#foreground' do
|
105
|
+
subject { includer.foreground }
|
106
|
+
|
107
|
+
it { subject.must_be_instance_of(Vedeu::Colours::Foreground) }
|
108
|
+
it { subject.colour.must_equal('#aadd00') }
|
109
|
+
|
110
|
+
context 'when a colour is not set' do
|
111
|
+
let(:colour) {}
|
112
|
+
|
113
|
+
context 'when a parent is not available' do
|
114
|
+
let(:parent) {}
|
115
|
+
|
116
|
+
it { subject.colour.must_equal('') }
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'when a parent is available' do
|
120
|
+
it { subject.colour.must_equal('#00aadd') }
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context 'when a colour is set' do
|
125
|
+
it { subject.colour.must_equal('#aadd00') }
|
126
|
+
end
|
127
|
+
|
128
|
+
# @todo Add more tests.
|
129
|
+
end
|
130
|
+
|
131
|
+
describe '#foreground=' do
|
132
|
+
subject { includer.foreground = '#123456' }
|
133
|
+
|
134
|
+
it do
|
135
|
+
includer.colour.foreground.colour.must_equal('#aadd00')
|
136
|
+
subject
|
137
|
+
includer.colour.foreground.colour.must_equal('#123456')
|
138
|
+
end
|
139
|
+
|
140
|
+
it { subject.must_equal('#123456') }
|
141
|
+
end
|
142
|
+
|
66
143
|
end # Colour
|
67
144
|
|
68
145
|
end # Presentation
|
@@ -4,9 +4,9 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
module Vedeu
|
6
6
|
|
7
|
-
module
|
7
|
+
module Presentation
|
8
8
|
|
9
|
-
describe
|
9
|
+
describe Position do
|
10
10
|
|
11
11
|
# describe '#position' do
|
12
12
|
# subject { instance.position }
|
@@ -62,8 +62,8 @@ module Vedeu
|
|
62
62
|
# end
|
63
63
|
# end
|
64
64
|
|
65
|
-
end #
|
65
|
+
end # Position
|
66
66
|
|
67
|
-
end #
|
67
|
+
end # Presentation
|
68
68
|
|
69
69
|
end # Vedeu
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Sentence do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Sentence }
|
8
|
+
let(:elements) { ['Hydrogen'] }
|
9
|
+
let(:label) { 'elements' }
|
10
|
+
|
11
|
+
describe '.construct' do
|
12
|
+
subject { described.construct(elements, label) }
|
13
|
+
|
14
|
+
context 'when there is one element' do
|
15
|
+
let(:elements) { ['Hydrogen'] }
|
16
|
+
|
17
|
+
it 'returns the element as a string' do
|
18
|
+
subject.must_equal('Hydrogen')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when there are two elements' do
|
23
|
+
let(:elements) { %w(Hydrogen Helium) }
|
24
|
+
|
25
|
+
it "returns the elements joined with 'and'" do
|
26
|
+
subject.must_equal('Hydrogen and Helium')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when there are more than two elements' do
|
31
|
+
let(:elements) { %w(Hydrogen Helium Lithium) }
|
32
|
+
|
33
|
+
it 'returns the elements as a sentence list' do
|
34
|
+
subject.must_equal('Hydrogen, Helium and Lithium')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when there are no elements' do
|
39
|
+
let(:elements) { [] }
|
40
|
+
|
41
|
+
it 'returns a polite message' do
|
42
|
+
subject.must_equal('No elements have been assigned.')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end # Sentence
|
48
|
+
|
49
|
+
end # Vedeu
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Point do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Point }
|
8
|
+
let(:instance) { described.new(value: _value, min: min, max: max) }
|
9
|
+
let(:_value) { 5 }
|
10
|
+
let(:min) { 2 }
|
11
|
+
let(:max) { 9 }
|
12
|
+
|
13
|
+
describe '#initialize' do
|
14
|
+
it { instance.must_be_instance_of(described) }
|
15
|
+
it { instance.instance_variable_get('@min').must_equal(min) }
|
16
|
+
it { instance.instance_variable_get('@max').must_equal(max) }
|
17
|
+
it { instance.instance_variable_get('@value').must_equal(_value) }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '.coerce' do
|
21
|
+
subject { described.coerce(value: _value, min: min, max: max) }
|
22
|
+
|
23
|
+
context 'when :min is not a Fixnum' do
|
24
|
+
let(:min) { :invalid }
|
25
|
+
|
26
|
+
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when :max is not a Fixnum' do
|
30
|
+
let(:max) { :invalid }
|
31
|
+
|
32
|
+
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when :min > :max' do
|
36
|
+
let(:max) { 4 }
|
37
|
+
let(:min) { 7 }
|
38
|
+
|
39
|
+
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'when :value is nil' do
|
43
|
+
let(:_value) {}
|
44
|
+
|
45
|
+
it {
|
46
|
+
subject.must_be_instance_of(Vedeu::Point)
|
47
|
+
subject.value.must_equal(min)
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when :value is not nil' do
|
52
|
+
context 'when :value is less than min' do
|
53
|
+
let(:_value) { 1 }
|
54
|
+
|
55
|
+
it {
|
56
|
+
subject.must_be_instance_of(Vedeu::Point)
|
57
|
+
subject.value.must_equal(min)
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'when :value is greater than max' do
|
62
|
+
let(:_value) { 11 }
|
63
|
+
|
64
|
+
it {
|
65
|
+
subject.must_be_instance_of(Vedeu::Point)
|
66
|
+
subject.value.must_equal(max)
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'when :value > :min and :value < :max' do
|
71
|
+
it {
|
72
|
+
subject.must_be_instance_of(Vedeu::Point)
|
73
|
+
subject.value.must_equal(_value)
|
74
|
+
}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '.valid?' do
|
80
|
+
subject { described.valid?(value: _value, min: min, max: max) }
|
81
|
+
|
82
|
+
context 'when the value is not a Fixnum' do
|
83
|
+
let(:_value) { :invalid }
|
84
|
+
|
85
|
+
it { subject.must_equal(false) }
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'when the value is a Fixnum' do
|
89
|
+
context 'but the value < min' do
|
90
|
+
let(:_value) { 1 }
|
91
|
+
|
92
|
+
it { subject.must_equal(false) }
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'but the value >= min' do
|
96
|
+
let(:_value) { 5 }
|
97
|
+
|
98
|
+
it { subject.must_equal(true) }
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'but the value > max' do
|
102
|
+
let(:_value) { 11 }
|
103
|
+
|
104
|
+
it { subject.must_equal(false) }
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'but the value <= max' do
|
108
|
+
let(:_value) { 7 }
|
109
|
+
|
110
|
+
it { subject.must_equal(true) }
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe '#coerce' do
|
116
|
+
it { instance.must_respond_to(:coerce) }
|
117
|
+
end
|
118
|
+
|
119
|
+
describe '#valid?' do
|
120
|
+
it { instance.must_respond_to(:valid?) }
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#value' do
|
124
|
+
subject { instance.value }
|
125
|
+
|
126
|
+
context 'when :value is nil' do
|
127
|
+
let(:_value) {}
|
128
|
+
|
129
|
+
it { subject.must_equal(min) }
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'when :value is not nil' do
|
133
|
+
it { subject.must_equal(_value) }
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
end # Point
|
138
|
+
|
139
|
+
end # Vedeu
|
@@ -112,20 +112,12 @@ module Vedeu
|
|
112
112
|
subject.must_equal(["\e[?25h"])
|
113
113
|
end
|
114
114
|
|
115
|
-
it '
|
115
|
+
it 'leaves the cursor hidden in raw mode' do
|
116
116
|
described.raw_mode!
|
117
117
|
subject.must_equal(nil)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
|
122
|
-
describe '.cursor' do
|
123
|
-
subject { described.cursor }
|
124
|
-
|
125
|
-
#it { subject.must_be_instance_of(Array) }
|
126
|
-
#it { subject.must_be_instance_of(Vedeu::Geometries::Position) }
|
127
|
-
end
|
128
|
-
|
129
121
|
describe '.centre' do
|
130
122
|
subject { described.centre }
|
131
123
|
|
@@ -161,50 +153,17 @@ module Vedeu
|
|
161
153
|
|
162
154
|
it { subject.must_be_instance_of(Fixnum) }
|
163
155
|
it { subject.must_equal(1) }
|
164
|
-
it { described.must_respond_to(:x) }
|
165
|
-
it { described.must_respond_to(:y) }
|
166
156
|
it { described.must_respond_to(:tx) }
|
167
157
|
it { described.must_respond_to(:ty) }
|
168
158
|
end
|
169
159
|
|
170
|
-
describe '.width' do
|
171
|
-
subject { Vedeu::Terminal.width }
|
172
|
-
|
173
|
-
it { subject.must_be_instance_of(Fixnum) }
|
174
|
-
it { described.must_respond_to(:xn) }
|
175
|
-
it { described.must_respond_to(:txn) }
|
176
|
-
|
177
|
-
context 'when the terminal is an odd number of characters in width' do
|
178
|
-
it 'returns the width' do
|
179
|
-
subject.must_equal(40)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
describe '.height' do
|
185
|
-
subject { Vedeu::Terminal.height }
|
186
|
-
|
187
|
-
it { subject.must_be_instance_of(Fixnum) }
|
188
|
-
it { described.must_respond_to(:yn) }
|
189
|
-
it { described.must_respond_to(:tyn) }
|
190
|
-
|
191
|
-
context 'when the terminal is an odd number of characters in height' do
|
192
|
-
it 'returns the height' do
|
193
|
-
subject.must_equal(24)
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
160
|
describe '.size' do
|
199
161
|
subject { Vedeu::Terminal.size }
|
200
162
|
|
201
163
|
it { subject.must_be_instance_of(Array) }
|
202
164
|
|
203
|
-
|
204
|
-
|
205
|
-
it 'returns the width and height' do
|
206
|
-
subject.must_equal([24, 40])
|
207
|
-
end
|
165
|
+
it 'returns the width and height' do
|
166
|
+
subject.must_equal([25, 40])
|
208
167
|
end
|
209
168
|
end
|
210
169
|
|
@@ -44,10 +44,6 @@ module Vedeu
|
|
44
44
|
it { instance.instance_variable_get('@value').must_equal(_value) }
|
45
45
|
end
|
46
46
|
|
47
|
-
describe '#attributes' do
|
48
|
-
it { instance.must_respond_to(:attributes) }
|
49
|
-
end
|
50
|
-
|
51
47
|
describe '#parent' do
|
52
48
|
it { instance.must_respond_to(:parent) }
|
53
49
|
end
|
@@ -72,6 +68,30 @@ module Vedeu
|
|
72
68
|
it { instance.must_respond_to(:<<) }
|
73
69
|
end
|
74
70
|
|
71
|
+
describe '#attributes' do
|
72
|
+
subject { instance.attributes }
|
73
|
+
|
74
|
+
it { subject.must_be_instance_of(Hash) }
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '#update_buffers' do
|
78
|
+
let(:refresh) {}
|
79
|
+
|
80
|
+
before { Vedeu.stubs(:trigger) }
|
81
|
+
|
82
|
+
subject { instance.update_buffers(refresh) }
|
83
|
+
|
84
|
+
it { subject.must_be_instance_of(described) }
|
85
|
+
|
86
|
+
context 'when the instance has views defined' do
|
87
|
+
# @todo Add more tests.
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'when the instance has no views defined' do
|
91
|
+
# @todo Add more tests.
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
75
95
|
end # Composition
|
76
96
|
|
77
97
|
end # Views
|