vedeu 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/api.md +2 -0
- data/lib/vedeu/all.rb +1 -0
- data/lib/vedeu/api.rb +13 -3
- data/lib/vedeu/bindings/movement.rb +14 -3
- data/lib/vedeu/bindings/visibility.rb +4 -14
- data/lib/vedeu/bindings.rb +2 -0
- data/lib/vedeu/cursor/cursor.rb +2 -2
- data/lib/vedeu/events/event.rb +1 -1
- data/lib/vedeu/events/event_aliases.rb +87 -0
- data/lib/vedeu/events/trigger.rb +10 -2
- data/lib/vedeu/output/presentation/colour.rb +118 -0
- data/lib/vedeu/output/presentation/style.rb +45 -0
- data/lib/vedeu/output/presentation.rb +5 -136
- data/lib/vedeu/output/renderers.rb +2 -0
- data/lib/vedeu/repositories/repository.rb +0 -5
- data/lib/vedeu/repositories/store.rb +5 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/api_test.rb +3 -0
- data/test/lib/vedeu/events/event_aliases_test.rb +118 -0
- data/test/lib/vedeu/output/presentation/colour_test.rb +165 -0
- data/test/lib/vedeu/output/presentation/style_test.rb +83 -0
- data/test/lib/vedeu/output/presentation_test.rb +5 -145
- data/test/lib/vedeu/output/renderers_test.rb +12 -2
- metadata +10 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 059ea4a8cd87f17bcbb219ef8301a54ff5eb10a4
|
4
|
+
data.tar.gz: 9b88929ff9edc741c3fcc3f10545c2d7c1cfe724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c54668ab83878f567eddf5585cd8d09f9da674b864b72bcbeae3d3e55b7bd4cc7e5378615f72056b9419507efe127d6967a1f6febccadc2d9f41d66cb843be4
|
7
|
+
data.tar.gz: 26d4bdfb02800408c9621666e93f7558457b9c538cc764d2a14ced69ae3eb62073144a1d6e345ab6228f5a666c8d16d5ca00e9db312e327fb581df95e8bfe060
|
data/docs/api.md
CHANGED
data/lib/vedeu/all.rb
CHANGED
data/lib/vedeu/api.rb
CHANGED
@@ -101,9 +101,9 @@ module Vedeu
|
|
101
101
|
def_delegators Vedeu::DSL::View, :interface, :renders, :render, :views
|
102
102
|
|
103
103
|
# @example
|
104
|
-
# Vedeu.bind
|
105
|
-
# Vedeu.bound?
|
106
|
-
# Vedeu.unbind
|
104
|
+
# Vedeu.bind(name) { }
|
105
|
+
# Vedeu.bound?(name)
|
106
|
+
# Vedeu.unbind(name)
|
107
107
|
#
|
108
108
|
# @!method bind
|
109
109
|
# @see Vedeu::Event.bind
|
@@ -113,6 +113,16 @@ module Vedeu
|
|
113
113
|
# @see Vedeu::Event.unbind
|
114
114
|
def_delegators Vedeu::Event, :bind, :bound?, :unbind
|
115
115
|
|
116
|
+
# @example
|
117
|
+
# Vedeu.bind_alias(alias_name, event_name)
|
118
|
+
# Vedeu.unbind_alias(alias_name)
|
119
|
+
#
|
120
|
+
# @!method bind_alias
|
121
|
+
# @see Vedeu::EventAliases.bind_alias
|
122
|
+
# @!method unbind_alias
|
123
|
+
# @see Vedeu::EventAliases.unbind_alias
|
124
|
+
def_delegators Vedeu::EventAliases, :bind_alias, :unbind_alias
|
125
|
+
|
116
126
|
# @example
|
117
127
|
# Vedeu.focus
|
118
128
|
# Vedeu.focus_by_name
|
@@ -67,9 +67,8 @@ module Vedeu
|
|
67
67
|
Vedeu.bind(:_cursor_origin_) do |name|
|
68
68
|
Vedeu::Move.by_name(Vedeu::Cursor, :origin, name)
|
69
69
|
end
|
70
|
-
|
71
|
-
|
72
|
-
end
|
70
|
+
|
71
|
+
Vedeu.bind_alias(:_cursor_reset_, :_cursor_origin_)
|
73
72
|
end
|
74
73
|
|
75
74
|
# When triggered will return the current position of the cursor.
|
@@ -130,6 +129,7 @@ module Vedeu
|
|
130
129
|
#
|
131
130
|
# @example
|
132
131
|
# Vedeu.trigger(:_geometry_down_, name)
|
132
|
+
# Vedeu.trigger(:_view_down_, name)
|
133
133
|
#
|
134
134
|
# @return [TrueClass]
|
135
135
|
# @see Vedeu::Move
|
@@ -137,12 +137,15 @@ module Vedeu
|
|
137
137
|
Vedeu.bind(:_geometry_down_) do |name|
|
138
138
|
Vedeu::Move.by_name(Vedeu::Geometry, :down, name)
|
139
139
|
end
|
140
|
+
|
141
|
+
Vedeu.bind_alias(:_view_down_, :_geometry_down_)
|
140
142
|
end
|
141
143
|
|
142
144
|
# Move the geometry left by one character.
|
143
145
|
#
|
144
146
|
# @example
|
145
147
|
# Vedeu.trigger(:_geometry_left_, name)
|
148
|
+
# Vedeu.trigger(:_view_left_, name)
|
146
149
|
#
|
147
150
|
# @return [TrueClass]
|
148
151
|
# @see Vedeu::Move
|
@@ -150,12 +153,15 @@ module Vedeu
|
|
150
153
|
Vedeu.bind(:_geometry_left_) do |name|
|
151
154
|
Vedeu::Move.by_name(Vedeu::Geometry, :left, name)
|
152
155
|
end
|
156
|
+
|
157
|
+
Vedeu.bind_alias(:_view_left_, :_geometry_left_)
|
153
158
|
end
|
154
159
|
|
155
160
|
# Move the geometry right by one character.
|
156
161
|
#
|
157
162
|
# @example
|
158
163
|
# Vedeu.trigger(:_geometry_right_, name)
|
164
|
+
# Vedeu.trigger(:_view_right_, name)
|
159
165
|
#
|
160
166
|
# @return [TrueClass]
|
161
167
|
# @see Vedeu::Move
|
@@ -163,12 +169,15 @@ module Vedeu
|
|
163
169
|
Vedeu.bind(:_geometry_right_) do |name|
|
164
170
|
Vedeu::Move.by_name(Vedeu::Geometry, :right, name)
|
165
171
|
end
|
172
|
+
|
173
|
+
Vedeu.bind_alias(:_view_right_, :_geometry_right_)
|
166
174
|
end
|
167
175
|
|
168
176
|
# Move the geometry up by one character.
|
169
177
|
#
|
170
178
|
# @example
|
171
179
|
# Vedeu.trigger(:_geometry_up_, name)
|
180
|
+
# Vedeu.trigger(:_view_up_, name)
|
172
181
|
#
|
173
182
|
# @return [TrueClass]
|
174
183
|
# @see Vedeu::Move
|
@@ -176,6 +185,8 @@ module Vedeu
|
|
176
185
|
Vedeu.bind(:_geometry_up_) do |name|
|
177
186
|
Vedeu::Move.by_name(Vedeu::Geometry, :up, name)
|
178
187
|
end
|
188
|
+
|
189
|
+
Vedeu.bind_alias(:_view_up_, :_geometry_up_)
|
179
190
|
end
|
180
191
|
|
181
192
|
end # Movement
|
@@ -55,17 +55,12 @@ module Vedeu
|
|
55
55
|
Vedeu::Cursor.hide_cursor(name)
|
56
56
|
end
|
57
57
|
|
58
|
-
|
59
|
-
Vedeu.bind(:_cursor_hide_) do |name|
|
60
|
-
Vedeu.trigger(:_hide_cursor_, name)
|
61
|
-
end
|
58
|
+
Vedeu.bind_alias(:_cursor_hide_, :_hide_cursor_)
|
62
59
|
end
|
63
60
|
|
64
61
|
# @see Vedeu::Group#hide
|
65
62
|
def hide_group!
|
66
|
-
Vedeu.bind(:_hide_group_)
|
67
|
-
Vedeu::Group.hide_group(name)
|
68
|
-
end
|
63
|
+
Vedeu.bind(:_hide_group_) { |name| Vedeu::Group.hide_group(name) }
|
69
64
|
end
|
70
65
|
|
71
66
|
# Hiding an interface.
|
@@ -95,17 +90,12 @@ module Vedeu
|
|
95
90
|
Vedeu::Cursor.show_cursor(name)
|
96
91
|
end
|
97
92
|
|
98
|
-
|
99
|
-
Vedeu.bind(:_cursor_show_) do |name|
|
100
|
-
Vedeu.trigger(:_show_cursor_, name)
|
101
|
-
end
|
93
|
+
Vedeu.bind_alias(:_cursor_show_, :_show_cursor_)
|
102
94
|
end
|
103
95
|
|
104
96
|
# @see Vedeu::Group#show
|
105
97
|
def show_group!
|
106
|
-
Vedeu.bind(:_show_group_)
|
107
|
-
Vedeu::Group.show_group(name)
|
108
|
-
end
|
98
|
+
Vedeu.bind(:_show_group_) { |name| Vedeu::Group.show_group(name) }
|
109
99
|
end
|
110
100
|
|
111
101
|
# Showing an interface.
|
data/lib/vedeu/bindings.rb
CHANGED
data/lib/vedeu/cursor/cursor.rb
CHANGED
@@ -99,7 +99,7 @@ module Vedeu
|
|
99
99
|
def hide
|
100
100
|
super
|
101
101
|
|
102
|
-
visibility
|
102
|
+
Vedeu::Output.render(visibility)
|
103
103
|
end
|
104
104
|
|
105
105
|
# Return the position of this cursor.
|
@@ -119,7 +119,7 @@ module Vedeu
|
|
119
119
|
def show
|
120
120
|
super
|
121
121
|
|
122
|
-
visibility
|
122
|
+
Vedeu::Output.render(visibility)
|
123
123
|
end
|
124
124
|
|
125
125
|
private
|
data/lib/vedeu/events/event.rb
CHANGED
@@ -0,0 +1,87 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Allows the storing of event aliases. Each alias can contain multiple event
|
4
|
+
# names.
|
5
|
+
#
|
6
|
+
module EventAliases
|
7
|
+
|
8
|
+
extend self
|
9
|
+
|
10
|
+
# @param alias_name [Symbol]
|
11
|
+
# @param event_name [Symbol]
|
12
|
+
# @return [Hash<Symbol => Array<Symbol>>]
|
13
|
+
def add(alias_name, event_name)
|
14
|
+
storage[alias_name] << event_name
|
15
|
+
end
|
16
|
+
alias_method :bind_alias, :add
|
17
|
+
|
18
|
+
# Return a boolean indicating whether the storage is empty.
|
19
|
+
#
|
20
|
+
# @return [Boolean]
|
21
|
+
def empty?
|
22
|
+
storage.empty?
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param alias_name [Symbol]
|
26
|
+
# @return [Array<Symbol>]
|
27
|
+
def find(alias_name)
|
28
|
+
storage[alias_name]
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns a boolean indicating whether the alias is registered.
|
32
|
+
#
|
33
|
+
# @param alias_name [Symbol]
|
34
|
+
# @return [Boolean]
|
35
|
+
def registered?(alias_name)
|
36
|
+
return false if alias_name.nil? || alias_name.empty?
|
37
|
+
return false if empty?
|
38
|
+
|
39
|
+
storage.include?(alias_name)
|
40
|
+
end
|
41
|
+
|
42
|
+
# @param alias_name [Symbol]
|
43
|
+
# @return [FalseClass|Hash<Symbol => Array<Symbol>>]
|
44
|
+
def remove(alias_name)
|
45
|
+
return false if empty?
|
46
|
+
return false unless registered?(alias_name)
|
47
|
+
|
48
|
+
storage.delete(alias_name)
|
49
|
+
storage
|
50
|
+
end
|
51
|
+
alias_method :unbind_alias, :remove
|
52
|
+
|
53
|
+
# @return [Hash<Symbol => Array<Symbol>>]
|
54
|
+
def reset
|
55
|
+
@storage = in_memory
|
56
|
+
end
|
57
|
+
alias_method :reset!, :reset
|
58
|
+
|
59
|
+
# Access to the storage for this repository.
|
60
|
+
#
|
61
|
+
# @return [Hash<Symbol => Array<Symbol>>]
|
62
|
+
def storage
|
63
|
+
@storage ||= in_memory
|
64
|
+
end
|
65
|
+
|
66
|
+
# @param alias_name [Symbol]
|
67
|
+
# @param args [void]
|
68
|
+
# @return [FalseClass|Array<void>|void]
|
69
|
+
def trigger(alias_name, *args)
|
70
|
+
return [] unless registered?(alias_name)
|
71
|
+
|
72
|
+
storage[alias_name].map do |event_name|
|
73
|
+
Vedeu.log(type: :debug, message: "#{event_name}")
|
74
|
+
Vedeu::Trigger.trigger(event_name, *args)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
# @return [Hash<Symbol => Array<Symbol>>]
|
81
|
+
def in_memory
|
82
|
+
Hash.new { |hash, key| hash[key] = [] }
|
83
|
+
end
|
84
|
+
|
85
|
+
end # EventAliases
|
86
|
+
|
87
|
+
end # Vedeu
|
data/lib/vedeu/events/trigger.rb
CHANGED
@@ -66,9 +66,17 @@ module Vedeu
|
|
66
66
|
#
|
67
67
|
# @return [Array|Array<Vedeu::Event>]
|
68
68
|
def registered_events
|
69
|
-
|
69
|
+
if repository.registered?(name)
|
70
|
+
repository.find(name)
|
70
71
|
|
71
|
-
|
72
|
+
else
|
73
|
+
Vedeu::EventAliases.find(name).map do |event_name|
|
74
|
+
Vedeu::Trigger.trigger(event_name, *args)
|
75
|
+
end
|
76
|
+
|
77
|
+
[]
|
78
|
+
|
79
|
+
end
|
72
80
|
end
|
73
81
|
|
74
82
|
end # Trigger
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Presentation
|
4
|
+
|
5
|
+
# Provides colour related presentation behaviour.
|
6
|
+
#
|
7
|
+
module Colour
|
8
|
+
|
9
|
+
# When the background colour for the model exists, return it, otherwise
|
10
|
+
# returns the parent background colour, or an empty Vedeu::Background.
|
11
|
+
#
|
12
|
+
# @return [Vedeu::Background]
|
13
|
+
def background
|
14
|
+
@background ||= if colour
|
15
|
+
colour.background
|
16
|
+
|
17
|
+
else
|
18
|
+
parent_background
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Allows the setting of the background colour by coercing the given value
|
24
|
+
# into a Vedeu::Background colour.
|
25
|
+
#
|
26
|
+
# @return [Vedeu::Background]
|
27
|
+
def background=(value)
|
28
|
+
self.colour = Vedeu::Colour.coerce(
|
29
|
+
background: Vedeu::Background.coerce(value),
|
30
|
+
foreground: colour.foreground)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Vedeu::Colour]
|
34
|
+
def colour
|
35
|
+
@colour ||= if attributes[:colour]
|
36
|
+
Vedeu::Colour.coerce(attributes[:colour])
|
37
|
+
|
38
|
+
elsif parent_colour
|
39
|
+
Vedeu::Colour.coerce(parent_colour)
|
40
|
+
|
41
|
+
else
|
42
|
+
Vedeu::Colour.new
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Allows the setting of the model's colour by coercing the given value
|
48
|
+
# into a Vedeu::Colour.
|
49
|
+
#
|
50
|
+
# @return [Vedeu::Colour]
|
51
|
+
def colour=(value)
|
52
|
+
@colour = attributes[:colour] = Vedeu::Colour.coerce(value)
|
53
|
+
end
|
54
|
+
|
55
|
+
# When the foreground colour for the model exists, return it, otherwise
|
56
|
+
# returns the parent foreground colour, or an empty Vedeu::Foreground.
|
57
|
+
#
|
58
|
+
# @return [Vedeu::Foreground]
|
59
|
+
def foreground
|
60
|
+
@foreground ||= if colour
|
61
|
+
colour.foreground
|
62
|
+
|
63
|
+
else
|
64
|
+
parent_foreground
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Allows the setting of the foreground colour by coercing the given value
|
70
|
+
# into a Vedeu::Foreground colour.
|
71
|
+
#
|
72
|
+
# @return [Vedeu::Foreground]
|
73
|
+
def foreground=(value)
|
74
|
+
self.colour = Vedeu::Colour.coerce(
|
75
|
+
foreground: Vedeu::Foreground.coerce(value),
|
76
|
+
background: colour.background)
|
77
|
+
end
|
78
|
+
|
79
|
+
# When a parent colour is available, returns the parent background colour,
|
80
|
+
# otherwise an empty Vedeu::Background.
|
81
|
+
#
|
82
|
+
# @return [Vedeu::Background]
|
83
|
+
def parent_background
|
84
|
+
if parent_colour
|
85
|
+
parent_colour.background
|
86
|
+
|
87
|
+
else
|
88
|
+
Vedeu::Background.new
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Returns the parent colour when available or NilClass.
|
94
|
+
#
|
95
|
+
# @return [String|NilClass]
|
96
|
+
def parent_colour
|
97
|
+
parent.colour if parent
|
98
|
+
end
|
99
|
+
|
100
|
+
# When a parent colour is available, returns the parent foreground colour,
|
101
|
+
# otherwise an empty Vedeu::Foreground.
|
102
|
+
#
|
103
|
+
# @return [Vedeu::Foreground]
|
104
|
+
def parent_foreground
|
105
|
+
if parent_colour
|
106
|
+
parent_colour.foreground
|
107
|
+
|
108
|
+
else
|
109
|
+
Vedeu::Foreground.new
|
110
|
+
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end # Colour
|
115
|
+
|
116
|
+
end # Presentation
|
117
|
+
|
118
|
+
end # Vedeu
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Presentation
|
4
|
+
|
5
|
+
# Provides style related presentation behaviour.
|
6
|
+
#
|
7
|
+
module Style
|
8
|
+
|
9
|
+
# Returns the parent style when available or NilClass.
|
10
|
+
#
|
11
|
+
# @return [String|NilClass]
|
12
|
+
def parent_style
|
13
|
+
if parent
|
14
|
+
parent.style
|
15
|
+
|
16
|
+
else
|
17
|
+
Vedeu::Style.new
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Vedeu::Style]
|
23
|
+
def style
|
24
|
+
@style ||= if attributes[:style]
|
25
|
+
Vedeu::Style.coerce(attributes[:style])
|
26
|
+
|
27
|
+
elsif parent_style
|
28
|
+
Vedeu::Style.coerce(parent_style)
|
29
|
+
|
30
|
+
else
|
31
|
+
Vedeu::Style.new
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Vedeu::Style]
|
37
|
+
def style=(value)
|
38
|
+
@style = Vedeu::Style.coerce(value)
|
39
|
+
end
|
40
|
+
|
41
|
+
end # Style
|
42
|
+
|
43
|
+
end # Presentation
|
44
|
+
|
45
|
+
end # Vedeu
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'vedeu/output/presentation/colour'
|
2
|
+
require 'vedeu/output/presentation/style'
|
3
|
+
|
1
4
|
module Vedeu
|
2
5
|
|
3
6
|
# This module allows the sharing of presentation concerns between the models:
|
@@ -5,142 +8,8 @@ module Vedeu
|
|
5
8
|
#
|
6
9
|
module Presentation
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
# @return [Vedeu::Background]
|
12
|
-
def background
|
13
|
-
@background ||= if colour
|
14
|
-
colour.background
|
15
|
-
|
16
|
-
else
|
17
|
-
parent_background
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# Allows the setting of the background colour by coercing the given value
|
23
|
-
# into a Vedeu::Background colour.
|
24
|
-
#
|
25
|
-
# @return [Vedeu::Background]
|
26
|
-
def background=(value)
|
27
|
-
self.colour = Vedeu::Colour.coerce(
|
28
|
-
background: Vedeu::Background.coerce(value),
|
29
|
-
foreground: colour.foreground)
|
30
|
-
end
|
31
|
-
|
32
|
-
# @return [Vedeu::Colour]
|
33
|
-
def colour
|
34
|
-
@colour ||= if attributes[:colour]
|
35
|
-
Vedeu::Colour.coerce(attributes[:colour])
|
36
|
-
|
37
|
-
elsif parent_colour
|
38
|
-
Vedeu::Colour.coerce(parent_colour)
|
39
|
-
|
40
|
-
else
|
41
|
-
Vedeu::Colour.new
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# Allows the setting of the model's colour by coercing the given value into
|
47
|
-
# a Vedeu::Colour.
|
48
|
-
#
|
49
|
-
# @return [Vedeu::Colour]
|
50
|
-
def colour=(value)
|
51
|
-
@colour = attributes[:colour] = Vedeu::Colour.coerce(value)
|
52
|
-
end
|
53
|
-
|
54
|
-
# When the foreground colour for the model exists, return it, otherwise
|
55
|
-
# returns the parent foreground colour, or an empty Vedeu::Foreground.
|
56
|
-
#
|
57
|
-
# @return [Vedeu::Foreground]
|
58
|
-
def foreground
|
59
|
-
@foreground ||= if colour
|
60
|
-
colour.foreground
|
61
|
-
|
62
|
-
else
|
63
|
-
parent_foreground
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# Allows the setting of the foreground colour by coercing the given value
|
69
|
-
# into a Vedeu::Foreground colour.
|
70
|
-
#
|
71
|
-
# @return [Vedeu::Foreground]
|
72
|
-
def foreground=(value)
|
73
|
-
self.colour = Vedeu::Colour.coerce(
|
74
|
-
foreground: Vedeu::Foreground.coerce(value),
|
75
|
-
background: colour.background)
|
76
|
-
end
|
77
|
-
|
78
|
-
# When a parent colour is available, returns the parent background colour,
|
79
|
-
# otherwise an empty Vedeu::Background.
|
80
|
-
#
|
81
|
-
# @return [Vedeu::Background]
|
82
|
-
def parent_background
|
83
|
-
if parent_colour
|
84
|
-
parent_colour.background
|
85
|
-
|
86
|
-
else
|
87
|
-
Vedeu::Background.new
|
88
|
-
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# Returns the parent colour when available or NilClass.
|
93
|
-
#
|
94
|
-
# @return [String|NilClass]
|
95
|
-
def parent_colour
|
96
|
-
parent.colour if parent
|
97
|
-
end
|
98
|
-
|
99
|
-
# When a parent colour is available, returns the parent foreground colour,
|
100
|
-
# otherwise an empty Vedeu::Foreground.
|
101
|
-
#
|
102
|
-
# @return [Vedeu::Foreground]
|
103
|
-
def parent_foreground
|
104
|
-
if parent_colour
|
105
|
-
parent_colour.foreground
|
106
|
-
|
107
|
-
else
|
108
|
-
Vedeu::Foreground.new
|
109
|
-
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
# Returns the parent style when available or NilClass.
|
114
|
-
#
|
115
|
-
# @return [String|NilClass]
|
116
|
-
def parent_style
|
117
|
-
if parent
|
118
|
-
parent.style
|
119
|
-
|
120
|
-
else
|
121
|
-
Vedeu::Style.new
|
122
|
-
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
# @return [Vedeu::Style]
|
127
|
-
def style
|
128
|
-
@style ||= if attributes[:style]
|
129
|
-
Vedeu::Style.coerce(attributes[:style])
|
130
|
-
|
131
|
-
elsif parent_style
|
132
|
-
Vedeu::Style.coerce(parent_style)
|
133
|
-
|
134
|
-
else
|
135
|
-
Vedeu::Style.new
|
136
|
-
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
# @return [Vedeu::Style]
|
141
|
-
def style=(value)
|
142
|
-
@style = Vedeu::Style.coerce(value)
|
143
|
-
end
|
11
|
+
include Vedeu::Presentation::Colour
|
12
|
+
include Vedeu::Presentation::Style
|
144
13
|
|
145
14
|
# Converts the colours and styles to escape sequences, and when the parent
|
146
15
|
# model has previously set the colour and style, reverts back to that for
|
data/lib/vedeu/version.rb
CHANGED
data/test/lib/vedeu/api_test.rb
CHANGED
@@ -20,8 +20,11 @@ module Vedeu
|
|
20
20
|
it { Vedeu.must_respond_to(:render) }
|
21
21
|
it { Vedeu.must_respond_to(:views) }
|
22
22
|
it { Vedeu.must_respond_to(:bind) }
|
23
|
+
it { Vedeu.must_respond_to(:bind_alias) }
|
23
24
|
it { Vedeu.must_respond_to(:bound?) }
|
24
25
|
it { Vedeu.must_respond_to(:unbind) }
|
26
|
+
it { Vedeu.must_respond_to(:unbind_alias) }
|
27
|
+
it { Vedeu.must_respond_to(:events) }
|
25
28
|
it { Vedeu.must_respond_to(:focus) }
|
26
29
|
it { Vedeu.must_respond_to(:focus_by_name) }
|
27
30
|
it { Vedeu.must_respond_to(:focussed?) }
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe EventAliases do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::EventAliases }
|
8
|
+
|
9
|
+
before do
|
10
|
+
Vedeu::EventAliases.reset
|
11
|
+
end
|
12
|
+
after do
|
13
|
+
Vedeu::Bindings.setup!
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.add' do
|
17
|
+
let(:alias_name) { :alias_test }
|
18
|
+
let(:event_name) { :event_test }
|
19
|
+
|
20
|
+
subject { described.add(alias_name, event_name) }
|
21
|
+
|
22
|
+
it { described.must_respond_to(:bind_alias) }
|
23
|
+
|
24
|
+
context 'when the alias is already registered' do
|
25
|
+
before { Vedeu::EventAliases.add(:alias_test, :event_test) }
|
26
|
+
|
27
|
+
it { subject.must_equal([:event_test, :event_test]) }
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when the alias is not already registered' do
|
31
|
+
it { subject.must_equal([:event_test]) }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '.empty?' do
|
36
|
+
subject { described.empty? }
|
37
|
+
|
38
|
+
context 'when no aliases are registered' do
|
39
|
+
before { Vedeu::EventAliases.reset }
|
40
|
+
|
41
|
+
it { subject.must_equal(true) }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when aliases are registered' do
|
45
|
+
before { Vedeu::EventAliases.add(:alias_test, :event_test) }
|
46
|
+
|
47
|
+
it { subject.must_equal(false) }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '.registered?' do
|
52
|
+
let(:alias_name) { :alias_test }
|
53
|
+
|
54
|
+
subject { described.registered?(alias_name) }
|
55
|
+
|
56
|
+
context 'when the alias is registered' do
|
57
|
+
before { Vedeu::EventAliases.add(:alias_test, :event_test) }
|
58
|
+
|
59
|
+
it { subject.must_equal(true) }
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when the alias is not registered' do
|
63
|
+
it { subject.must_equal(false) }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '.remove' do
|
68
|
+
let(:alias_name) { :alias_test }
|
69
|
+
|
70
|
+
before { Vedeu::EventAliases.reset }
|
71
|
+
|
72
|
+
subject { described.remove(alias_name) }
|
73
|
+
|
74
|
+
it { described.must_respond_to(:unbind_alias) }
|
75
|
+
|
76
|
+
context 'when no aliases are registered' do
|
77
|
+
it { subject.must_equal(false) }
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'when the alias is not registered' do
|
81
|
+
before { Vedeu::EventAliases.add(:other_alias_test, :event_test) }
|
82
|
+
|
83
|
+
it { subject.must_equal(false) }
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when the alias is registered' do
|
87
|
+
before { Vedeu::EventAliases.add(:alias_test, :event_test) }
|
88
|
+
|
89
|
+
it { subject.must_equal({}) }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '.reset' do
|
94
|
+
subject { described.reset }
|
95
|
+
|
96
|
+
it { described.must_respond_to(:reset!) }
|
97
|
+
|
98
|
+
it { subject.must_equal({}) }
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '.storage' do
|
102
|
+
before { Vedeu::EventAliases.reset }
|
103
|
+
|
104
|
+
subject { described.storage }
|
105
|
+
|
106
|
+
it { subject.must_equal({}) }
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '.trigger' do
|
110
|
+
let(:alias_name) {}
|
111
|
+
let(:args) {}
|
112
|
+
|
113
|
+
subject { described.trigger(alias_name, *args) }
|
114
|
+
end
|
115
|
+
|
116
|
+
end # EventAliases
|
117
|
+
|
118
|
+
end # Vedeu
|
@@ -0,0 +1,165 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
class ParentPresentationTestClass
|
6
|
+
include Vedeu::Presentation
|
7
|
+
|
8
|
+
def parent
|
9
|
+
nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def attributes
|
13
|
+
{
|
14
|
+
colour: { background: '#330000', foreground: '#00aadd' },
|
15
|
+
style: ['bold']
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PresentationTestClass
|
21
|
+
include Vedeu::Presentation
|
22
|
+
|
23
|
+
attr_reader :attributes
|
24
|
+
|
25
|
+
def initialize(attributes = {})
|
26
|
+
@attributes = attributes
|
27
|
+
end
|
28
|
+
|
29
|
+
def parent
|
30
|
+
Vedeu::ParentPresentationTestClass.new
|
31
|
+
end
|
32
|
+
|
33
|
+
end # PresentationTestClass
|
34
|
+
|
35
|
+
module Presentation
|
36
|
+
|
37
|
+
describe Colour do
|
38
|
+
|
39
|
+
let(:includer) { Vedeu::PresentationTestClass.new(attributes) }
|
40
|
+
let(:attributes) {
|
41
|
+
{
|
42
|
+
colour: { background: background, foreground: foreground },
|
43
|
+
style: ['bold']
|
44
|
+
}
|
45
|
+
}
|
46
|
+
let(:background) { '#000033' }
|
47
|
+
let(:foreground) { '#aadd00' }
|
48
|
+
|
49
|
+
describe '#background' do
|
50
|
+
subject { includer.background }
|
51
|
+
|
52
|
+
it { subject.must_be_instance_of(Vedeu::Background) }
|
53
|
+
it { subject.colour.must_equal('#000033') }
|
54
|
+
|
55
|
+
context 'no background value' do
|
56
|
+
let(:attributes) { {} }
|
57
|
+
let(:background) {}
|
58
|
+
|
59
|
+
it { subject.must_be_instance_of(Vedeu::Background) }
|
60
|
+
it { subject.colour.must_equal('#330000') }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe '#background=' do
|
65
|
+
subject { includer.background = '#987654' }
|
66
|
+
|
67
|
+
it {
|
68
|
+
includer.colour.background.colour.must_equal('#000033')
|
69
|
+
subject
|
70
|
+
includer.colour.background.colour.must_equal('#987654')
|
71
|
+
}
|
72
|
+
|
73
|
+
it { subject.must_equal('#987654') }
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#foreground' do
|
77
|
+
subject { includer.foreground }
|
78
|
+
|
79
|
+
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
80
|
+
it { subject.colour.must_equal('#aadd00') }
|
81
|
+
|
82
|
+
context 'no foreground value' do
|
83
|
+
let(:attributes) { {} }
|
84
|
+
let(:foreground) {}
|
85
|
+
|
86
|
+
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
87
|
+
it { subject.colour.must_equal('#00aadd') }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#foreground=' do
|
92
|
+
subject { includer.foreground = '#123456' }
|
93
|
+
|
94
|
+
it {
|
95
|
+
includer.colour.foreground.colour.must_equal('#aadd00')
|
96
|
+
subject
|
97
|
+
includer.colour.foreground.colour.must_equal('#123456')
|
98
|
+
}
|
99
|
+
|
100
|
+
it { subject.must_equal('#123456') }
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#parent_background' do
|
104
|
+
subject { includer.parent_background }
|
105
|
+
|
106
|
+
it { subject.must_be_instance_of(Vedeu::Background) }
|
107
|
+
it { subject.colour.must_equal('#330000') }
|
108
|
+
|
109
|
+
context 'when no parent colour is set' do
|
110
|
+
before { includer.stubs(:parent).returns(nil) }
|
111
|
+
|
112
|
+
it { subject.colour.must_equal('') }
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe '#parent_colour' do
|
117
|
+
subject { includer.parent_colour }
|
118
|
+
|
119
|
+
context 'when a parent is available' do
|
120
|
+
it { subject.must_be_instance_of(Vedeu::Colour) }
|
121
|
+
it { subject.background.must_be_instance_of(Vedeu::Background) }
|
122
|
+
it { subject.foreground.must_be_instance_of(Vedeu::Foreground) }
|
123
|
+
end
|
124
|
+
|
125
|
+
context 'when a parent is not available' do
|
126
|
+
before { includer.stubs(:parent).returns(nil) }
|
127
|
+
|
128
|
+
it { subject.must_equal(nil) }
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe '#parent_foreground' do
|
133
|
+
subject { includer.parent_foreground }
|
134
|
+
|
135
|
+
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
136
|
+
it { subject.colour.must_equal('#00aadd') }
|
137
|
+
|
138
|
+
context 'when no parent colour is set' do
|
139
|
+
before { includer.stubs(:parent).returns(nil) }
|
140
|
+
|
141
|
+
it { subject.colour.must_equal('') }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe '#colour' do
|
146
|
+
subject { includer.colour }
|
147
|
+
|
148
|
+
it { subject.must_be_instance_of(Vedeu::Colour) }
|
149
|
+
end
|
150
|
+
|
151
|
+
describe '#colour=' do
|
152
|
+
let(:colour) {
|
153
|
+
Vedeu::Colour.new(foreground: '#00ff00', background: '#000000')
|
154
|
+
}
|
155
|
+
|
156
|
+
subject { includer.colour = (colour) }
|
157
|
+
|
158
|
+
it { subject.must_be_instance_of(Vedeu::Colour) }
|
159
|
+
end
|
160
|
+
|
161
|
+
end # Colour
|
162
|
+
|
163
|
+
end # Presentation
|
164
|
+
|
165
|
+
end # Vedeu
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
class ParentPresentationTestClass
|
6
|
+
include Vedeu::Presentation
|
7
|
+
|
8
|
+
def parent
|
9
|
+
nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def attributes
|
13
|
+
{
|
14
|
+
colour: { background: '#330000', foreground: '#00aadd' },
|
15
|
+
style: ['bold']
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PresentationTestClass
|
21
|
+
include Vedeu::Presentation
|
22
|
+
|
23
|
+
attr_reader :attributes
|
24
|
+
|
25
|
+
def initialize(attributes = {})
|
26
|
+
@attributes = attributes
|
27
|
+
end
|
28
|
+
|
29
|
+
def parent
|
30
|
+
Vedeu::ParentPresentationTestClass.new
|
31
|
+
end
|
32
|
+
|
33
|
+
end # PresentationTestClass
|
34
|
+
|
35
|
+
module Presentation
|
36
|
+
|
37
|
+
describe Style do
|
38
|
+
|
39
|
+
let(:includer) { Vedeu::PresentationTestClass.new(attributes) }
|
40
|
+
let(:attributes) {
|
41
|
+
{
|
42
|
+
colour: { background: background, foreground: foreground },
|
43
|
+
style: ['bold']
|
44
|
+
}
|
45
|
+
}
|
46
|
+
let(:background) { '#000033' }
|
47
|
+
let(:foreground) { '#aadd00' }
|
48
|
+
|
49
|
+
describe '#parent_style' do
|
50
|
+
subject { includer.parent_style }
|
51
|
+
|
52
|
+
it { subject.must_be_instance_of(Vedeu::Style) }
|
53
|
+
|
54
|
+
context 'when a parent is available' do
|
55
|
+
it { subject.value.must_equal(['bold']) }
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'when a parent is not available' do
|
59
|
+
before { includer.stubs(:parent).returns(nil) }
|
60
|
+
|
61
|
+
it { subject.value.must_equal(nil) }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#style' do
|
66
|
+
subject { includer.style }
|
67
|
+
|
68
|
+
it { subject.must_be_instance_of(Vedeu::Style) }
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#style=' do
|
72
|
+
let(:style) { Vedeu::Style.new('normal') }
|
73
|
+
|
74
|
+
subject { includer.style = (style) }
|
75
|
+
|
76
|
+
it { subject.must_be_instance_of(Vedeu::Style) }
|
77
|
+
end
|
78
|
+
|
79
|
+
end # Style
|
80
|
+
|
81
|
+
end # Presentation
|
82
|
+
|
83
|
+
end # Vedeu
|
@@ -44,167 +44,27 @@ module Vedeu
|
|
44
44
|
let(:background) { '#000033' }
|
45
45
|
let(:foreground) { '#aadd00' }
|
46
46
|
|
47
|
-
describe '#background' do
|
48
|
-
subject { includer.background }
|
49
|
-
|
50
|
-
it { subject.must_be_instance_of(Vedeu::Background) }
|
51
|
-
it { subject.colour.must_equal('#000033') }
|
52
|
-
|
53
|
-
context 'no background value' do
|
54
|
-
let(:attributes) { {} }
|
55
|
-
let(:background) {}
|
56
|
-
|
57
|
-
it { subject.must_be_instance_of(Vedeu::Background) }
|
58
|
-
it { subject.colour.must_equal('#330000') }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe '#background=' do
|
63
|
-
subject { includer.background = '#987654' }
|
64
|
-
|
65
|
-
it {
|
66
|
-
includer.colour.background.colour.must_equal('#000033')
|
67
|
-
subject
|
68
|
-
includer.colour.background.colour.must_equal('#987654')
|
69
|
-
}
|
70
|
-
|
71
|
-
it { subject.must_equal('#987654') }
|
72
|
-
end
|
73
|
-
|
74
|
-
describe '#foreground' do
|
75
|
-
subject { includer.foreground }
|
76
|
-
|
77
|
-
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
78
|
-
it { subject.colour.must_equal('#aadd00') }
|
79
|
-
|
80
|
-
context 'no foreground value' do
|
81
|
-
let(:attributes) { {} }
|
82
|
-
let(:foreground) {}
|
83
|
-
|
84
|
-
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
85
|
-
it { subject.colour.must_equal('#00aadd') }
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe '#foreground=' do
|
90
|
-
subject { includer.foreground = '#123456' }
|
91
|
-
|
92
|
-
it {
|
93
|
-
includer.colour.foreground.colour.must_equal('#aadd00')
|
94
|
-
subject
|
95
|
-
includer.colour.foreground.colour.must_equal('#123456')
|
96
|
-
}
|
97
|
-
|
98
|
-
it { subject.must_equal('#123456') }
|
99
|
-
end
|
100
|
-
|
101
|
-
describe '#parent_background' do
|
102
|
-
subject { includer.parent_background }
|
103
|
-
|
104
|
-
it { subject.must_be_instance_of(Vedeu::Background) }
|
105
|
-
it { subject.colour.must_equal('#330000') }
|
106
|
-
|
107
|
-
context 'when no parent colour is set' do
|
108
|
-
before { includer.stubs(:parent).returns(nil) }
|
109
|
-
|
110
|
-
it { subject.colour.must_equal('') }
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe '#parent_colour' do
|
115
|
-
subject { includer.parent_colour }
|
116
|
-
|
117
|
-
context 'when a parent is available' do
|
118
|
-
it { subject.must_be_instance_of(Vedeu::Colour) }
|
119
|
-
it { subject.background.must_be_instance_of(Vedeu::Background) }
|
120
|
-
it { subject.foreground.must_be_instance_of(Vedeu::Foreground) }
|
121
|
-
end
|
122
|
-
|
123
|
-
context 'when a parent is not available' do
|
124
|
-
before { includer.stubs(:parent).returns(nil) }
|
125
|
-
|
126
|
-
it { subject.must_equal(nil) }
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe '#parent_foreground' do
|
131
|
-
subject { includer.parent_foreground }
|
132
|
-
|
133
|
-
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
134
|
-
it { subject.colour.must_equal('#00aadd') }
|
135
|
-
|
136
|
-
context 'when no parent colour is set' do
|
137
|
-
before { includer.stubs(:parent).returns(nil) }
|
138
|
-
|
139
|
-
it { subject.colour.must_equal('') }
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe '#colour' do
|
144
|
-
subject { includer.colour }
|
145
|
-
|
146
|
-
it { subject.must_be_instance_of(Vedeu::Colour) }
|
147
|
-
end
|
148
|
-
|
149
|
-
describe '#colour=' do
|
150
|
-
let(:colour) { Colour.new(foreground: '#00ff00', background: '#000000') }
|
151
|
-
|
152
|
-
subject { includer.colour = (colour) }
|
153
|
-
|
154
|
-
it { subject.must_be_instance_of(Colour) }
|
155
|
-
end
|
156
|
-
|
157
|
-
describe '#parent_style' do
|
158
|
-
subject { includer.parent_style }
|
159
|
-
|
160
|
-
it { subject.must_be_instance_of(Vedeu::Style) }
|
161
|
-
|
162
|
-
context 'when a parent is available' do
|
163
|
-
it { subject.value.must_equal(['bold']) }
|
164
|
-
end
|
165
|
-
|
166
|
-
context 'when a parent is not available' do
|
167
|
-
before { includer.stubs(:parent).returns(nil) }
|
168
|
-
|
169
|
-
it { subject.value.must_equal(nil) }
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
describe '#style' do
|
174
|
-
subject { includer.style }
|
175
|
-
|
176
|
-
it { subject.must_be_instance_of(Vedeu::Style) }
|
177
|
-
end
|
178
|
-
|
179
|
-
describe '#style=' do
|
180
|
-
let(:style) { Style.new('normal') }
|
181
|
-
|
182
|
-
subject { includer.style = (style) }
|
183
|
-
|
184
|
-
it { subject.must_be_instance_of(Style) }
|
185
|
-
end
|
186
|
-
|
187
47
|
describe '#to_s' do
|
188
48
|
let(:line) {
|
189
49
|
Vedeu::Line.new(streams: [],
|
190
50
|
parent: Vedeu::Interface.new,
|
191
51
|
colour: line_colour,
|
192
|
-
style: Style.new('normal'))
|
52
|
+
style: Vedeu::Style.new('normal'))
|
193
53
|
}
|
194
54
|
let(:line_colour) {
|
195
|
-
Colour.new(foreground: '#00ff00', background: '#000000')
|
55
|
+
Vedeu::Colour.new(foreground: '#00ff00', background: '#000000')
|
196
56
|
}
|
197
57
|
let(:stream) {
|
198
|
-
Stream.new(value: stream_value,
|
58
|
+
Vedeu::Stream.new(value: stream_value,
|
199
59
|
parent: line,
|
200
60
|
colour: stream_colour,
|
201
61
|
style: stream_style)
|
202
62
|
}
|
203
63
|
let(:stream_value) { 'Some text' }
|
204
64
|
let(:stream_colour) {
|
205
|
-
Colour.new(foreground: '#ff0000', background: '#000000')
|
65
|
+
Vedeu::Colour.new(foreground: '#ff0000', background: '#000000')
|
206
66
|
}
|
207
|
-
let(:stream_style) { Style.new(:underline) }
|
67
|
+
let(:stream_style) { Vedeu::Style.new(:underline) }
|
208
68
|
|
209
69
|
it { includer.must_respond_to(:to_str) }
|
210
70
|
|
@@ -49,7 +49,7 @@ module Vedeu
|
|
49
49
|
context 'when no renderers are defined' do
|
50
50
|
let(:renderers) {}
|
51
51
|
|
52
|
-
it { subject.must_equal(
|
52
|
+
it { subject.must_equal(output) }
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -64,12 +64,22 @@ module Vedeu
|
|
64
64
|
|
65
65
|
subject { described.render(output) }
|
66
66
|
|
67
|
-
it { subject.must_be_instance_of(Array) }
|
67
|
+
# it { subject.must_be_instance_of(Array) }
|
68
68
|
|
69
69
|
it {
|
70
70
|
DummyRenderer.expects(:render).with(output)
|
71
71
|
subject
|
72
72
|
}
|
73
|
+
|
74
|
+
context 'when there is content' do
|
75
|
+
let(:output) { Vedeu::Escape.new(Vedeu::Esc.hide_cursor) }
|
76
|
+
|
77
|
+
it { subject.must_be_instance_of(Vedeu::Escape) }
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'when there is no content' do
|
81
|
+
it { subject.must_be_instance_of(NilClass) }
|
82
|
+
end
|
73
83
|
end
|
74
84
|
|
75
85
|
describe '.renderer' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vedeu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
@@ -351,6 +351,7 @@ files:
|
|
351
351
|
- lib/vedeu/dsl/use.rb
|
352
352
|
- lib/vedeu/dsl/view.rb
|
353
353
|
- lib/vedeu/events/event.rb
|
354
|
+
- lib/vedeu/events/event_aliases.rb
|
354
355
|
- lib/vedeu/events/event_collection.rb
|
355
356
|
- lib/vedeu/events/events.rb
|
356
357
|
- lib/vedeu/events/trigger.rb
|
@@ -407,6 +408,8 @@ files:
|
|
407
408
|
- lib/vedeu/output/html_char.rb
|
408
409
|
- lib/vedeu/output/output.rb
|
409
410
|
- lib/vedeu/output/presentation.rb
|
411
|
+
- lib/vedeu/output/presentation/colour.rb
|
412
|
+
- lib/vedeu/output/presentation/style.rb
|
410
413
|
- lib/vedeu/output/refresh.rb
|
411
414
|
- lib/vedeu/output/refresh_group.rb
|
412
415
|
- lib/vedeu/output/renderers.rb
|
@@ -507,6 +510,7 @@ files:
|
|
507
510
|
- test/lib/vedeu/dsl/text_test.rb
|
508
511
|
- test/lib/vedeu/dsl/use_test.rb
|
509
512
|
- test/lib/vedeu/dsl/view_test.rb
|
513
|
+
- test/lib/vedeu/events/event_aliases_test.rb
|
510
514
|
- test/lib/vedeu/events/event_collection_test.rb
|
511
515
|
- test/lib/vedeu/events/event_test.rb
|
512
516
|
- test/lib/vedeu/events/events_test.rb
|
@@ -562,6 +566,8 @@ files:
|
|
562
566
|
- test/lib/vedeu/output/esc_test.rb
|
563
567
|
- test/lib/vedeu/output/html_char_test.rb
|
564
568
|
- test/lib/vedeu/output/output_test.rb
|
569
|
+
- test/lib/vedeu/output/presentation/colour_test.rb
|
570
|
+
- test/lib/vedeu/output/presentation/style_test.rb
|
565
571
|
- test/lib/vedeu/output/presentation_test.rb
|
566
572
|
- test/lib/vedeu/output/refresh_group_test.rb
|
567
573
|
- test/lib/vedeu/output/refresh_test.rb
|
@@ -692,6 +698,7 @@ test_files:
|
|
692
698
|
- test/lib/vedeu/dsl/text_test.rb
|
693
699
|
- test/lib/vedeu/dsl/use_test.rb
|
694
700
|
- test/lib/vedeu/dsl/view_test.rb
|
701
|
+
- test/lib/vedeu/events/event_aliases_test.rb
|
695
702
|
- test/lib/vedeu/events/event_collection_test.rb
|
696
703
|
- test/lib/vedeu/events/event_test.rb
|
697
704
|
- test/lib/vedeu/events/events_test.rb
|
@@ -747,6 +754,8 @@ test_files:
|
|
747
754
|
- test/lib/vedeu/output/esc_test.rb
|
748
755
|
- test/lib/vedeu/output/html_char_test.rb
|
749
756
|
- test/lib/vedeu/output/output_test.rb
|
757
|
+
- test/lib/vedeu/output/presentation/colour_test.rb
|
758
|
+
- test/lib/vedeu/output/presentation/style_test.rb
|
750
759
|
- test/lib/vedeu/output/presentation_test.rb
|
751
760
|
- test/lib/vedeu/output/refresh_group_test.rb
|
752
761
|
- test/lib/vedeu/output/refresh_test.rb
|