vedeu 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/docs/events.md +4 -0
  4. data/examples/borders_app.rb +43 -39
  5. data/examples/focus_app.rb +4 -0
  6. data/examples/hello_world.rb +10 -3
  7. data/lib/vedeu/all.rb +1 -2
  8. data/lib/vedeu/api.rb +4 -1
  9. data/lib/vedeu/application/application_controller.rb +24 -0
  10. data/lib/vedeu/application/application_view.rb +9 -9
  11. data/lib/vedeu/bindings.rb +2 -0
  12. data/lib/vedeu/bindings/movement.rb +9 -9
  13. data/lib/vedeu/bindings/system.rb +3 -3
  14. data/lib/vedeu/buffers/buffer.rb +4 -9
  15. data/lib/vedeu/buffers/display_buffer.rb +2 -48
  16. data/lib/vedeu/cli/generator/application.rb +6 -0
  17. data/lib/vedeu/cli/generator/templates/application/.ruby-version +1 -0
  18. data/lib/vedeu/cli/generator/templates/application/app/controllers/name.erb +2 -11
  19. data/lib/vedeu/configuration/api.rb +6 -0
  20. data/lib/vedeu/configuration/configuration.rb +6 -0
  21. data/lib/vedeu/cursor/cursor.rb +49 -15
  22. data/lib/vedeu/cursor/move.rb +2 -2
  23. data/lib/vedeu/cursor/refresh_cursor.rb +2 -7
  24. data/lib/vedeu/distributed/server.rb +7 -21
  25. data/lib/vedeu/dsl/view.rb +31 -6
  26. data/lib/vedeu/internal_api.rb +7 -0
  27. data/lib/vedeu/log/log.rb +5 -2
  28. data/lib/vedeu/models/escape.rb +24 -6
  29. data/lib/vedeu/models/interface.rb +2 -14
  30. data/lib/vedeu/null/buffer.rb +7 -21
  31. data/lib/vedeu/null/generic.rb +5 -16
  32. data/lib/vedeu/null/interface.rb +6 -18
  33. data/lib/vedeu/runtime/bootstrap.rb +1 -1
  34. data/lib/vedeu/runtime/flags.rb +57 -0
  35. data/lib/vedeu/runtime/router.rb +2 -2
  36. data/lib/vedeu/version.rb +2 -1
  37. data/test/lib/vedeu/api_test.rb +1 -0
  38. data/test/lib/vedeu/application/application_controller_test.rb +26 -2
  39. data/test/lib/vedeu/application/application_view_test.rb +9 -4
  40. data/test/lib/vedeu/bindings_test.rb +9 -0
  41. data/test/lib/vedeu/borders/border_test.rb +25 -42
  42. data/test/lib/vedeu/buffers/display_buffer_test.rb +0 -10
  43. data/test/lib/vedeu/configuration/api_test.rb +7 -1
  44. data/test/lib/vedeu/configuration/cli_test.rb +0 -1
  45. data/test/lib/vedeu/configuration/configuration_test.rb +16 -0
  46. data/test/lib/vedeu/cursor/cursor_test.rb +122 -4
  47. data/test/lib/vedeu/dsl/view_test.rb +2 -2
  48. data/test/lib/vedeu/internal_api_test.rb +2 -0
  49. data/test/lib/vedeu/models/escape_test.rb +16 -6
  50. data/test/lib/vedeu/models/focus_test.rb +2 -1
  51. data/test/lib/vedeu/models/interface_test.rb +9 -5
  52. data/test/lib/vedeu/null/buffer_test.rb +7 -25
  53. data/test/lib/vedeu/null/generic_test.rb +6 -20
  54. data/test/lib/vedeu/null/interface_test.rb +8 -14
  55. data/test/lib/vedeu/output/compressor_test.rb +4 -4
  56. data/test/lib/vedeu/output/renderers_test.rb +1 -1
  57. data/test/lib/vedeu/runtime/flags_test.rb +47 -0
  58. data/test/lib/vedeu/runtime/router_test.rb +4 -4
  59. data/test/test_helper.rb +2 -0
  60. metadata +6 -10
  61. data/examples/geometry_app.rb +0 -147
  62. data/examples/panel_app.rb +0 -71
  63. data/lib/vedeu/geometry/index_position.rb +0 -85
  64. data/lib/vedeu/geometry/position_validator.rb +0 -69
  65. data/test/lib/vedeu/geometry/index_position_test.rb +0 -130
  66. data/test/lib/vedeu/geometry/position_validator_test.rb +0 -149
@@ -1,149 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- describe PositionValidator do
6
-
7
- let(:described) { Vedeu::PositionValidator }
8
- let(:instance) { described.new(_name, x, y) }
9
- let(:_name) { 'position_validator' }
10
- let(:x) { 1 }
11
- let(:y) { 1 }
12
- let(:enabled) { true }
13
- let(:border) { Vedeu::Border.new(name: _name, enabled: enabled) }
14
- let(:geometry) {
15
- Vedeu::Geometry.new(
16
- name: _name,
17
- x: 5,
18
- xn: 35,
19
- y: 5,
20
- yn: 10
21
- )
22
- }
23
-
24
- before {
25
- IO.console.stubs(:size).returns([15, 40])
26
- Vedeu.borders.stubs(:by_name).returns(border)
27
- Vedeu.geometries.stubs(:by_name).returns(geometry)
28
- }
29
-
30
- describe '#initialize' do
31
- it { instance.must_be_instance_of(described) }
32
- it { instance.instance_variable_get('@name').must_equal(_name) }
33
- it { instance.instance_variable_get('@x').must_equal(x) }
34
- it { instance.instance_variable_get('@y').must_equal(y) }
35
- end
36
-
37
- describe '.validate' do
38
- subject { described.validate(_name, x, y) }
39
-
40
- it { instance.must_be_instance_of(described) }
41
- end
42
-
43
- describe '#y' do
44
- subject { described.validate(_name, x, y).y }
45
-
46
- context 'when y is less than ty' do
47
- let(:y) { -2 }
48
-
49
- it { subject.must_equal(6) }
50
- end
51
-
52
- context 'when y is less than top' do
53
- let(:y) { 2 }
54
-
55
- it { subject.must_equal(6) }
56
- end
57
-
58
- context 'when y is less than by' do
59
- let(:y) { 5 }
60
-
61
- it { subject.must_equal(6) }
62
-
63
- context 'when border is not enabled' do
64
- let(:enabled) { false }
65
-
66
- it { subject.must_equal(5) }
67
- end
68
- end
69
-
70
- context 'when y is more than tyn' do
71
- let(:y) { 17 }
72
-
73
- it { subject.must_equal(9) }
74
- end
75
-
76
- context 'when y is more than bottom' do
77
- let(:y) { 12 }
78
-
79
- it { subject.must_equal(9) }
80
- end
81
-
82
- context 'when y is more than byn' do
83
- let(:y) { 10 }
84
-
85
- it { subject.must_equal(9) }
86
-
87
- context 'when border is not enabled' do
88
- let(:enabled) { false }
89
-
90
- it { subject.must_equal(10) }
91
- end
92
- end
93
- end
94
-
95
- describe '#x' do
96
- subject { described.validate(_name, x, y).x }
97
-
98
- context 'when x is less than tx' do
99
- let(:x) { -2 }
100
-
101
- it { subject.must_equal(6) }
102
- end
103
-
104
- context 'when x is less than left' do
105
- let(:x) { 2 }
106
-
107
- it { subject.must_equal(6) }
108
- end
109
-
110
- context 'when x is less than bx' do
111
- let(:x) { 5 }
112
-
113
- it { subject.must_equal(6) }
114
-
115
- context 'when border is not enabled' do
116
- let(:enabled) { false }
117
-
118
- it { subject.must_equal(5) }
119
- end
120
- end
121
-
122
- context 'when x is more than txn' do
123
- let(:x) { 47 }
124
-
125
- it { subject.must_equal(34) }
126
- end
127
-
128
- context 'when x is more than right' do
129
- let(:x) { 37 }
130
-
131
- it { subject.must_equal(34) }
132
- end
133
-
134
- context 'when x is more than bxn' do
135
- let(:x) { 35 }
136
-
137
- it { subject.must_equal(34) }
138
-
139
- context 'when border is not enabled' do
140
- let(:enabled) { false }
141
-
142
- it { subject.must_equal(35) }
143
- end
144
- end
145
- end
146
-
147
- end # PositionValidator
148
-
149
- end # Vedeu