vedeu 0.6.12 → 0.6.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/bindings/application.rb +4 -0
- data/lib/vedeu/bindings/document.rb +4 -0
- data/lib/vedeu/bindings/focus.rb +4 -0
- data/lib/vedeu/bindings/menus.rb +4 -0
- data/lib/vedeu/bindings/movement.rb +4 -0
- data/lib/vedeu/bindings/refresh.rb +4 -0
- data/lib/vedeu/bindings/system.rb +4 -0
- data/lib/vedeu/bindings/visibility.rb +4 -0
- data/lib/vedeu/borders/dsl.rb +2 -3
- data/lib/vedeu/configuration/api.rb +26 -0
- data/lib/vedeu/configuration/configuration.rb +16 -0
- data/lib/vedeu/dsl/composition.rb +2 -3
- data/lib/vedeu/dsl/group.rb +2 -3
- data/lib/vedeu/dsl/interface.rb +2 -4
- data/lib/vedeu/dsl/keymap.rb +24 -21
- data/lib/vedeu/dsl/line.rb +4 -6
- data/lib/vedeu/dsl/presentation.rb +16 -12
- data/lib/vedeu/dsl/shared.rb +18 -14
- data/lib/vedeu/dsl/stream.rb +2 -3
- data/lib/vedeu/dsl/text.rb +6 -4
- data/lib/vedeu/dsl/view.rb +6 -8
- data/lib/vedeu/error.rb +12 -0
- data/lib/vedeu/geometry/area.rb +4 -2
- data/lib/vedeu/geometry/coordinate.rb +4 -4
- data/lib/vedeu/geometry/dimension.rb +6 -4
- data/lib/vedeu/geometry/dsl.rb +55 -43
- data/lib/vedeu/geometry/generic_coordinate.rb +4 -3
- data/lib/vedeu/geometry/geometry.rb +13 -11
- data/lib/vedeu/geometry/grid.rb +6 -5
- data/lib/vedeu/geometry/position.rb +12 -10
- data/lib/vedeu/input/key.rb +2 -3
- data/lib/vedeu/logging/log.rb +1 -1
- data/lib/vedeu/menus/menu.rb +2 -3
- data/lib/vedeu/models/views/view.rb +0 -2
- data/lib/vedeu/output/output.rb +10 -1
- data/lib/vedeu/output/renderers/file.rb +3 -3
- data/lib/vedeu/output/renderers/json.rb +2 -0
- data/lib/vedeu/runtime/main_loop.rb +4 -0
- data/lib/vedeu/templating/helpers.rb +4 -7
- data/lib/vedeu/terminal/buffer.rb +1 -2
- data/lib/vedeu/terminal/terminal.rb +4 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/api/external_test.rb +14 -2
- data/test/lib/vedeu/bindings/visibility_test.rb +15 -0
- data/test/lib/vedeu/dsl/composition_test.rb +1 -1
- data/test/lib/vedeu/dsl/group_test.rb +1 -1
- data/test/lib/vedeu/dsl/interface_test.rb +3 -3
- data/test/lib/vedeu/dsl/line_test.rb +2 -2
- data/test/lib/vedeu/dsl/stream_test.rb +1 -1
- data/test/lib/vedeu/dsl/view_test.rb +3 -3
- data/test/lib/vedeu/error_test.rb +13 -0
- data/test/lib/vedeu/input/key_test.rb +1 -1
- data/test/lib/vedeu/menus/menu_test.rb +1 -1
- data/test/lib/vedeu/models/interface_test.rb +26 -0
- data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +7 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +7 -0
- data/test/lib/vedeu/output/renderers/html_test.rb +7 -0
- data/test/lib/vedeu/output/renderers/json_test.rb +7 -0
- data/test/lib/vedeu/output/renderers/null_test.rb +7 -0
- data/test/lib/vedeu/output/renderers/terminal_test.rb +11 -0
- data/test/lib/vedeu/output/renderers/text_test.rb +7 -0
- data/test/lib/vedeu/terminal/buffer_test.rb +31 -12
- data/test/lib/vedeu/terminal/terminal_test.rb +24 -21
- data/test/support/examples/material_colours_app.rb +2 -0
- data/test/test_helper.rb +2 -2
- metadata +2 -2
@@ -26,7 +26,7 @@ module Vedeu
|
|
26
26
|
context 'when the block is not given' do
|
27
27
|
subject { described.renders }
|
28
28
|
|
29
|
-
it { proc { subject }.must_raise(Vedeu::Error::
|
29
|
+
it { proc { subject }.must_raise(Vedeu::Error::RequiresBlock) }
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'when the block is given' do
|
@@ -46,7 +46,7 @@ module Vedeu
|
|
46
46
|
context 'when the block is not given' do
|
47
47
|
subject { described.views }
|
48
48
|
|
49
|
-
it { proc { subject }.must_raise(Vedeu::Error::
|
49
|
+
it { proc { subject }.must_raise(Vedeu::Error::RequiresBlock) }
|
50
50
|
end
|
51
51
|
|
52
52
|
context 'when the block is given' do
|
@@ -66,7 +66,7 @@ module Vedeu
|
|
66
66
|
context 'when the required block is not provided' do
|
67
67
|
subject { instance.lines }
|
68
68
|
|
69
|
-
it { proc { subject }.must_raise(Vedeu::Error::
|
69
|
+
it { proc { subject }.must_raise(Vedeu::Error::RequiresBlock) }
|
70
70
|
end
|
71
71
|
|
72
72
|
it { instance.must_respond_to(:line) }
|
@@ -17,6 +17,19 @@ module Vedeu
|
|
17
17
|
|
18
18
|
end # OutOfRange
|
19
19
|
|
20
|
+
describe RequiresBlock do
|
21
|
+
|
22
|
+
let(:described) { Vedeu::Error::RequiresBlock }
|
23
|
+
let(:instance) { described.new }
|
24
|
+
|
25
|
+
describe '#message' do
|
26
|
+
subject { instance.message }
|
27
|
+
|
28
|
+
it { subject.must_be_instance_of(String) }
|
29
|
+
end
|
30
|
+
|
31
|
+
end # RequiresBlock
|
32
|
+
|
20
33
|
end # Error
|
21
34
|
|
22
35
|
end # Vedeu
|
@@ -93,6 +93,32 @@ module Vedeu
|
|
93
93
|
}
|
94
94
|
end
|
95
95
|
|
96
|
+
describe '#toggle' do
|
97
|
+
let(:buffer) { Vedeu::Buffers::Buffer.new }
|
98
|
+
|
99
|
+
before { Vedeu.buffers.stubs(:by_name).returns(buffer) }
|
100
|
+
|
101
|
+
subject { instance.toggle }
|
102
|
+
|
103
|
+
context 'when the interface is not visible' do
|
104
|
+
let(:visible) { false }
|
105
|
+
|
106
|
+
it {
|
107
|
+
Vedeu.buffers.by_name('hydrogen').expects(:show)
|
108
|
+
subject
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'when the interface is visible' do
|
113
|
+
let(:visible) { true }
|
114
|
+
|
115
|
+
it {
|
116
|
+
Vedeu.buffers.by_name('hydrogen').expects(:hide)
|
117
|
+
subject
|
118
|
+
}
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
96
122
|
end # Interface
|
97
123
|
|
98
124
|
end # Models
|
@@ -16,6 +16,13 @@ module Vedeu
|
|
16
16
|
it { instance.instance_variable_get('@options').must_equal(options) }
|
17
17
|
end
|
18
18
|
|
19
|
+
describe '#clear' do
|
20
|
+
subject { instance.clear }
|
21
|
+
|
22
|
+
it { subject.must_be_instance_of(String) }
|
23
|
+
it { subject.must_equal('') }
|
24
|
+
end
|
25
|
+
|
19
26
|
describe '#render' do
|
20
27
|
subject { instance.render(output) }
|
21
28
|
|
@@ -23,6 +23,13 @@ module Vedeu
|
|
23
23
|
it { instance.instance_variable_get('@options').must_equal(options) }
|
24
24
|
end
|
25
25
|
|
26
|
+
describe '#clear' do
|
27
|
+
subject { instance.clear }
|
28
|
+
|
29
|
+
it { subject.must_be_instance_of(String) }
|
30
|
+
it { subject.must_equal('') }
|
31
|
+
end
|
32
|
+
|
26
33
|
describe '#render' do
|
27
34
|
let(:_time) { Time.new(2015, 4, 12, 20, 05, 00, "+01:00") }
|
28
35
|
|
@@ -47,6 +47,13 @@ module Vedeu
|
|
47
47
|
it { instance.instance_variable_get('@output').must_equal(nil) }
|
48
48
|
end
|
49
49
|
|
50
|
+
describe '#clear' do
|
51
|
+
subject { instance.clear }
|
52
|
+
|
53
|
+
it { subject.must_be_instance_of(String) }
|
54
|
+
it { subject.must_equal('') }
|
55
|
+
end
|
56
|
+
|
50
57
|
describe '#render' do
|
51
58
|
let(:output) {
|
52
59
|
Vedeu::Models::Page.coerce([
|
@@ -23,6 +23,13 @@ module Vedeu
|
|
23
23
|
it { instance.instance_variable_get('@options').must_equal(options) }
|
24
24
|
end
|
25
25
|
|
26
|
+
describe '#clear' do
|
27
|
+
subject { instance.clear }
|
28
|
+
|
29
|
+
it { subject.must_be_instance_of(String) }
|
30
|
+
it { subject.must_equal("{\n}") }
|
31
|
+
end
|
32
|
+
|
26
33
|
describe '#render' do
|
27
34
|
let(:output) {
|
28
35
|
Vedeu::Models::Page.coerce([
|
@@ -16,6 +16,13 @@ module Vedeu
|
|
16
16
|
it { instance.instance_variable_get('@options').must_equal(options) }
|
17
17
|
end
|
18
18
|
|
19
|
+
describe '#clear' do
|
20
|
+
subject { instance.clear }
|
21
|
+
|
22
|
+
it { subject.must_be_instance_of(String) }
|
23
|
+
it { subject.must_equal('') }
|
24
|
+
end
|
25
|
+
|
19
26
|
describe '#render' do
|
20
27
|
subject { instance.render(output) }
|
21
28
|
|
@@ -36,6 +36,17 @@ module Vedeu
|
|
36
36
|
it { instance.instance_variable_get('@options').must_equal(options) }
|
37
37
|
end
|
38
38
|
|
39
|
+
describe '#clear' do
|
40
|
+
before { Vedeu::Terminal.stubs(:clear) }
|
41
|
+
|
42
|
+
subject { instance.clear }
|
43
|
+
|
44
|
+
it {
|
45
|
+
Vedeu::Terminal.expects(:clear)
|
46
|
+
subject
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
39
50
|
describe '#render' do
|
40
51
|
subject { instance.render(output) }
|
41
52
|
|
@@ -16,6 +16,13 @@ module Vedeu
|
|
16
16
|
it { instance.instance_variable_get('@options').must_equal(options) }
|
17
17
|
end
|
18
18
|
|
19
|
+
describe '#clear' do
|
20
|
+
subject { instance.clear }
|
21
|
+
|
22
|
+
it { subject.must_be_instance_of(String) }
|
23
|
+
it { subject.must_equal('') }
|
24
|
+
end
|
25
|
+
|
19
26
|
describe '#render' do
|
20
27
|
subject { instance.render(output) }
|
21
28
|
|
@@ -32,6 +32,29 @@ module Vedeu
|
|
32
32
|
it { subject.must_equal(expected) }
|
33
33
|
end
|
34
34
|
|
35
|
+
describe '#clear' do
|
36
|
+
let(:ready) { false }
|
37
|
+
|
38
|
+
before do
|
39
|
+
Vedeu.stubs(:ready?).returns(ready)
|
40
|
+
Vedeu.renderers.stubs(:clear)
|
41
|
+
end
|
42
|
+
|
43
|
+
subject { described.clear }
|
44
|
+
|
45
|
+
context 'when Vedeu is ready' do
|
46
|
+
let(:ready) { true }
|
47
|
+
|
48
|
+
it {
|
49
|
+
Vedeu.renderers.expects(:clear)
|
50
|
+
subject
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when Vedeu is not ready' do
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
35
58
|
describe '#empty_buffer' do
|
36
59
|
let(:expected) {
|
37
60
|
Array.new(height) do |y|
|
@@ -75,7 +98,10 @@ module Vedeu
|
|
75
98
|
describe '#render' do
|
76
99
|
let(:ready) { false }
|
77
100
|
|
78
|
-
before
|
101
|
+
before do
|
102
|
+
Vedeu.stubs(:ready?).returns(ready)
|
103
|
+
Vedeu.renderers.stubs(:render)
|
104
|
+
end
|
79
105
|
|
80
106
|
subject { described.render }
|
81
107
|
|
@@ -86,15 +112,10 @@ module Vedeu
|
|
86
112
|
context 'when Vedeu is ready' do
|
87
113
|
let(:ready) { true }
|
88
114
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
# }
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'when the buffer is not empty' do
|
97
|
-
end
|
115
|
+
it {
|
116
|
+
Vedeu.renderers.expects(:render)
|
117
|
+
subject
|
118
|
+
}
|
98
119
|
end
|
99
120
|
end
|
100
121
|
|
@@ -112,8 +133,6 @@ module Vedeu
|
|
112
133
|
it { described.instance_variable_get('@output').must_equal(output) }
|
113
134
|
it { subject.must_be_instance_of(Array) }
|
114
135
|
it { subject.must_equal(output) }
|
115
|
-
|
116
|
-
it { described.must_respond_to(:clear) }
|
117
136
|
end
|
118
137
|
|
119
138
|
describe '#write' do
|
@@ -8,14 +8,14 @@ module Vedeu
|
|
8
8
|
let(:console) { IO.console }
|
9
9
|
|
10
10
|
before do
|
11
|
-
console.stubs(:winsize).returns([25,
|
11
|
+
console.stubs(:winsize).returns([25, 40])
|
12
12
|
console.stubs(:print)
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '.open' do
|
16
16
|
context 'when a block was not given' do
|
17
17
|
it {
|
18
|
-
proc { Vedeu::Terminal.open }.must_raise(Vedeu::Error::
|
18
|
+
proc { Vedeu::Terminal.open }.must_raise(Vedeu::Error::RequiresBlock)
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
@@ -95,8 +95,20 @@ module Vedeu
|
|
95
95
|
end
|
96
96
|
|
97
97
|
describe '.resize' do
|
98
|
+
before { Vedeu.stubs(:trigger) }
|
99
|
+
|
98
100
|
subject { described.resize }
|
99
101
|
|
102
|
+
it {
|
103
|
+
Vedeu.expects(:trigger).with(:_clear_)
|
104
|
+
subject
|
105
|
+
}
|
106
|
+
|
107
|
+
it {
|
108
|
+
Vedeu.expects(:trigger).with(:_refresh_)
|
109
|
+
subject
|
110
|
+
}
|
111
|
+
|
100
112
|
it { subject.must_be_instance_of(TrueClass) }
|
101
113
|
end
|
102
114
|
|
@@ -136,7 +148,7 @@ module Vedeu
|
|
136
148
|
it { subject.must_be_instance_of(Array) }
|
137
149
|
|
138
150
|
it 'returns the centre point on the terminal' do
|
139
|
-
subject.must_equal([12,
|
151
|
+
subject.must_equal([12, 20])
|
140
152
|
end
|
141
153
|
end
|
142
154
|
|
@@ -156,7 +168,7 @@ module Vedeu
|
|
156
168
|
it { subject.must_be_instance_of(Fixnum) }
|
157
169
|
|
158
170
|
it 'returns the centre `x` point on the terminal' do
|
159
|
-
subject.must_equal(
|
171
|
+
subject.must_equal(20)
|
160
172
|
end
|
161
173
|
end
|
162
174
|
|
@@ -178,15 +190,9 @@ module Vedeu
|
|
178
190
|
it { described.must_respond_to(:xn) }
|
179
191
|
it { described.must_respond_to(:txn) }
|
180
192
|
|
181
|
-
context '
|
182
|
-
it 'returns the width' do
|
183
|
-
subject.must_equal(80)
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
context 'via API' do
|
193
|
+
context 'when the terminal is an odd number of characters in width' do
|
188
194
|
it 'returns the width' do
|
189
|
-
|
195
|
+
subject.must_equal(40)
|
190
196
|
end
|
191
197
|
end
|
192
198
|
end
|
@@ -198,17 +204,11 @@ module Vedeu
|
|
198
204
|
it { described.must_respond_to(:yn) }
|
199
205
|
it { described.must_respond_to(:tyn) }
|
200
206
|
|
201
|
-
context '
|
207
|
+
context 'when the terminal is an odd number of characters in height' do
|
202
208
|
it 'returns the height' do
|
203
209
|
subject.must_equal(24)
|
204
210
|
end
|
205
211
|
end
|
206
|
-
|
207
|
-
context 'via API' do
|
208
|
-
it 'returns the height' do
|
209
|
-
Vedeu.height.must_equal(24)
|
210
|
-
end
|
211
|
-
end
|
212
212
|
end
|
213
213
|
|
214
214
|
describe '.size' do
|
@@ -216,8 +216,11 @@ module Vedeu
|
|
216
216
|
|
217
217
|
it { subject.must_be_instance_of(Array) }
|
218
218
|
|
219
|
-
|
220
|
-
|
219
|
+
context 'when the terminal is an odd number of characters in height or ' \
|
220
|
+
'width' do
|
221
|
+
it 'returns the width and height' do
|
222
|
+
subject.must_equal([24, 40])
|
223
|
+
end
|
221
224
|
end
|
222
225
|
end
|
223
226
|
|
data/test/test_helper.rb
CHANGED
@@ -94,8 +94,8 @@ require 'support/helpers/model_test_class'
|
|
94
94
|
# Minitest::Reporters.use!(
|
95
95
|
# # # commented out by default (makes tests slower)
|
96
96
|
# # Minitest::Reporters::MeanTimeReporter.new({
|
97
|
-
# # previous_runs_filename: "/tmp/
|
98
|
-
# # report_filename: "/tmp/
|
97
|
+
# # previous_runs_filename: "/tmp/durations",
|
98
|
+
# # report_filename: "/tmp/durations_results"})
|
99
99
|
# # Minitest::Reporters::DefaultReporter.new({ color: true,
|
100
100
|
# # slow_suite_count: 15 }),
|
101
101
|
# # Minitest::Reporters::SpecReporter.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vedeu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|