vedeu 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/dsl.md +3 -3
- data/examples/borders_app.rb +2 -0
- data/examples/colours_app.rb +2 -0
- data/examples/configuration_app.rb +2 -0
- data/examples/drb_app.rb +2 -0
- data/examples/focus_app.rb +2 -0
- data/examples/hello_world.rb +2 -0
- data/examples/material_colours_app.rb +2 -0
- data/lib/vedeu.rb +2 -0
- data/lib/vedeu/all.rb +4 -13
- data/lib/vedeu/api.rb +7 -6
- data/lib/vedeu/borders/border.rb +1 -1
- data/lib/vedeu/borders/render_border.rb +18 -18
- data/lib/vedeu/buffers/buffer.rb +18 -28
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/colours/colour_translator.rb +1 -1
- data/lib/vedeu/cursor/cursor.rb +9 -6
- data/lib/vedeu/dsl/border.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +5 -5
- data/lib/vedeu/dsl/geometry.rb +1 -1
- data/lib/vedeu/dsl/group.rb +1 -1
- data/lib/vedeu/dsl/interface.rb +69 -93
- data/lib/vedeu/dsl/keymap.rb +1 -1
- data/lib/vedeu/dsl/line.rb +11 -11
- data/lib/vedeu/dsl/shared.rb +81 -0
- data/lib/vedeu/dsl/stream.rb +3 -3
- data/lib/vedeu/dsl/view.rb +76 -64
- data/lib/vedeu/models/escape.rb +1 -1
- data/lib/vedeu/models/interface.rb +3 -57
- data/lib/vedeu/models/menu.rb +1 -1
- data/lib/vedeu/models/views/all.rb +22 -0
- data/lib/vedeu/models/views/char.rb +175 -0
- data/lib/vedeu/models/views/chars.rb +13 -0
- data/lib/vedeu/models/views/composition.rb +73 -0
- data/lib/vedeu/models/views/line.rb +111 -0
- data/lib/vedeu/models/views/lines.rb +13 -0
- data/lib/vedeu/models/views/stream.rb +122 -0
- data/lib/vedeu/models/views/streams.rb +13 -0
- data/lib/vedeu/models/views/view.rb +157 -0
- data/lib/vedeu/models/views/view_collection.rb +13 -0
- data/lib/vedeu/null/view.rb +67 -0
- data/lib/vedeu/output/clear/named_interface.rb +4 -4
- data/lib/vedeu/output/compressor.rb +6 -6
- data/lib/vedeu/output/html_char.rb +6 -6
- data/lib/vedeu/output/output.rb +3 -3
- data/lib/vedeu/output/presentation.rb +1 -1
- data/lib/vedeu/output/renderers/escape_sequence.rb +1 -1
- data/lib/vedeu/output/renderers/file.rb +1 -1
- data/lib/vedeu/output/renderers/html.rb +3 -3
- data/lib/vedeu/output/renderers/json.rb +4 -4
- data/lib/vedeu/output/renderers/null.rb +1 -1
- data/lib/vedeu/output/renderers/terminal.rb +5 -5
- data/lib/vedeu/output/renderers/text.rb +3 -3
- data/lib/vedeu/output/style.rb +1 -1
- data/lib/vedeu/output/text.rb +20 -15
- data/lib/vedeu/output/viewport.rb +16 -23
- data/lib/vedeu/output/virtual_buffer.rb +9 -8
- data/lib/vedeu/output/virtual_terminal.rb +11 -11
- data/lib/vedeu/output/wordwrap.rb +5 -5
- data/lib/vedeu/runtime/application.rb +1 -1
- data/lib/vedeu/runtime/main_loop.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +11 -10
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/templating/view_template.rb +6 -6
- data/lib/vedeu/version.rb +1 -2
- data/test/lib/vedeu/api_test.rb +30 -30
- data/test/lib/vedeu/buffers/buffer_test.rb +5 -139
- data/test/lib/vedeu/colours/colour_translator_test.rb +3 -3
- data/test/lib/vedeu/configuration/api_test.rb +3 -3
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +7 -7
- data/test/lib/vedeu/dsl/group_test.rb +2 -2
- data/test/lib/vedeu/dsl/interface_test.rb +31 -21
- data/test/lib/vedeu/dsl/keymap_test.rb +4 -4
- data/test/lib/vedeu/dsl/line_test.rb +8 -8
- data/test/lib/vedeu/dsl/stream_test.rb +4 -4
- data/test/lib/vedeu/dsl/text_test.rb +11 -11
- data/test/lib/vedeu/dsl/view_test.rb +24 -29
- data/test/lib/vedeu/geometry/grid_test.rb +4 -4
- data/test/lib/vedeu/input/key_test.rb +1 -1
- data/test/lib/vedeu/internal_api_test.rb +18 -18
- data/test/lib/vedeu/models/focus_test.rb +54 -54
- data/test/lib/vedeu/models/interface_test.rb +11 -105
- data/test/lib/vedeu/models/menu_test.rb +1 -1
- data/test/lib/vedeu/models/views/char_test.rb +257 -0
- data/test/lib/vedeu/models/views/chars_test.rb +22 -0
- data/test/lib/vedeu/models/views/composition_test.rb +61 -0
- data/test/lib/vedeu/models/views/line_test.rb +189 -0
- data/test/lib/vedeu/models/views/lines_test.rb +22 -0
- data/test/lib/vedeu/models/views/stream_test.rb +138 -0
- data/test/lib/vedeu/models/views/streams_test.rb +22 -0
- data/test/lib/vedeu/models/views/view_test.rb +40 -0
- data/test/lib/vedeu/null/view_test.rb +12 -0
- data/test/lib/vedeu/output/clear/named_interface_test.rb +4 -4
- data/test/lib/vedeu/output/compressor_test.rb +28 -28
- data/test/lib/vedeu/output/html_char_test.rb +2 -2
- data/test/lib/vedeu/output/presentation_test.rb +10 -14
- data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +20 -4
- data/test/lib/vedeu/output/renderers/html_test.rb +4 -4
- data/test/lib/vedeu/output/renderers/json_test.rb +3 -3
- data/test/lib/vedeu/output/text_test.rb +10 -10
- data/test/lib/vedeu/output/viewport_test.rb +21 -23
- data/test/lib/vedeu/output/virtual_buffer_test.rb +1 -1
- data/test/lib/vedeu/output/virtual_terminal_test.rb +1 -1
- data/test/lib/vedeu/output/wordwrap_test.rb +9 -9
- data/test/lib/vedeu/repositories/repository_test.rb +2 -2
- data/test/lib/vedeu/templating/helpers_test.rb +6 -39
- data/test/lib/vedeu/templating/template_test.rb +2 -2
- data/test/lib/vedeu/templating/view_template_test.rb +91 -91
- data/test/lib/vedeu/terminal_test.rb +1 -1
- metadata +33 -27
- data/lib/vedeu/buffers/display_buffer.rb +0 -39
- data/lib/vedeu/models/char.rb +0 -170
- data/lib/vedeu/models/chars.rb +0 -9
- data/lib/vedeu/models/composition.rb +0 -66
- data/lib/vedeu/models/line.rb +0 -112
- data/lib/vedeu/models/lines.rb +0 -9
- data/lib/vedeu/models/stream.rb +0 -122
- data/lib/vedeu/models/streams.rb +0 -9
- data/test/lib/vedeu/buffers/display_buffer_test.rb +0 -61
- data/test/lib/vedeu/models/char_test.rb +0 -253
- data/test/lib/vedeu/models/chars_test.rb +0 -18
- data/test/lib/vedeu/models/composition_test.rb +0 -57
- data/test/lib/vedeu/models/line_test.rb +0 -189
- data/test/lib/vedeu/models/lines_test.rb +0 -18
- data/test/lib/vedeu/models/stream_test.rb +0 -141
- data/test/lib/vedeu/models/streams_test.rb +0 -18
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Views
|
6
|
+
|
7
|
+
describe Lines do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Views::Lines }
|
10
|
+
let(:instance) { described.new }
|
11
|
+
|
12
|
+
it { described.superclass.must_equal(Vedeu::Collection) }
|
13
|
+
|
14
|
+
describe '#initialize' do
|
15
|
+
it { instance.must_be_instance_of(described) }
|
16
|
+
end
|
17
|
+
|
18
|
+
end # Lines
|
19
|
+
|
20
|
+
end # Views
|
21
|
+
|
22
|
+
end # Vedeu
|
@@ -0,0 +1,138 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Views
|
6
|
+
|
7
|
+
describe Stream do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Views::Stream }
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes) {
|
12
|
+
{
|
13
|
+
value: _value,
|
14
|
+
parent: parent,
|
15
|
+
colour: colour,
|
16
|
+
style: style
|
17
|
+
}
|
18
|
+
}
|
19
|
+
let(:_value) { 'Some text' }
|
20
|
+
let(:parent) {
|
21
|
+
Vedeu::Views::Line.new(streams: [],
|
22
|
+
parent: line_parent,
|
23
|
+
colour: parent_colour,
|
24
|
+
style: style)
|
25
|
+
}
|
26
|
+
let(:parent_colour) {
|
27
|
+
Vedeu::Colour.new(background: '#0000ff', foreground: '#ffff00')
|
28
|
+
}
|
29
|
+
let(:colour) {
|
30
|
+
Vedeu::Colour.new(background: '#ff0000', foreground: '#000000')
|
31
|
+
}
|
32
|
+
let(:style) { Vedeu::Style.new('normal') }
|
33
|
+
let(:line_parent) { Vedeu::Views::View.new(name: 'Vedeu::Views::Stream') }
|
34
|
+
|
35
|
+
describe '#initialize' do
|
36
|
+
it { instance.must_be_instance_of(described) }
|
37
|
+
it { instance.instance_variable_get('@value').must_equal(_value) }
|
38
|
+
it { instance.instance_variable_get('@parent').must_equal(parent) }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'accessors' do
|
42
|
+
it { instance.must_respond_to(:parent) }
|
43
|
+
it { instance.must_respond_to(:parent=) }
|
44
|
+
it { instance.must_respond_to(:value) }
|
45
|
+
it { instance.must_respond_to(:content) }
|
46
|
+
it { instance.must_respond_to(:data) }
|
47
|
+
it { instance.must_respond_to(:text) }
|
48
|
+
it { instance.must_respond_to(:value=) }
|
49
|
+
it { instance.must_respond_to(:attributes) }
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#add' do
|
53
|
+
let(:child) { instance }
|
54
|
+
|
55
|
+
subject { instance.add(child) }
|
56
|
+
|
57
|
+
it { subject.must_be_instance_of(Vedeu::Views::Streams) }
|
58
|
+
|
59
|
+
it { instance.must_respond_to(:<<) }
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#chars' do
|
63
|
+
subject { instance.chars }
|
64
|
+
|
65
|
+
it { subject.must_be_instance_of(Array) }
|
66
|
+
|
67
|
+
context 'when there is content' do
|
68
|
+
it { subject.size.must_equal(9) }
|
69
|
+
end
|
70
|
+
|
71
|
+
context 'when there is no content' do
|
72
|
+
let(:_value) { '' }
|
73
|
+
|
74
|
+
it 'returns an empty collection' do
|
75
|
+
subject.must_equal([])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#empty?' do
|
81
|
+
subject { instance.empty? }
|
82
|
+
|
83
|
+
context 'when there is no content' do
|
84
|
+
let(:_value) { '' }
|
85
|
+
|
86
|
+
it { subject.must_equal(true) }
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when there is content' do
|
90
|
+
it { subject.must_equal(false) }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#eql?' do
|
95
|
+
let(:other) { described.new(attributes) }
|
96
|
+
|
97
|
+
subject { instance.eql?(other) }
|
98
|
+
|
99
|
+
it { subject.must_equal(true) }
|
100
|
+
|
101
|
+
context 'when different to other' do
|
102
|
+
let(:other) {
|
103
|
+
described.new(colour: Vedeu::Colour.coerce(background: '#ff0000'))
|
104
|
+
}
|
105
|
+
|
106
|
+
it { subject.must_equal(false) }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#name' do
|
111
|
+
subject { instance.name }
|
112
|
+
|
113
|
+
context 'when a parent is defined' do
|
114
|
+
it { subject.must_be_instance_of(String) }
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'when a parent is not defined' do
|
118
|
+
before { instance.stubs(:parent) }
|
119
|
+
|
120
|
+
it { subject.must_be_instance_of(NilClass) }
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe '#size' do
|
125
|
+
subject { instance.size }
|
126
|
+
|
127
|
+
it { subject.must_be_instance_of(Fixnum) }
|
128
|
+
|
129
|
+
it 'returns the size of the stream' do
|
130
|
+
subject.must_equal(9)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
end # Stream
|
135
|
+
|
136
|
+
end # Views
|
137
|
+
|
138
|
+
end # Vedeu
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Views
|
6
|
+
|
7
|
+
describe Streams do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Views::Streams }
|
10
|
+
let(:instance) { described.new }
|
11
|
+
|
12
|
+
it { described.superclass.must_equal(Vedeu::Collection) }
|
13
|
+
|
14
|
+
describe '#initialize' do
|
15
|
+
it { instance.must_be_instance_of(described) }
|
16
|
+
end
|
17
|
+
|
18
|
+
end # Streams
|
19
|
+
|
20
|
+
end # Views
|
21
|
+
|
22
|
+
end # Vedeu
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Views
|
6
|
+
|
7
|
+
describe View do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Views::View }
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes) {
|
12
|
+
{
|
13
|
+
name: _name,
|
14
|
+
}
|
15
|
+
}
|
16
|
+
let(:_name) { 'Vedeu::Views::View' }
|
17
|
+
|
18
|
+
describe '#store_immediate' do
|
19
|
+
subject { instance.store_immediate }
|
20
|
+
|
21
|
+
it { subject.must_be_instance_of(described) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#store_deferred' do
|
25
|
+
subject { instance.store_deferred }
|
26
|
+
|
27
|
+
it { subject.must_be_instance_of(described) }
|
28
|
+
|
29
|
+
context 'when the name is not defined' do
|
30
|
+
let(:_name) {}
|
31
|
+
|
32
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end # View
|
37
|
+
|
38
|
+
end # Views
|
39
|
+
|
40
|
+
end # Vedeu
|
@@ -38,12 +38,12 @@ module Vedeu
|
|
38
38
|
let(:output) {
|
39
39
|
[
|
40
40
|
[
|
41
|
-
Vedeu::Char.new(value: ' ', position: [1, 1]),
|
42
|
-
Vedeu::Char.new(value: ' ', position: [1, 2]),
|
41
|
+
Vedeu::Views::Char.new(value: ' ', position: [1, 1]),
|
42
|
+
Vedeu::Views::Char.new(value: ' ', position: [1, 2]),
|
43
43
|
|
44
44
|
], [
|
45
|
-
Vedeu::Char.new(value: ' ', position: [2, 1]),
|
46
|
-
Vedeu::Char.new(value: ' ', position: [2, 2]),
|
45
|
+
Vedeu::Views::Char.new(value: ' ', position: [2, 1]),
|
46
|
+
Vedeu::Views::Char.new(value: ' ', position: [2, 2]),
|
47
47
|
|
48
48
|
]
|
49
49
|
]
|
@@ -23,26 +23,26 @@ module Vedeu
|
|
23
23
|
context 'when compression is enabled' do
|
24
24
|
before { Vedeu.configure { compression(true) } }
|
25
25
|
|
26
|
-
context 'when the output is all Vedeu::Char elements' do
|
26
|
+
context 'when the output is all Vedeu::Views::Char elements' do
|
27
27
|
let(:output) {
|
28
28
|
[
|
29
|
-
Vedeu::Char.new(value: 'Y', colour: { foreground: '#ff0000' }),
|
30
|
-
Vedeu::Char.new(value: 'e', colour: { foreground: '#ff0000' }),
|
31
|
-
Vedeu::Char.new(value: 's', colour: { foreground: '#ff0000' }),
|
29
|
+
Vedeu::Views::Char.new(value: 'Y', colour: { foreground: '#ff0000' }),
|
30
|
+
Vedeu::Views::Char.new(value: 'e', colour: { foreground: '#ff0000' }),
|
31
|
+
Vedeu::Views::Char.new(value: 's', colour: { foreground: '#ff0000' }),
|
32
32
|
]
|
33
33
|
}
|
34
|
-
it 'converts the non-Vedeu::Char elements into String elements' do
|
34
|
+
it 'converts the non-Vedeu::Views::Char elements into String elements' do
|
35
35
|
subject.must_equal("\e[38;2;255;0;0mYes")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
context 'when the output is all Vedeu::Char elements' do
|
39
|
+
context 'when the output is all Vedeu::Views::Char elements' do
|
40
40
|
let(:output) {
|
41
41
|
[
|
42
|
-
Vedeu::Char.new(value: 'a', colour: { foreground: '#ff0000' }),
|
43
|
-
Vedeu::Char.new(value: 'b', colour: { foreground: '#ff0000' }),
|
44
|
-
Vedeu::Char.new(value: 'c', colour: { foreground: '#0000ff' }),
|
45
|
-
Vedeu::Char.new(value: 'd', colour: { foreground: '#0000ff' }),
|
42
|
+
Vedeu::Views::Char.new(value: 'a', colour: { foreground: '#ff0000' }),
|
43
|
+
Vedeu::Views::Char.new(value: 'b', colour: { foreground: '#ff0000' }),
|
44
|
+
Vedeu::Views::Char.new(value: 'c', colour: { foreground: '#0000ff' }),
|
45
|
+
Vedeu::Views::Char.new(value: 'd', colour: { foreground: '#0000ff' }),
|
46
46
|
]
|
47
47
|
}
|
48
48
|
it 'compresses multiple colours and styles where possible' do
|
@@ -50,15 +50,15 @@ module Vedeu
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
context 'when the output is not all Vedeu::Char elements' do
|
53
|
+
context 'when the output is not all Vedeu::Views::Char elements' do
|
54
54
|
let(:output) {
|
55
55
|
[
|
56
|
-
Vedeu::Char.new(value: 'N'),
|
56
|
+
Vedeu::Views::Char.new(value: 'N'),
|
57
57
|
Vedeu::Escape.new(value: "\e[?25l"),
|
58
|
-
Vedeu::Char.new(value: 't'),
|
58
|
+
Vedeu::Views::Char.new(value: 't'),
|
59
59
|
]
|
60
60
|
}
|
61
|
-
it 'converts the non-Vedeu::Char elements into String elements' do
|
61
|
+
it 'converts the non-Vedeu::Views::Char elements into String elements' do
|
62
62
|
subject.must_equal("N\e[1;1H\e[?25lt")
|
63
63
|
end
|
64
64
|
end
|
@@ -67,28 +67,28 @@ module Vedeu
|
|
67
67
|
context 'when compression is not enabled' do
|
68
68
|
before { Vedeu.configure { compression(false) } }
|
69
69
|
|
70
|
-
context 'when the output is all Vedeu::Char elements' do
|
70
|
+
context 'when the output is all Vedeu::Views::Char elements' do
|
71
71
|
let(:output) {
|
72
72
|
[
|
73
|
-
Vedeu::Char.new(value: 'Y', colour: { foreground: '#ff0000' }),
|
74
|
-
Vedeu::Char.new(value: 'e', colour: { foreground: '#ff0000' }),
|
75
|
-
Vedeu::Char.new(value: 's', colour: { foreground: '#ff0000' }),
|
73
|
+
Vedeu::Views::Char.new(value: 'Y', colour: { foreground: '#ff0000' }),
|
74
|
+
Vedeu::Views::Char.new(value: 'e', colour: { foreground: '#ff0000' }),
|
75
|
+
Vedeu::Views::Char.new(value: 's', colour: { foreground: '#ff0000' }),
|
76
76
|
]
|
77
77
|
}
|
78
|
-
it 'converts the non-Vedeu::Char elements into String elements' do
|
78
|
+
it 'converts the non-Vedeu::Views::Char elements into String elements' do
|
79
79
|
subject.must_equal(
|
80
80
|
"\e[38;2;255;0;0mY\e[38;2;255;0;0me\e[38;2;255;0;0ms"
|
81
81
|
)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
context 'when the output is all Vedeu::Char elements' do
|
85
|
+
context 'when the output is all Vedeu::Views::Char elements' do
|
86
86
|
let(:output) {
|
87
87
|
[
|
88
|
-
Vedeu::Char.new(value: 'a', colour: { foreground: '#ff0000' }),
|
89
|
-
Vedeu::Char.new(value: 'b', colour: { foreground: '#ff0000' }),
|
90
|
-
Vedeu::Char.new(value: 'c', colour: { foreground: '#0000ff' }),
|
91
|
-
Vedeu::Char.new(value: 'd', colour: { foreground: '#0000ff' }),
|
88
|
+
Vedeu::Views::Char.new(value: 'a', colour: { foreground: '#ff0000' }),
|
89
|
+
Vedeu::Views::Char.new(value: 'b', colour: { foreground: '#ff0000' }),
|
90
|
+
Vedeu::Views::Char.new(value: 'c', colour: { foreground: '#0000ff' }),
|
91
|
+
Vedeu::Views::Char.new(value: 'd', colour: { foreground: '#0000ff' }),
|
92
92
|
]
|
93
93
|
}
|
94
94
|
it 'compresses multiple colours and styles where possible' do
|
@@ -98,15 +98,15 @@ module Vedeu
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
context 'when the output is not all Vedeu::Char elements' do
|
101
|
+
context 'when the output is not all Vedeu::Views::Char elements' do
|
102
102
|
let(:output) {
|
103
103
|
[
|
104
|
-
Vedeu::Char.new(value: 'N'),
|
104
|
+
Vedeu::Views::Char.new(value: 'N'),
|
105
105
|
Vedeu::Escape.new(value: "\e[?25l"),
|
106
|
-
Vedeu::Char.new(value: 't'),
|
106
|
+
Vedeu::Views::Char.new(value: 't'),
|
107
107
|
]
|
108
108
|
}
|
109
|
-
it 'converts the non-Vedeu::Char elements into String elements' do
|
109
|
+
it 'converts the non-Vedeu::Views::Char elements into String elements' do
|
110
110
|
subject.must_equal("N\e[1;1H\e[?25lt")
|
111
111
|
end
|
112
112
|
end
|
@@ -6,7 +6,7 @@ module Vedeu
|
|
6
6
|
|
7
7
|
let(:described) { Vedeu::HTMLChar }
|
8
8
|
let(:instance) { described.new(char, options) }
|
9
|
-
let(:char) { Vedeu::Char.new(attributes) }
|
9
|
+
let(:char) { Vedeu::Views::Char.new(attributes) }
|
10
10
|
let(:options) {
|
11
11
|
{
|
12
12
|
start_tag: '<td',
|
@@ -23,7 +23,7 @@ module Vedeu
|
|
23
23
|
}
|
24
24
|
let(:border) {}
|
25
25
|
let(:colour) {}
|
26
|
-
let(:parent) { Vedeu::Line.new(colour: parent_colour) }
|
26
|
+
let(:parent) { Vedeu::Views::Line.new(colour: parent_colour) }
|
27
27
|
let(:parent_colour) {}
|
28
28
|
let(:_value) {}
|
29
29
|
|
@@ -46,24 +46,20 @@ module Vedeu
|
|
46
46
|
|
47
47
|
describe '#to_s' do
|
48
48
|
let(:line) {
|
49
|
-
Vedeu::Line.new(streams: [],
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
let(:line_colour) {
|
55
|
-
Vedeu::Colour.new(foreground: '#00ff00', background: '#000000')
|
49
|
+
Vedeu::Views::Line.new(streams: [],
|
50
|
+
parent: Vedeu::Interface.new,
|
51
|
+
colour: Vedeu::Colour.new(foreground: '#00ff00',
|
52
|
+
background: '#000000'),
|
53
|
+
style: Vedeu::Style.new('normal'))
|
56
54
|
}
|
57
55
|
let(:stream) {
|
58
|
-
Vedeu::Stream.new(value:
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
Vedeu::Views::Stream.new(value: stream_value,
|
57
|
+
parent: line,
|
58
|
+
colour: Vedeu::Colour.new(foreground: '#ff0000',
|
59
|
+
background: '#000000'),
|
60
|
+
style: stream_style)
|
62
61
|
}
|
63
62
|
let(:stream_value) { 'Some text' }
|
64
|
-
let(:stream_colour) {
|
65
|
-
Vedeu::Colour.new(foreground: '#ff0000', background: '#000000')
|
66
|
-
}
|
67
63
|
let(:stream_style) { Vedeu::Style.new(:underline) }
|
68
64
|
|
69
65
|
it { includer.must_respond_to(:to_str) }
|
@@ -28,10 +28,26 @@ module Vedeu
|
|
28
28
|
context 'when there is output' do
|
29
29
|
let(:output) {
|
30
30
|
[
|
31
|
-
Vedeu::Char.new(value: 't',
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
Vedeu::Views::Char.new(value: 't',
|
32
|
+
colour: {
|
33
|
+
background: '#ff0000',
|
34
|
+
foreground: '#ffffff'
|
35
|
+
}),
|
36
|
+
Vedeu::Views::Char.new(value: 'e',
|
37
|
+
colour: {
|
38
|
+
background: '#ffff00',
|
39
|
+
foreground: '#000000'
|
40
|
+
}),
|
41
|
+
Vedeu::Views::Char.new(value: 's',
|
42
|
+
colour: {
|
43
|
+
background: '#00ff00',
|
44
|
+
foreground: '#000000'
|
45
|
+
}),
|
46
|
+
Vedeu::Views::Char.new(value: 't',
|
47
|
+
colour: {
|
48
|
+
background: '#00ffff',
|
49
|
+
foreground: '#000000'
|
50
|
+
}),
|
35
51
|
]
|
36
52
|
}
|
37
53
|
|