vedeu 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +9 -0
  3. data/README.md +1 -1
  4. data/docs/api.md +60 -67
  5. data/docs/configuration.md +8 -5
  6. data/docs/events.md +31 -15
  7. data/docs/events/application.md +12 -0
  8. data/docs/events/document.md +57 -0
  9. data/docs/events/drb.md +43 -0
  10. data/docs/events/focus.md +24 -0
  11. data/docs/events/menu.md +57 -0
  12. data/docs/events/movement.md +57 -0
  13. data/docs/events/refresh.md +25 -0
  14. data/docs/events/system.md +90 -0
  15. data/docs/events/visibility.md +68 -0
  16. data/lib/vedeu.rb +2 -2
  17. data/lib/vedeu/all.rb +3 -2
  18. data/lib/vedeu/api.rb +18 -18
  19. data/lib/vedeu/application/controller.rb +1 -1
  20. data/lib/vedeu/application/helper.rb +1 -1
  21. data/lib/vedeu/application/view.rb +1 -1
  22. data/lib/vedeu/bindings/application.rb +1 -12
  23. data/lib/vedeu/bindings/bindings.rb +3 -1
  24. data/lib/vedeu/bindings/document.rb +9 -62
  25. data/lib/vedeu/bindings/drb.rb +12 -56
  26. data/lib/vedeu/bindings/focus.rb +3 -28
  27. data/lib/vedeu/bindings/menus.rb +10 -66
  28. data/lib/vedeu/bindings/movement.rb +4 -69
  29. data/lib/vedeu/bindings/refresh.rb +3 -33
  30. data/lib/vedeu/bindings/system.rb +14 -100
  31. data/lib/vedeu/bindings/visibility.rb +20 -71
  32. data/lib/vedeu/borders/all.rb +4 -3
  33. data/lib/vedeu/borders/border.rb +39 -33
  34. data/lib/vedeu/borders/dsl.rb +40 -33
  35. data/lib/vedeu/borders/null.rb +2 -2
  36. data/lib/vedeu/borders/render.rb +29 -24
  37. data/lib/vedeu/borders/repository.rb +2 -2
  38. data/lib/vedeu/buffers/all.rb +8 -7
  39. data/lib/vedeu/buffers/buffer.rb +47 -39
  40. data/lib/vedeu/buffers/null.rb +2 -2
  41. data/lib/vedeu/buffers/refresh.rb +4 -3
  42. data/lib/vedeu/buffers/virtual_buffer.rb +122 -118
  43. data/lib/vedeu/buffers/virtual_buffers.rb +62 -56
  44. data/lib/vedeu/colours/background.rb +2 -1
  45. data/lib/vedeu/colours/colour.rb +21 -19
  46. data/lib/vedeu/colours/foreground.rb +2 -1
  47. data/lib/vedeu/colours/repository.rb +6 -5
  48. data/lib/vedeu/colours/translator.rb +39 -35
  49. data/lib/vedeu/configuration/api.rb +59 -51
  50. data/lib/vedeu/configuration/cli.rb +9 -7
  51. data/lib/vedeu/configuration/configuration.rb +41 -32
  52. data/lib/vedeu/cursors/cursor.rb +1 -1
  53. data/lib/vedeu/cursors/refresh.rb +20 -16
  54. data/lib/vedeu/distributed/server.rb +8 -6
  55. data/lib/vedeu/distributed/subprocess.rb +90 -86
  56. data/lib/vedeu/distributed/uri.rb +4 -3
  57. data/lib/vedeu/dsl/composition.rb +2 -2
  58. data/lib/vedeu/dsl/group.rb +4 -4
  59. data/lib/vedeu/dsl/interface.rb +5 -5
  60. data/lib/vedeu/dsl/presentation.rb +2 -2
  61. data/lib/vedeu/dsl/text.rb +1 -1
  62. data/lib/vedeu/editor/cropper.rb +4 -4
  63. data/lib/vedeu/editor/cursor.rb +6 -4
  64. data/lib/vedeu/editor/document.rb +20 -18
  65. data/lib/vedeu/editor/editor.rb +2 -2
  66. data/lib/vedeu/editor/line.rb +10 -5
  67. data/lib/vedeu/editor/lines.rb +2 -2
  68. data/lib/vedeu/internal_api.rb +4 -4
  69. data/lib/vedeu/models/focus.rb +197 -191
  70. data/lib/vedeu/models/group.rb +171 -159
  71. data/lib/vedeu/models/groups.rb +14 -10
  72. data/lib/vedeu/models/interface.rb +116 -110
  73. data/lib/vedeu/models/interfaces.rb +24 -20
  74. data/lib/vedeu/models/toggleable.rb +4 -4
  75. data/lib/vedeu/models/views/char.rb +1 -1
  76. data/lib/vedeu/models/views/composition.rb +1 -1
  77. data/lib/vedeu/models/views/line.rb +1 -1
  78. data/lib/vedeu/models/views/stream.rb +1 -1
  79. data/lib/vedeu/models/views/view.rb +1 -1
  80. data/lib/vedeu/null/interface.rb +1 -1
  81. data/lib/vedeu/null/view.rb +1 -1
  82. data/lib/vedeu/output/clear/named_interface.rb +1 -1
  83. data/lib/vedeu/output/compressor.rb +78 -73
  84. data/lib/vedeu/output/direct.rb +61 -57
  85. data/lib/vedeu/output/output.rb +34 -29
  86. data/lib/vedeu/output/{presentation.rb → presentation/presentation.rb} +2 -1
  87. data/lib/vedeu/output/presentation/style.rb +64 -18
  88. data/lib/vedeu/output/presentation/styles.rb +39 -0
  89. data/lib/vedeu/output/renderers/html.rb +2 -2
  90. data/lib/vedeu/output/renderers/json.rb +2 -1
  91. data/lib/vedeu/output/renderers/terminal.rb +3 -3
  92. data/lib/vedeu/output/renderers/text.rb +3 -3
  93. data/lib/vedeu/output/text.rb +186 -180
  94. data/lib/vedeu/output/wordwrap.rb +142 -138
  95. data/lib/vedeu/refresh/refresh.rb +2 -2
  96. data/lib/vedeu/templating/helpers.rb +11 -6
  97. data/lib/vedeu/templating/view_template.rb +1 -1
  98. data/lib/vedeu/terminal/terminal.rb +2 -2
  99. data/lib/vedeu/version.rb +1 -1
  100. data/test/lib/vedeu/borders/render_test.rb +1 -1
  101. data/test/lib/vedeu/buffers/buffer_test.rb +16 -14
  102. data/test/lib/vedeu/buffers/virtual_buffer_test.rb +105 -101
  103. data/test/lib/vedeu/buffers/virtual_buffers_test.rb +43 -39
  104. data/test/lib/vedeu/colours/colour_test.rb +4 -4
  105. data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
  106. data/test/lib/vedeu/cursors/repository_test.rb +3 -3
  107. data/test/lib/vedeu/distributed/subprocess_test.rb +33 -29
  108. data/test/lib/vedeu/dsl/group_test.rb +3 -3
  109. data/test/lib/vedeu/dsl/interface_test.rb +6 -5
  110. data/test/lib/vedeu/dsl/line_test.rb +4 -2
  111. data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
  112. data/test/lib/vedeu/dsl/text_test.rb +8 -8
  113. data/test/lib/vedeu/editor/document_test.rb +10 -6
  114. data/test/lib/vedeu/input/keymap_test.rb +1 -10
  115. data/test/lib/vedeu/models/focus_test.rb +177 -170
  116. data/test/lib/vedeu/models/group_test.rb +99 -95
  117. data/test/lib/vedeu/models/groups_test.rb +13 -9
  118. data/test/lib/vedeu/models/interface_test.rb +93 -87
  119. data/test/lib/vedeu/models/interfaces_test.rb +24 -20
  120. data/test/lib/vedeu/models/views/char_test.rb +2 -2
  121. data/test/lib/vedeu/models/views/line_test.rb +11 -7
  122. data/test/lib/vedeu/models/views/stream_test.rb +1 -1
  123. data/test/lib/vedeu/models/views/view_test.rb +1 -1
  124. data/test/lib/vedeu/output/clear/named_group_test.rb +1 -1
  125. data/test/lib/vedeu/output/clear/named_interface_test.rb +3 -1
  126. data/test/lib/vedeu/output/compressor_test.rb +126 -122
  127. data/test/lib/vedeu/output/direct_test.rb +49 -43
  128. data/test/lib/vedeu/output/output_test.rb +35 -31
  129. data/test/lib/vedeu/output/{presentation_test.rb → presentation/presentation_test.rb} +11 -7
  130. data/test/lib/vedeu/output/presentation/style_test.rb +88 -48
  131. data/test/lib/vedeu/output/presentation/styles_test.rb +84 -0
  132. data/test/lib/vedeu/output/text_test.rb +109 -105
  133. data/test/lib/vedeu/output/viewport_test.rb +3 -1
  134. data/test/lib/vedeu/output/wordwrap_test.rb +209 -205
  135. data/test/lib/vedeu/refresh/refresh_test.rb +3 -1
  136. data/test/lib/vedeu/templating/helpers_test.rb +6 -6
  137. data/test/lib/vedeu/templating/view_template_test.rb +1 -1
  138. metadata +17 -8
  139. data/lib/vedeu/output/style.rb +0 -76
  140. data/test/lib/vedeu/output/style_test.rb +0 -120
@@ -2,33 +2,37 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- describe Interfaces do
5
+ module Models
6
6
 
7
- let(:described) { Vedeu::Interfaces }
7
+ describe Interfaces do
8
8
 
9
- it { described.must_respond_to(:interfaces) }
9
+ let(:described) { Vedeu::Models::Interfaces }
10
10
 
11
- describe '#zindexed' do
12
- before do
13
- Vedeu.interfaces.reset
11
+ it { described.must_respond_to(:interfaces) }
14
12
 
15
- @hydrogen = Vedeu.interface('hydrogen') do
16
- zindex 2
17
- end
18
- @helium = Vedeu.interface('helium') do
19
- zindex 3
20
- end
21
- @lithium = Vedeu.interface('lithium') do
22
- zindex 1
13
+ describe '#zindexed' do
14
+ before do
15
+ Vedeu.interfaces.reset
16
+
17
+ @hydrogen = Vedeu.interface('hydrogen') do
18
+ zindex 2
19
+ end
20
+ @helium = Vedeu.interface('helium') do
21
+ zindex 3
22
+ end
23
+ @lithium = Vedeu.interface('lithium') do
24
+ zindex 1
25
+ end
23
26
  end
24
- end
25
- after { Vedeu.interfaces.reset }
27
+ after { Vedeu.interfaces.reset }
28
+
29
+ subject { Vedeu.interfaces.zindexed }
26
30
 
27
- subject { Vedeu.interfaces.zindexed }
31
+ it { subject.must_equal([@lithium, @hydrogen, @helium]) }
32
+ end
28
33
 
29
- it { subject.must_equal([@lithium, @hydrogen, @helium]) }
30
- end
34
+ end # Interfaces
31
35
 
32
- end # Interfaces
36
+ end # Models
33
37
 
34
38
  end # Vedeu
@@ -158,10 +158,10 @@ module Vedeu
158
158
  end
159
159
 
160
160
  context 'when a style is specified' do
161
- let(:style) { Vedeu::Style.new('underline') }
161
+ let(:style) { Vedeu::Presentation::Style.new('underline') }
162
162
 
163
163
  context 'when a parent style is specified' do
164
- let(:parent_style) { Vedeu::Style.new('bold') }
164
+ let(:parent_style) { Vedeu::Presentation::Style.new('bold') }
165
165
 
166
166
  it { subject.must_equal("\e[4ma") }
167
167
  end
@@ -20,18 +20,22 @@ module Vedeu
20
20
  [
21
21
  Vedeu::Views::Stream.new(value: 'Something interesting ',
22
22
  parent: streams_parent,
23
- colour: Vedeu::Colours::Colour.new(foreground: '#ffff00'),
24
- style: Vedeu::Style.new('normal')),
23
+ colour: yellow,
24
+ style: normal_style),
25
25
  Vedeu::Views::Stream.new(value: 'on this line ',
26
26
  parent: streams_parent,
27
- colour: Vedeu::Colours::Colour.new(foreground: '#00ff00'),
28
- style: Vedeu::Style.new('normal')),
27
+ colour: green,
28
+ style: normal_style),
29
29
  Vedeu::Views::Stream.new(value: 'would be cool, eh?',
30
30
  parent: streams_parent,
31
- colour: Vedeu::Colours::Colour.new(foreground: '#0000ff'),
32
- style: Vedeu::Style.new('normal'))
31
+ colour: blue,
32
+ style: normal_style)
33
33
  ]
34
34
  }
35
+ let(:yellow) { Vedeu::Colours::Colour.new(foreground: '#ffff00') }
36
+ let(:green) { Vedeu::Colours::Colour.new(foreground: '#00ff00') }
37
+ let(:blue) { Vedeu::Colours::Colour.new(foreground: '#0000ff') }
38
+ let(:normal_style) { Vedeu::Presentation::Style.new('normal') }
35
39
 
36
40
  let(:streams_parent) {
37
41
  Vedeu::Views::Line.new(value: nil,
@@ -41,10 +45,10 @@ module Vedeu
41
45
  }
42
46
 
43
47
  let(:parent) { Vedeu::Views::View.new(name: 'Vedeu::Line') }
48
+ let(:style) { Vedeu::Presentation::Style.new('normal') }
44
49
  let(:colour) {
45
50
  Vedeu::Colours::Colour.new(foreground: '#ff0000', background: '#000000')
46
51
  }
47
- let(:style) { Vedeu::Style.new('normal') }
48
52
 
49
53
  describe '#initialize' do
50
54
  it { instance.must_be_instance_of(described) }
@@ -29,7 +29,7 @@ module Vedeu
29
29
  let(:colour) {
30
30
  Vedeu::Colours::Colour.new(background: '#ff0000', foreground: '#000000')
31
31
  }
32
- let(:style) { Vedeu::Style.new('normal') }
32
+ let(:style) { Vedeu::Presentation::Style.new('normal') }
33
33
  let(:line_parent) { Vedeu::Views::View.new(name: 'Vedeu::Views::Stream') }
34
34
 
35
35
  describe '#initialize' do
@@ -86,7 +86,7 @@ module Vedeu
86
86
  subject { instance.visible? }
87
87
 
88
88
  context 'when the interface is visible' do
89
- let(:interface) { Vedeu::Interface.new(visible: true) }
89
+ let(:interface) { Vedeu::Models::Interface.new(visible: true) }
90
90
 
91
91
  before do
92
92
  Vedeu.interfaces.stubs(:by_name).with(_name).returns(interface)
@@ -16,7 +16,7 @@ module Vedeu
16
16
  end
17
17
 
18
18
  describe '.render' do
19
- let(:group) { Vedeu::Group.new(members: [_name]) }
19
+ let(:group) { Vedeu::Models::Group.new(members: [_name]) }
20
20
 
21
21
  before { Vedeu.groups.stubs(:by_name).returns(group) }
22
22
 
@@ -22,7 +22,9 @@ module Vedeu
22
22
  end
23
23
 
24
24
  describe '#render' do
25
- let(:interface) { Vedeu::Interface.new(name: _name, visible: visible) }
25
+ let(:interface) {
26
+ Vedeu::Models::Interface.new(name: _name, visible: visible)
27
+ }
26
28
  let(:visible) { true }
27
29
  let(:geometry) {
28
30
  Vedeu::Geometry::Geometry.new(name: _name, x: 1, y: 1, xn: 2, yn: 2)
@@ -2,143 +2,147 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- describe Compressor do
6
-
7
- let(:described) { Vedeu::Compressor }
8
- let(:instance) { described.new(output) }
9
- let(:output) {}
10
-
11
- describe '#initialize' do
12
- it { instance.must_be_instance_of(described) }
13
- it { instance.instance_variable_get('@output').must_equal(output) }
14
- it { instance.instance_variable_get('@colour').must_equal('') }
15
- it { instance.instance_variable_get('@style').must_equal('') }
16
- end
17
-
18
- describe '.render' do
19
- subject { described.render(output) }
20
-
21
- it { subject.must_be_instance_of(String) }
22
-
23
- context 'when compression is enabled' do
24
- before { Vedeu.configure { compression(true) } }
25
-
26
- context 'when the output is all Vedeu::Views::Char elements' do
27
- let(:output) {
28
- [
29
- Vedeu::Views::Char.new(value: 'Y',
30
- colour: { foreground: '#ff0000' }),
31
- Vedeu::Views::Char.new(value: 'e',
32
- colour: { foreground: '#ff0000' }),
33
- Vedeu::Views::Char.new(value: 's',
34
- colour: { foreground: '#ff0000' }),
35
- ]
36
- }
37
- it 'converts the non-Vedeu::Views::Char elements into String ' \
38
- 'elements' do
39
- subject.must_equal("\e[38;2;255;0;0mYes")
5
+ module Output
6
+
7
+ describe Compressor do
8
+
9
+ let(:described) { Vedeu::Output::Compressor }
10
+ let(:instance) { described.new(output) }
11
+ let(:output) {}
12
+
13
+ describe '#initialize' do
14
+ it { instance.must_be_instance_of(described) }
15
+ it { instance.instance_variable_get('@output').must_equal(output) }
16
+ it { instance.instance_variable_get('@colour').must_equal('') }
17
+ it { instance.instance_variable_get('@style').must_equal('') }
18
+ end
19
+
20
+ describe '.render' do
21
+ subject { described.render(output) }
22
+
23
+ it { subject.must_be_instance_of(String) }
24
+
25
+ context 'when compression is enabled' do
26
+ before { Vedeu.configure { compression(true) } }
27
+
28
+ context 'when the output is all Vedeu::Views::Char elements' do
29
+ let(:output) {
30
+ [
31
+ Vedeu::Views::Char.new(value: 'Y',
32
+ colour: { foreground: '#ff0000' }),
33
+ Vedeu::Views::Char.new(value: 'e',
34
+ colour: { foreground: '#ff0000' }),
35
+ Vedeu::Views::Char.new(value: 's',
36
+ colour: { foreground: '#ff0000' }),
37
+ ]
38
+ }
39
+ it 'converts the non-Vedeu::Views::Char elements into String ' \
40
+ 'elements' do
41
+ subject.must_equal("\e[38;2;255;0;0mYes")
42
+ end
40
43
  end
41
- end
42
44
 
43
- context 'when the output is all Vedeu::Views::Char elements' do
44
- let(:output) {
45
- [
46
- Vedeu::Views::Char.new(value: 'a',
47
- colour: { foreground: '#ff0000' }),
48
- Vedeu::Views::Char.new(value: 'b',
49
- colour: { foreground: '#ff0000' }),
50
- Vedeu::Views::Char.new(value: 'c',
51
- colour: { foreground: '#0000ff' }),
52
- Vedeu::Views::Char.new(value: 'd',
53
- colour: { foreground: '#0000ff' }),
54
- ]
55
- }
56
- it 'compresses multiple colours and styles where possible' do
57
- subject.must_equal("\e[38;2;255;0;0mab\e[38;2;0;0;255mcd")
45
+ context 'when the output is all Vedeu::Views::Char elements' do
46
+ let(:output) {
47
+ [
48
+ Vedeu::Views::Char.new(value: 'a',
49
+ colour: { foreground: '#ff0000' }),
50
+ Vedeu::Views::Char.new(value: 'b',
51
+ colour: { foreground: '#ff0000' }),
52
+ Vedeu::Views::Char.new(value: 'c',
53
+ colour: { foreground: '#0000ff' }),
54
+ Vedeu::Views::Char.new(value: 'd',
55
+ colour: { foreground: '#0000ff' }),
56
+ ]
57
+ }
58
+ it 'compresses multiple colours and styles where possible' do
59
+ subject.must_equal("\e[38;2;255;0;0mab\e[38;2;0;0;255mcd")
60
+ end
58
61
  end
59
- end
60
62
 
61
- context 'when the output is not all Vedeu::Views::Char ' \
62
- 'elements' do
63
- let(:output) {
64
- [
65
- Vedeu::Views::Char.new(value: 'N'),
66
- Vedeu::Models::Escape.new(value: "\e[?25l"),
67
- Vedeu::Views::Char.new(value: 't'),
68
- ]
69
- }
70
- it 'converts the non-Vedeu::Views::Char elements into String ' \
71
- 'elements' do
72
- subject.must_equal("N\e[1;1H\e[?25lt")
63
+ context 'when the output is not all Vedeu::Views::Char ' \
64
+ 'elements' do
65
+ let(:output) {
66
+ [
67
+ Vedeu::Views::Char.new(value: 'N'),
68
+ Vedeu::Models::Escape.new(value: "\e[?25l"),
69
+ Vedeu::Views::Char.new(value: 't'),
70
+ ]
71
+ }
72
+ it 'converts the non-Vedeu::Views::Char elements into String ' \
73
+ 'elements' do
74
+ subject.must_equal("N\e[1;1H\e[?25lt")
75
+ end
73
76
  end
74
77
  end
75
- end
76
78
 
77
- context 'when compression is not enabled' do
78
- before { Vedeu.configure { compression(false) } }
79
-
80
- context 'when the output is all Vedeu::Views::Char elements' do
81
- let(:output) {
82
- [
83
- Vedeu::Views::Char.new(value: 'Y',
84
- colour: { foreground: '#ff0000' }),
85
- Vedeu::Views::Char.new(value: 'e',
86
- colour: { foreground: '#ff0000' }),
87
- Vedeu::Views::Char.new(value: 's',
88
- colour: { foreground: '#ff0000' }),
89
- ]
90
- }
91
- it 'converts the non-Vedeu::Views::Char elements into String ' \
92
- 'elements' do
93
- subject.must_equal(
94
- "\e[38;2;255;0;0mY\e[38;2;255;0;0me\e[38;2;255;0;0ms"
95
- )
79
+ context 'when compression is not enabled' do
80
+ before { Vedeu.configure { compression(false) } }
81
+
82
+ context 'when the output is all Vedeu::Views::Char elements' do
83
+ let(:output) {
84
+ [
85
+ Vedeu::Views::Char.new(value: 'Y',
86
+ colour: { foreground: '#ff0000' }),
87
+ Vedeu::Views::Char.new(value: 'e',
88
+ colour: { foreground: '#ff0000' }),
89
+ Vedeu::Views::Char.new(value: 's',
90
+ colour: { foreground: '#ff0000' }),
91
+ ]
92
+ }
93
+ it 'converts the non-Vedeu::Views::Char elements into String ' \
94
+ 'elements' do
95
+ subject.must_equal(
96
+ "\e[38;2;255;0;0mY\e[38;2;255;0;0me\e[38;2;255;0;0ms"
97
+ )
98
+ end
96
99
  end
97
- end
98
100
 
99
- context 'when the output is all Vedeu::Views::Char elements' do
100
- let(:output) {
101
- [
102
- Vedeu::Views::Char.new(value: 'a',
103
- colour: { foreground: '#ff0000' }),
104
- Vedeu::Views::Char.new(value: 'b',
105
- colour: { foreground: '#ff0000' }),
106
- Vedeu::Views::Char.new(value: 'c',
107
- colour: { foreground: '#0000ff' }),
108
- Vedeu::Views::Char.new(value: 'd',
109
- colour: { foreground: '#0000ff' }),
110
- ]
111
- }
112
- it 'compresses multiple colours and styles where possible' do
113
- subject.must_equal(
114
- "\e[38;2;255;0;0ma" \
115
- "\e[38;2;255;0;0mb" \
116
- "\e[38;2;0;0;255mc" \
117
- "\e[38;2;0;0;255md"
118
- )
101
+ context 'when the output is all Vedeu::Views::Char elements' do
102
+ let(:output) {
103
+ [
104
+ Vedeu::Views::Char.new(value: 'a',
105
+ colour: { foreground: '#ff0000' }),
106
+ Vedeu::Views::Char.new(value: 'b',
107
+ colour: { foreground: '#ff0000' }),
108
+ Vedeu::Views::Char.new(value: 'c',
109
+ colour: { foreground: '#0000ff' }),
110
+ Vedeu::Views::Char.new(value: 'd',
111
+ colour: { foreground: '#0000ff' }),
112
+ ]
113
+ }
114
+ it 'compresses multiple colours and styles where possible' do
115
+ subject.must_equal(
116
+ "\e[38;2;255;0;0ma" \
117
+ "\e[38;2;255;0;0mb" \
118
+ "\e[38;2;0;0;255mc" \
119
+ "\e[38;2;0;0;255md"
120
+ )
121
+ end
119
122
  end
120
- end
121
123
 
122
- context 'when the output is not all Vedeu::Views::Char elements' do
123
- let(:output) {
124
- [
125
- Vedeu::Views::Char.new(value: 'N'),
126
- Vedeu::Models::Escape.new(value: "\e[?25l"),
127
- Vedeu::Views::Char.new(value: 't'),
128
- ]
129
- }
130
- it 'converts the non-Vedeu::Views::Char elements into String ' \
131
- 'elements' do
132
- subject.must_equal("N\e[1;1H\e[?25lt")
124
+ context 'when the output is not all Vedeu::Views::Char elements' do
125
+ let(:output) {
126
+ [
127
+ Vedeu::Views::Char.new(value: 'N'),
128
+ Vedeu::Models::Escape.new(value: "\e[?25l"),
129
+ Vedeu::Views::Char.new(value: 't'),
130
+ ]
131
+ }
132
+ it 'converts the non-Vedeu::Views::Char elements into String ' \
133
+ 'elements' do
134
+ subject.must_equal("N\e[1;1H\e[?25lt")
135
+ end
133
136
  end
134
137
  end
135
138
  end
136
- end
137
139
 
138
- describe '#render' do
139
- it { instance.must_respond_to(:render) }
140
- end
140
+ describe '#render' do
141
+ it { instance.must_respond_to(:render) }
142
+ end
143
+
144
+ end # Compressor
141
145
 
142
- end # Compressor
146
+ end # Output
143
147
 
144
148
  end # Vedeu
@@ -2,69 +2,75 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- describe Direct do
5
+ module Output
6
6
 
7
- let(:described) { Vedeu::Direct }
8
- let(:instance) { described.new(value: _value, x: x, y: y) }
9
- let(:_value) {}
10
- let(:x) {}
11
- let(:y) {}
7
+ describe Direct do
12
8
 
13
- describe '#initialize' do
14
- it { instance.must_be_instance_of(described) }
9
+ let(:described) { Vedeu::Output::Direct }
10
+ let(:instance) { described.new(value: _value, x: x, y: y) }
11
+ let(:_value) {}
12
+ let(:x) {}
13
+ let(:y) {}
15
14
 
16
- context 'when no value is given' do
17
- it { instance.instance_variable_get('@value').must_equal('') }
18
- end
15
+ describe '#initialize' do
16
+ it { instance.must_be_instance_of(described) }
19
17
 
20
- context 'when a value is given' do
21
- let(:_value) { 'some value' }
18
+ context 'when no value is given' do
19
+ it { instance.instance_variable_get('@value').must_equal('') }
20
+ end
22
21
 
23
- it { instance.instance_variable_get('@value').must_equal('some value') }
24
- end
22
+ context 'when a value is given' do
23
+ let(:_value) { 'some value' }
25
24
 
26
- context 'when no x is given' do
27
- it { instance.instance_variable_get('@x').must_equal(1) }
28
- end
25
+ it {
26
+ instance.instance_variable_get('@value').must_equal('some value')
27
+ }
28
+ end
29
29
 
30
- context 'when an x is given' do
31
- let(:x) { 6 }
32
- it { instance.instance_variable_get('@x').must_equal(6) }
33
- end
30
+ context 'when no x is given' do
31
+ it { instance.instance_variable_get('@x').must_equal(1) }
32
+ end
34
33
 
35
- context 'when no y is given' do
36
- it { instance.instance_variable_get('@y').must_equal(1) }
37
- end
34
+ context 'when an x is given' do
35
+ let(:x) { 6 }
36
+ it { instance.instance_variable_get('@x').must_equal(6) }
37
+ end
38
+
39
+ context 'when no y is given' do
40
+ it { instance.instance_variable_get('@y').must_equal(1) }
41
+ end
38
42
 
39
- context 'when a y is given' do
40
- let(:y) { 3 }
43
+ context 'when a y is given' do
44
+ let(:y) { 3 }
41
45
 
42
- it { instance.instance_variable_get('@y').must_equal(3) }
46
+ it { instance.instance_variable_get('@y').must_equal(3) }
47
+ end
43
48
  end
44
- end
45
49
 
46
- describe '.write' do
47
- before { Vedeu::Terminal.stubs(:output) }
50
+ describe '.write' do
51
+ before { Vedeu::Terminal.stubs(:output) }
52
+
53
+ subject { described.write(value: _value, x: x, y: y) }
48
54
 
49
- subject { described.write(value: _value, x: x, y: y) }
55
+ it { subject.must_be_instance_of(String) }
50
56
 
51
- it { subject.must_be_instance_of(String) }
57
+ context 'when a value is given' do
58
+ let(:_value) { 'some value' }
52
59
 
53
- context 'when a value is given' do
54
- let(:_value) { 'some value' }
60
+ it { subject.must_equal("\e[1;1Hsome value") }
61
+ end
55
62
 
56
- it { subject.must_equal("\e[1;1Hsome value") }
63
+ context 'when a value is not given' do
64
+ it { subject.must_equal("\e[1;1H") }
65
+ end
57
66
  end
58
67
 
59
- context 'when a value is not given' do
60
- it { subject.must_equal("\e[1;1H") }
68
+ describe '#write' do
69
+ it { instance.must_respond_to(:write) }
61
70
  end
62
- end
63
71
 
64
- describe '#write' do
65
- it { instance.must_respond_to(:write) }
66
- end
72
+ end # Direct
67
73
 
68
- end # Direct
74
+ end # Output
69
75
 
70
76
  end # Vedeu