vedeu 0.6.19 → 0.6.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/docs/configuration.md +6 -4
  3. data/docs/dsl.md +23 -21
  4. data/docs/events/system.md +9 -9
  5. data/docs/getting_started.md +54 -48
  6. data/docs/object_graph.md +4 -4
  7. data/lib/vedeu/all.rb +1 -1
  8. data/lib/vedeu/api/external.rb +10 -10
  9. data/lib/vedeu/api/internal.rb +2 -2
  10. data/lib/vedeu/bindings/application.rb +5 -2
  11. data/lib/vedeu/bindings/bindings.rb +15 -2
  12. data/lib/vedeu/bindings/movement.rb +10 -5
  13. data/lib/vedeu/bindings/refresh.rb +1 -1
  14. data/lib/vedeu/bindings/system.rb +1 -1
  15. data/lib/vedeu/bindings/visibility.rb +20 -37
  16. data/lib/vedeu/cursors/cursor.rb +1 -14
  17. data/lib/vedeu/dsl/all.rb +0 -1
  18. data/lib/vedeu/dsl/interface.rb +1 -1
  19. data/lib/vedeu/esc/colours.rb +1 -1
  20. data/lib/vedeu/geometry/geometry.rb +19 -25
  21. data/lib/vedeu/groups/all.rb +16 -0
  22. data/lib/vedeu/{output/clear/group.rb → groups/clear.rb} +7 -7
  23. data/lib/vedeu/{dsl/group.rb → groups/dsl.rb} +10 -10
  24. data/lib/vedeu/{models → groups}/group.rb +14 -31
  25. data/lib/vedeu/{output/refresh/refresh_group.rb → groups/refresh.rb} +7 -7
  26. data/lib/vedeu/groups/repository.rb +24 -0
  27. data/lib/vedeu/models/all.rb +0 -2
  28. data/lib/vedeu/models/interface.rb +0 -12
  29. data/lib/vedeu/models/toggleable.rb +1 -1
  30. data/lib/vedeu/output/clear/all.rb +0 -1
  31. data/lib/vedeu/output/wordwrap.rb +3 -5
  32. data/lib/vedeu/repositories/model.rb +8 -1
  33. data/lib/vedeu/runtime/main_loop.rb +2 -2
  34. data/lib/vedeu/version.rb +1 -1
  35. data/test/lib/vedeu/api/external_test.rb +1 -1
  36. data/test/lib/vedeu/bindings/application_test.rb +1 -0
  37. data/test/lib/vedeu/bindings/bindings_test.rb +27 -0
  38. data/test/lib/vedeu/borders/border_test.rb +43 -37
  39. data/test/lib/vedeu/borders/render_test.rb +5 -1
  40. data/test/lib/vedeu/buffers/buffer_test.rb +9 -7
  41. data/test/lib/vedeu/cursors/cursor_test.rb +11 -9
  42. data/test/lib/vedeu/distributed/test_application_test.rb +18 -16
  43. data/test/lib/vedeu/dsl/interface_test.rb +2 -2
  44. data/test/lib/vedeu/editor/cursor_test.rb +18 -16
  45. data/test/lib/vedeu/editor/document_test.rb +7 -5
  46. data/test/lib/vedeu/esc/actions_test.rb +0 -2
  47. data/test/lib/vedeu/esc/borders_test.rb +0 -2
  48. data/test/lib/vedeu/esc/colours_test.rb +0 -2
  49. data/test/lib/vedeu/events/aliases_test.rb +1 -1
  50. data/test/lib/vedeu/geometry/area_test.rb +10 -8
  51. data/test/lib/vedeu/geometry/dsl_test.rb +2 -2
  52. data/test/lib/vedeu/geometry/geometry_test.rb +18 -30
  53. data/test/lib/vedeu/geometry/position_test.rb +6 -4
  54. data/test/lib/vedeu/{output/clear/group_test.rb → groups/clear_test.rb} +8 -8
  55. data/test/lib/vedeu/{dsl/group_test.rb → groups/dsl_test.rb} +8 -8
  56. data/test/lib/vedeu/{models → groups}/group_test.rb +12 -10
  57. data/test/lib/vedeu/{output/refresh/refresh_group_test.rb → groups/refresh_test.rb} +7 -7
  58. data/test/lib/vedeu/{models/groups_test.rb → groups/repository_test.rb} +6 -6
  59. data/test/lib/vedeu/menus/menu_test.rb +7 -5
  60. data/test/lib/vedeu/models/cell_test.rb +5 -3
  61. data/test/lib/vedeu/models/interface_test.rb +18 -42
  62. data/test/lib/vedeu/models/toggleable_test.rb +5 -3
  63. data/test/lib/vedeu/models/views/char_test.rb +8 -6
  64. data/test/lib/vedeu/models/views/composition_test.rb +6 -4
  65. data/test/lib/vedeu/models/views/line_test.rb +5 -3
  66. data/test/lib/vedeu/models/views/stream_test.rb +9 -7
  67. data/test/lib/vedeu/models/views/view_test.rb +30 -12
  68. data/test/lib/vedeu/output/presentation/style_test.rb +4 -2
  69. data/test/lib/vedeu/plugins/plugin_test.rb +8 -6
  70. data/test/lib/vedeu/repositories/collection_test.rb +8 -6
  71. data/test/lib/vedeu/runtime/application_test.rb +1 -1
  72. data/test/test_helper.rb +1 -0
  73. metadata +18 -17
  74. data/lib/vedeu/models/groups.rb +0 -24
@@ -2,13 +2,13 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module DSL
5
+ module Groups
6
6
 
7
- describe Group do
7
+ describe DSL do
8
8
 
9
- let(:described) { Vedeu::DSL::Group }
9
+ let(:described) { Vedeu::Groups::DSL }
10
10
  let(:instance) { described.new(model, client) }
11
- let(:model) { Vedeu::Models::Group.new }
11
+ let(:model) { Vedeu::Groups::Group.new }
12
12
  let(:client) {}
13
13
  let(:group_name) { 'main_screen' }
14
14
 
@@ -42,7 +42,7 @@ module Vedeu
42
42
  end
43
43
  }
44
44
 
45
- it { subject.must_be_instance_of(Vedeu::Models::Group) }
45
+ it { subject.must_be_instance_of(Vedeu::Groups::Group) }
46
46
 
47
47
  it { subject.members.must_equal(Set['editor_interface']) }
48
48
  end
@@ -58,7 +58,7 @@ module Vedeu
58
58
  end
59
59
  }
60
60
 
61
- it { subject.must_be_instance_of(Vedeu::Models::Group) }
61
+ it { subject.must_be_instance_of(Vedeu::Groups::Group) }
62
62
 
63
63
  it { subject.members.must_equal(expected) }
64
64
  end
@@ -109,8 +109,8 @@ module Vedeu
109
109
  ) }
110
110
  end
111
111
 
112
- end
112
+ end # DSL
113
113
 
114
- end # DSL
114
+ end # Groups
115
115
 
116
116
  end # Vedeu
@@ -2,11 +2,11 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module Models
5
+ module Groups
6
6
 
7
7
  describe Group do
8
8
 
9
- let(:described) { Vedeu::Models::Group }
9
+ let(:described) { Vedeu::Groups::Group }
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:attributes) {
12
12
  {
@@ -32,17 +32,19 @@ module Vedeu
32
32
  end
33
33
 
34
34
  describe 'accessors' do
35
- it { instance.must_respond_to(:name) }
36
- it { instance.must_respond_to(:name=) }
37
- it { instance.must_respond_to(:visible) }
38
- it { instance.must_respond_to(:visible=) }
39
- it { instance.must_respond_to(:visible?) }
35
+ it {
36
+ instance.must_respond_to(:name)
37
+ instance.must_respond_to(:name=)
38
+ instance.must_respond_to(:visible)
39
+ instance.must_respond_to(:visible=)
40
+ instance.must_respond_to(:visible?)
41
+ }
40
42
  end
41
43
 
42
44
  describe '#add' do
43
45
  subject { instance.add('hydrogen') }
44
46
 
45
- it { subject.must_be_instance_of(Vedeu::Models::Group) }
47
+ it { subject.must_be_instance_of(Vedeu::Groups::Group) }
46
48
 
47
49
  context 'when the member already exists' do
48
50
  it 'does not add the member again but returns a new Group' do
@@ -121,7 +123,7 @@ module Vedeu
121
123
  describe '#reset' do
122
124
  subject { instance.reset }
123
125
 
124
- it { subject.must_be_instance_of(Vedeu::Models::Group) }
126
+ it { subject.must_be_instance_of(Vedeu::Groups::Group) }
125
127
  it { subject.members.must_be_empty }
126
128
  end
127
129
 
@@ -133,6 +135,6 @@ module Vedeu
133
135
 
134
136
  end # Group
135
137
 
136
- end # Models
138
+ end # Groups
137
139
 
138
140
  end # Vedeu
@@ -2,13 +2,13 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module Output
5
+ module Groups
6
6
 
7
- describe RefreshGroup do
7
+ describe Refresh do
8
8
 
9
- let(:described) { Vedeu::Output::RefreshGroup }
9
+ let(:described) { Vedeu::Groups::Refresh }
10
10
  let(:instance) { described.new(_name) }
11
- let(:_name) { 'Vedeu::Output::RefreshGroup' }
11
+ let(:_name) { 'Vedeu::Groups::Refresh' }
12
12
 
13
13
  describe '#initialize' do
14
14
  it { instance.must_be_instance_of(described) }
@@ -26,7 +26,7 @@ module Vedeu
26
26
 
27
27
  context 'when the name is present' do
28
28
  it {
29
- Vedeu::Output::RefreshGroup.expects(:by_name).with(_name)
29
+ Vedeu::Groups::Refresh.expects(:by_name).with(_name)
30
30
  subject
31
31
  }
32
32
  end
@@ -36,8 +36,8 @@ module Vedeu
36
36
  it { instance.must_respond_to(:by_name) }
37
37
  end
38
38
 
39
- end # RefreshGroup
39
+ end # Refresh
40
40
 
41
- end # Output
41
+ end # Groups
42
42
 
43
43
  end # Vedeu
@@ -2,11 +2,11 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module Models
5
+ module Groups
6
6
 
7
- describe Groups do
7
+ describe Repository do
8
8
 
9
- let(:described) { Vedeu::Models::Groups }
9
+ let(:described) { Vedeu::Groups::Repository }
10
10
 
11
11
  it { described.must_respond_to(:groups) }
12
12
 
@@ -15,11 +15,11 @@ module Vedeu
15
15
 
16
16
  subject { described.groups.by_name(_name) }
17
17
 
18
- it { subject.must_be_instance_of(Vedeu::Models::Group) }
18
+ it { subject.must_be_instance_of(Vedeu::Groups::Group) }
19
19
  end
20
20
 
21
- end # Groups
21
+ end # Repository
22
22
 
23
- end # Models
23
+ end # Groups
24
24
 
25
25
  end # Vedeu
@@ -51,11 +51,13 @@ module Vedeu
51
51
  end
52
52
 
53
53
  describe 'accessors' do
54
- it { instance.must_respond_to(:collection) }
55
- it { instance.must_respond_to(:collection=) }
56
- it { instance.must_respond_to(:current=) }
57
- it { instance.must_respond_to(:name) }
58
- it { instance.must_respond_to(:name=) }
54
+ it {
55
+ instance.must_respond_to(:collection)
56
+ instance.must_respond_to(:collection=)
57
+ instance.must_respond_to(:current=)
58
+ instance.must_respond_to(:name)
59
+ instance.must_respond_to(:name=)
60
+ }
59
61
  end
60
62
 
61
63
  describe '#current' do
@@ -30,9 +30,11 @@ module Vedeu
30
30
  end
31
31
 
32
32
  describe 'accessors' do
33
- it { instance.must_respond_to(:colour) }
34
- it { instance.must_respond_to(:style) }
35
- it { instance.must_respond_to(:value) }
33
+ it {
34
+ instance.must_respond_to(:colour)
35
+ instance.must_respond_to(:style)
36
+ instance.must_respond_to(:value)
37
+ }
36
38
  end
37
39
 
38
40
  describe '#eql?' do
@@ -49,22 +49,24 @@ module Vedeu
49
49
  end
50
50
 
51
51
  describe 'accessors' do
52
- it { instance.must_respond_to(:client) }
53
- it { instance.must_respond_to(:client=) }
54
- it { instance.must_respond_to(:delay) }
55
- it { instance.must_respond_to(:delay=) }
56
- it { instance.must_respond_to(:group) }
57
- it { instance.must_respond_to(:group=) }
58
- it { instance.must_respond_to(:name) }
59
- it { instance.must_respond_to(:name=) }
60
- it { instance.must_respond_to(:parent) }
61
- it { instance.must_respond_to(:parent=) }
62
- it { instance.must_respond_to(:zindex) }
63
- it { instance.must_respond_to(:zindex=) }
64
- it { instance.must_respond_to(:visible) }
65
- it { instance.must_respond_to(:visible=) }
66
- it { instance.must_respond_to(:visible?) }
67
- it { instance.must_respond_to(:attributes) }
52
+ it {
53
+ instance.must_respond_to(:client)
54
+ instance.must_respond_to(:client=)
55
+ instance.must_respond_to(:delay)
56
+ instance.must_respond_to(:delay=)
57
+ instance.must_respond_to(:group)
58
+ instance.must_respond_to(:group=)
59
+ instance.must_respond_to(:name)
60
+ instance.must_respond_to(:name=)
61
+ instance.must_respond_to(:parent)
62
+ instance.must_respond_to(:parent=)
63
+ instance.must_respond_to(:zindex)
64
+ instance.must_respond_to(:zindex=)
65
+ instance.must_respond_to(:visible)
66
+ instance.must_respond_to(:visible=)
67
+ instance.must_respond_to(:visible?)
68
+ instance.must_respond_to(:attributes)
69
+ }
68
70
  end
69
71
 
70
72
  describe '#hide' do
@@ -93,32 +95,6 @@ module Vedeu
93
95
  }
94
96
  end
95
97
 
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
-
122
98
  end # Interface
123
99
 
124
100
  end # Models
@@ -21,9 +21,11 @@ module Vedeu
21
21
  let(:visible) { false }
22
22
 
23
23
  describe 'accessors' do
24
- it { instance.must_respond_to(:visible) }
25
- it { instance.must_respond_to(:visible=) }
26
- it { instance.must_respond_to(:visible?) }
24
+ it {
25
+ instance.must_respond_to(:visible)
26
+ instance.must_respond_to(:visible=)
27
+ instance.must_respond_to(:visible?)
28
+ }
27
29
  end
28
30
 
29
31
  describe '#hide' do
@@ -58,12 +58,14 @@ module Vedeu
58
58
  end
59
59
 
60
60
  describe 'accessors' do
61
- it { instance.must_respond_to(:border) }
62
- it { instance.must_respond_to(:border=) }
63
- it { instance.must_respond_to(:parent) }
64
- it { instance.must_respond_to(:parent=) }
65
- it { instance.must_respond_to(:attributes) }
66
- it { instance.must_respond_to(:value=) }
61
+ it {
62
+ instance.must_respond_to(:border)
63
+ instance.must_respond_to(:border=)
64
+ instance.must_respond_to(:parent)
65
+ instance.must_respond_to(:parent=)
66
+ instance.must_respond_to(:attributes)
67
+ instance.must_respond_to(:value=)
68
+ }
67
69
  end
68
70
 
69
71
  describe '#chars' do
@@ -43,10 +43,12 @@ module Vedeu
43
43
  end
44
44
 
45
45
  describe 'accessors' do
46
- it { instance.must_respond_to(:attributes) }
47
- it { instance.must_respond_to(:parent) }
48
- it { instance.must_respond_to(:value) }
49
- it { instance.must_respond_to(:views) }
46
+ it {
47
+ instance.must_respond_to(:attributes)
48
+ instance.must_respond_to(:parent)
49
+ instance.must_respond_to(:value)
50
+ instance.must_respond_to(:views)
51
+ }
50
52
  end
51
53
 
52
54
  describe '#add' do
@@ -70,9 +70,11 @@ module Vedeu
70
70
  end
71
71
 
72
72
  describe 'accessors' do
73
- it { instance.must_respond_to(:attributes) }
74
- it { instance.must_respond_to(:parent) }
75
- it { instance.must_respond_to(:parent=) }
73
+ it {
74
+ instance.must_respond_to(:attributes)
75
+ instance.must_respond_to(:parent)
76
+ instance.must_respond_to(:parent=)
77
+ }
76
78
  end
77
79
 
78
80
  describe '#add' do
@@ -52,13 +52,15 @@ module Vedeu
52
52
  end
53
53
 
54
54
  describe 'accessors' do
55
- it { instance.must_respond_to(:parent) }
56
- it { instance.must_respond_to(:parent=) }
57
- it { instance.must_respond_to(:value) }
58
- it { instance.must_respond_to(:content) }
59
- it { instance.must_respond_to(:text) }
60
- it { instance.must_respond_to(:value=) }
61
- it { instance.must_respond_to(:attributes) }
55
+ it {
56
+ instance.must_respond_to(:parent)
57
+ instance.must_respond_to(:parent=)
58
+ instance.must_respond_to(:value)
59
+ instance.must_respond_to(:content)
60
+ instance.must_respond_to(:text)
61
+ instance.must_respond_to(:value=)
62
+ instance.must_respond_to(:attributes)
63
+ }
62
64
  end
63
65
 
64
66
  describe '#add' do
@@ -29,16 +29,18 @@ module Vedeu
29
29
  let(:_name) { 'Vedeu::Views::View' }
30
30
 
31
31
  describe 'accessors' do
32
- it { instance.must_respond_to(:attributes) }
33
- it { instance.must_respond_to(:client) }
34
- it { instance.must_respond_to(:client=) }
35
- it { instance.must_respond_to(:name) }
36
- it { instance.must_respond_to(:name=) }
37
- it { instance.must_respond_to(:parent) }
38
- it { instance.must_respond_to(:parent=) }
39
- it { instance.must_respond_to(:lines=) }
40
- it { instance.must_respond_to(:zindex) }
41
- it { instance.must_respond_to(:zindex=) }
32
+ it {
33
+ instance.must_respond_to(:attributes)
34
+ instance.must_respond_to(:client)
35
+ instance.must_respond_to(:client=)
36
+ instance.must_respond_to(:name)
37
+ instance.must_respond_to(:name=)
38
+ instance.must_respond_to(:parent)
39
+ instance.must_respond_to(:parent=)
40
+ instance.must_respond_to(:lines=)
41
+ instance.must_respond_to(:zindex)
42
+ instance.must_respond_to(:zindex=)
43
+ }
42
44
  end
43
45
 
44
46
  describe '#add' do
@@ -65,8 +67,24 @@ module Vedeu
65
67
  end
66
68
 
67
69
  context 'when the view is visible' do
68
- # @todo Add more tests.
69
- # it { skip }
70
+ let(:interface) { Vedeu::Models::Interface.new(visible: true) }
71
+ let(:border) { Vedeu::Borders::Border.new(name: _name, enabled: false) }
72
+
73
+ before do
74
+ Vedeu.stubs(:trigger)
75
+ Vedeu.interfaces.stubs(:by_name).with(_name).returns(interface)
76
+ Vedeu::Output::Viewport.stubs(:render)
77
+ Vedeu.borders.stubs(:by_name).with(_name).returns(border)
78
+ border.stubs(:render)
79
+ end
80
+
81
+ it {
82
+ Vedeu.expects(:trigger).with(:_clear_view_, _name)
83
+ Vedeu::Output::Viewport.expects(:render).with(instance)
84
+ Vedeu.borders.expects(:by_name).with(_name).returns(border)
85
+ border.expects(:render)
86
+ subject
87
+ }
70
88
  end
71
89
  end
72
90
 
@@ -20,8 +20,10 @@ module Vedeu
20
20
  end
21
21
 
22
22
  describe 'accessors' do
23
- it { instance.must_respond_to(:value) }
24
- it { instance.must_respond_to(:value=) }
23
+ it {
24
+ instance.must_respond_to(:value)
25
+ instance.must_respond_to(:value=)
26
+ }
25
27
  end
26
28
 
27
29
  describe '.coerce' do