vedeu 0.4.54 → 0.4.55
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu.rb +1 -1
- data/lib/vedeu/all.rb +5 -1
- data/lib/vedeu/api.rb +7 -3
- data/lib/vedeu/application/all.rb +6 -6
- data/lib/vedeu/application/application_controller.rb +1 -1
- data/lib/vedeu/application/application_helper.rb +1 -1
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/application/view.rb +10 -0
- data/lib/vedeu/bindings/all.rb +13 -5
- data/lib/vedeu/bootstrap.rb +0 -2
- data/lib/vedeu/buffers/all.rb +3 -2
- data/lib/vedeu/{repositories/repositories → buffers}/buffers.rb +1 -1
- data/lib/vedeu/cli/all.rb +1 -1
- data/lib/vedeu/cli/generator/helpers.rb +2 -2
- data/lib/vedeu/colours/all.rb +7 -0
- data/lib/vedeu/{output → colours}/background.rb +0 -0
- data/lib/vedeu/{repositories/repositories → colours}/backgrounds.rb +0 -0
- data/lib/vedeu/{output → colours}/colour.rb +0 -0
- data/lib/vedeu/{output → colours}/colour_translator.rb +0 -0
- data/lib/vedeu/{repositories/repositories → colours}/colours.rb +0 -0
- data/lib/vedeu/{output → colours}/foreground.rb +0 -0
- data/lib/vedeu/{repositories/repositories → colours}/foregrounds.rb +0 -0
- data/lib/vedeu/{support/common.rb → common.rb} +0 -0
- data/lib/vedeu/configuration/all.rb +3 -3
- data/lib/vedeu/cursor/all.rb +5 -4
- data/lib/vedeu/cursor/cursor.rb +1 -1
- data/lib/vedeu/{repositories/repositories → cursor}/cursors.rb +2 -19
- data/lib/vedeu/distributed/all.rb +5 -5
- data/lib/vedeu/distributed/test_application.rb +1 -1
- data/lib/vedeu/dsl/all.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +1 -1
- data/lib/vedeu/dsl/use.rb +1 -1
- data/lib/vedeu/events/all.rb +4 -3
- data/lib/vedeu/{repositories/repositories → events}/events.rb +0 -0
- data/lib/vedeu/geometry/all.rb +14 -9
- data/lib/vedeu/{repositories/repositories → geometry}/geometries.rb +0 -0
- data/lib/vedeu/input/all.rb +5 -4
- data/lib/vedeu/{repositories/repositories → input}/keymaps.rb +0 -0
- data/lib/vedeu/{support/log.rb → log.rb} +0 -0
- data/lib/vedeu/models/all.rb +14 -10
- data/lib/vedeu/models/group.rb +3 -3
- data/lib/vedeu/{repositories/repositories → models}/groups.rb +2 -16
- data/lib/vedeu/models/interface.rb +1 -1
- data/lib/vedeu/{repositories/repositories → models}/interfaces.rb +1 -1
- data/lib/vedeu/{repositories/repositories → models}/menus.rb +0 -0
- data/lib/vedeu/{support → models}/toggleable.rb +4 -4
- data/lib/vedeu/null/all.rb +5 -5
- data/lib/vedeu/null/border.rb +5 -3
- data/lib/vedeu/null/buffer.rb +5 -3
- data/lib/vedeu/null/generic.rb +6 -1
- data/lib/vedeu/null/geometry.rb +6 -4
- data/lib/vedeu/null/interface.rb +9 -10
- data/lib/vedeu/output/all.rb +21 -21
- data/lib/vedeu/{repositories/repositories → output}/borders.rb +0 -0
- data/lib/vedeu/output/clear/all.rb +2 -2
- data/lib/vedeu/output/html_char.rb +1 -1
- data/lib/vedeu/output/presentation.rb +25 -0
- data/lib/vedeu/output/refresh.rb +1 -1
- data/lib/vedeu/output/refresh_group.rb +5 -3
- data/lib/vedeu/output/renderers/all.rb +8 -8
- data/lib/vedeu/output/renderers/html.rb +2 -2
- data/lib/vedeu/repositories/all.rb +5 -7
- data/lib/vedeu/repositories/collection.rb +42 -0
- data/lib/vedeu/repositories/model.rb +2 -2
- data/lib/vedeu/repositories/repository.rb +11 -2
- data/lib/vedeu/templating/all.rb +4 -3
- data/lib/vedeu/templating/template.rb +75 -0
- data/lib/vedeu/{support/terminal.rb → terminal.rb} +0 -0
- data/lib/vedeu/{support/timer.rb → timer.rb} +0 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/view_test.rb +11 -1
- data/test/lib/vedeu/bootstrap_test.rb +5 -5
- data/test/lib/vedeu/{repositories/repositories → buffers}/buffers_test.rb +0 -0
- data/test/lib/vedeu/cli/generator/helpers_test.rb +1 -1
- data/test/lib/vedeu/{output → colours}/background_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → colours}/backgrounds_test.rb +0 -0
- data/test/lib/vedeu/{output → colours}/colour_test.rb +0 -0
- data/test/lib/vedeu/{output → colours}/colour_translator_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → colours}/colours_test.rb +0 -0
- data/test/lib/vedeu/{output → colours}/foreground_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → colours}/foregrounds_test.rb +0 -0
- data/test/lib/vedeu/{support/common_test.rb → common_test.rb} +0 -0
- data/test/lib/vedeu/{repositories/repositories → cursor}/cursors_test.rb +0 -21
- data/test/lib/vedeu/dsl/composition_test.rb +1 -1
- data/test/lib/vedeu/dsl/use_test.rb +9 -0
- data/test/lib/vedeu/{repositories/repositories → events}/events_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → geometry}/geometries_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → input}/keymaps_test.rb +0 -0
- data/test/lib/vedeu/{support/log_test.rb → log_test.rb} +0 -0
- data/test/lib/vedeu/models/groups_test.rb +21 -0
- data/test/lib/vedeu/{repositories/repositories → models}/interfaces_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → models}/menus_test.rb +0 -0
- data/test/lib/vedeu/{support → models}/toggleable_test.rb +0 -0
- data/test/lib/vedeu/null/border_test.rb +9 -1
- data/test/lib/vedeu/null/buffer_test.rb +9 -1
- data/test/lib/vedeu/null/generic_test.rb +10 -1
- data/test/lib/vedeu/null/geometry_test.rb +9 -1
- data/test/lib/vedeu/null/interface_test.rb +11 -8
- data/test/lib/vedeu/{repositories/repositories → output}/borders_test.rb +0 -0
- data/test/lib/vedeu/output/compressor_test.rb +47 -2
- data/test/lib/vedeu/output/refresh_group_test.rb +5 -5
- data/test/lib/vedeu/output/refresh_test.rb +1 -1
- data/test/lib/vedeu/repositories/collection_test.rb +78 -0
- data/test/lib/vedeu/repositories/repository_test.rb +8 -3
- data/test/lib/vedeu/templating/template_test.rb +46 -0
- data/test/lib/vedeu/{support/terminal_test.rb → terminal_test.rb} +0 -0
- data/test/lib/vedeu/{support/timer_test.rb → timer_test.rb} +0 -0
- data/test/support/all_seeds.sh +9 -0
- data/test/support/templates/inline.erb +1 -0
- data/test/test_helper.rb +7 -1
- metadata +74 -78
- data/lib/vedeu/output/view_helpers/all.rb +0 -5
- data/lib/vedeu/output/view_helpers/view_helpers.rb +0 -21
- data/lib/vedeu/repositories/collections/all.rb +0 -47
- data/lib/vedeu/repositories/repositories/all.rb +0 -14
- data/lib/vedeu/support/all.rb +0 -5
- data/lib/vedeu/support/template.rb +0 -73
- data/test/lib/vedeu/output/view_helpers/view_helpers_test.rb +0 -30
- data/test/lib/vedeu/repositories/collections/all_test.rb +0 -83
- data/test/lib/vedeu/repositories/repositories/groups_test.rb +0 -35
- data/test/lib/vedeu/support/template_test.rb +0 -44
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'vedeu/
|
1
|
+
require 'vedeu/common'
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
@@ -52,14 +52,23 @@ module Vedeu
|
|
52
52
|
|
53
53
|
# Return the named model or a null object if not registered.
|
54
54
|
#
|
55
|
+
# @example
|
56
|
+
# Vedeu.cursors.by_name('some_name') # => Fetch the cursor belonging to
|
57
|
+
# the interface of the same name.
|
58
|
+
#
|
59
|
+
# Vedeu.groups.by_name(name) # => Fetch the names of the interfaces
|
60
|
+
# belonging to this group.
|
61
|
+
#
|
55
62
|
# @param name [String] The name of the stored model.
|
56
63
|
# @return [void]
|
57
64
|
def by_name(name)
|
65
|
+
name ||= Vedeu.focus
|
66
|
+
|
58
67
|
if registered?(name)
|
59
68
|
find(name)
|
60
69
|
|
61
70
|
else
|
62
|
-
null_model.new(name)
|
71
|
+
null_model.new(name: name)
|
63
72
|
|
64
73
|
end
|
65
74
|
end
|
data/lib/vedeu/templating/all.rb
CHANGED
@@ -7,6 +7,7 @@ module Vedeu
|
|
7
7
|
|
8
8
|
end # Vedeu
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
require 'vedeu/templating/helpers'
|
11
|
+
require 'vedeu/templating/directive'
|
12
|
+
require 'vedeu/templating/preprocessor'
|
13
|
+
require 'vedeu/templating/template'
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'vedeu/templating/preprocessor'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Templating
|
6
|
+
|
7
|
+
# Generic class to loading a template and parsing it via ERb.
|
8
|
+
#
|
9
|
+
# @api private
|
10
|
+
class Template
|
11
|
+
|
12
|
+
# @param (see Vedeu::Templating::Template#new)
|
13
|
+
# @return [void]
|
14
|
+
def self.parse(object, path, options = {})
|
15
|
+
new(object, path, options).parse
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns a new instance of Vedeu::Templating::Template.
|
19
|
+
#
|
20
|
+
# @param object [Class]
|
21
|
+
# @param path [String]
|
22
|
+
# @param options [Hash]
|
23
|
+
# @option options name [String] The name of an interface.
|
24
|
+
# @return [Vedeu::Templating::Template]
|
25
|
+
def initialize(object, path, options = {})
|
26
|
+
@object = object
|
27
|
+
@path = path.to_s
|
28
|
+
@options = options || {}
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [void]
|
32
|
+
def parse
|
33
|
+
ERB.new(load, nil, '-').result(binding)
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
|
38
|
+
# @!attribute [r] object
|
39
|
+
# @return [Class]
|
40
|
+
attr_reader :object
|
41
|
+
|
42
|
+
# @!attribute [r] options
|
43
|
+
# @return [Hash]
|
44
|
+
attr_reader :options
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
# @return [String]
|
49
|
+
def preprocess
|
50
|
+
Vedeu::Templating::Preprocessor.process(load)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [String]
|
54
|
+
def load
|
55
|
+
File.read(path)
|
56
|
+
end
|
57
|
+
|
58
|
+
# @raise [MissingRequired] when the path is empty.
|
59
|
+
# @raise [MissingRequired] when the path does not exist.
|
60
|
+
# @return [String]
|
61
|
+
def path
|
62
|
+
fail MissingRequired, 'No path to template specified.' if @path.empty?
|
63
|
+
|
64
|
+
unless File.exist?(@path)
|
65
|
+
fail MissingRequired, "Template file cannot be found. (#{@path})"
|
66
|
+
end
|
67
|
+
|
68
|
+
@path
|
69
|
+
end
|
70
|
+
|
71
|
+
end # Template
|
72
|
+
|
73
|
+
end # Templating
|
74
|
+
|
75
|
+
end # Vedeu
|
File without changes
|
File without changes
|
data/lib/vedeu/version.rb
CHANGED
@@ -13,7 +13,17 @@ module Vedeu
|
|
13
13
|
let(:described) { Vedeu::ViewTestClass }
|
14
14
|
let(:instance) { described.new }
|
15
15
|
|
16
|
-
#
|
16
|
+
describe '#time_now' do
|
17
|
+
let(:_time) { Time.new(2015, 6, 23, 22, 25, 17) }
|
18
|
+
|
19
|
+
before { Time.stubs(:now).returns(_time) }
|
20
|
+
|
21
|
+
subject { instance.time_now }
|
22
|
+
|
23
|
+
it 'returns a formatted time' do
|
24
|
+
subject.must_equal('Tue 23 Jun 22:25')
|
25
|
+
end
|
26
|
+
end
|
17
27
|
|
18
28
|
end # View
|
19
29
|
|
@@ -18,11 +18,7 @@ module Vedeu
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '.start' do
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#start' do
|
25
|
-
subject { instance.start }
|
21
|
+
subject { described.start(argv, entry_point) }
|
26
22
|
|
27
23
|
it {
|
28
24
|
Vedeu::Launcher.expects(:execute!)
|
@@ -30,6 +26,10 @@ module Vedeu
|
|
30
26
|
}
|
31
27
|
end
|
32
28
|
|
29
|
+
describe '#start' do
|
30
|
+
it { instance.must_respond_to(:start) }
|
31
|
+
end
|
32
|
+
|
33
33
|
end # Bootstrap
|
34
34
|
|
35
35
|
end # Vedeu
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -30,27 +30,6 @@ module Vedeu
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
describe '#by_name' do
|
34
|
-
let(:_name) { 'carbon' }
|
35
|
-
|
36
|
-
subject { described.cursors.by_name(_name) }
|
37
|
-
|
38
|
-
context 'when the cursor exists' do
|
39
|
-
before { Vedeu::Cursor.new(name: _name).store }
|
40
|
-
after { Vedeu.cursors.reset }
|
41
|
-
|
42
|
-
it { subject.must_be_instance_of(Vedeu::Cursor) }
|
43
|
-
it { subject.name.must_equal('carbon') }
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'when the cursor does not exist' do
|
47
|
-
let(:_name) { 'nitrogen' }
|
48
|
-
|
49
|
-
it { subject.must_be_instance_of(Vedeu::Cursor) }
|
50
|
-
it { subject.name.must_equal('nitrogen') }
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
33
|
end # Cursors
|
55
34
|
|
56
35
|
end # Vedeu
|
@@ -4,8 +4,17 @@ module Vedeu
|
|
4
4
|
|
5
5
|
module DSL
|
6
6
|
|
7
|
+
class TestUseClass
|
8
|
+
|
9
|
+
include Vedeu::DSL::Use
|
10
|
+
|
11
|
+
end
|
12
|
+
|
7
13
|
describe Use do
|
8
14
|
|
15
|
+
let(:described) { Vedeu::DSL::Use }
|
16
|
+
let(:model_instance) { Vedeu::DSL::TestUseClass }
|
17
|
+
|
9
18
|
# before do
|
10
19
|
# Vedeu.interfaces.reset
|
11
20
|
# Vedeu.interface('hydrogen') do
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Groups do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Groups }
|
8
|
+
|
9
|
+
it { described.must_respond_to(:groups) }
|
10
|
+
|
11
|
+
describe '#by_name' do
|
12
|
+
let(:_name) { 'carbon' }
|
13
|
+
|
14
|
+
subject { described.groups.by_name(_name) }
|
15
|
+
|
16
|
+
it { subject.must_be_instance_of(Vedeu::Group) }
|
17
|
+
end
|
18
|
+
|
19
|
+
end # Groups
|
20
|
+
|
21
|
+
end # Vedeu
|
File without changes
|
File without changes
|
File without changes
|
@@ -7,7 +7,12 @@ module Vedeu
|
|
7
7
|
describe Border do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::Null::Border }
|
10
|
-
let(:instance) { described.new(
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes){
|
12
|
+
{
|
13
|
+
name: _name
|
14
|
+
}
|
15
|
+
}
|
11
16
|
let(:_name) { 'null_border' }
|
12
17
|
let(:geometry) {
|
13
18
|
Vedeu::Geometry.new(name: _name, x: 4, y: 6, xn: 10, yn: 12)
|
@@ -17,6 +22,9 @@ module Vedeu
|
|
17
22
|
|
18
23
|
describe '#initialize' do
|
19
24
|
it { instance.must_be_instance_of(described) }
|
25
|
+
it {
|
26
|
+
instance.instance_variable_get('@attributes').must_equal(attributes)
|
27
|
+
}
|
20
28
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
21
29
|
end
|
22
30
|
|
@@ -7,11 +7,19 @@ module Vedeu
|
|
7
7
|
describe Buffer do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::Null::Buffer }
|
10
|
-
let(:instance) { described.new(
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes){
|
12
|
+
{
|
13
|
+
name: _name
|
14
|
+
}
|
15
|
+
}
|
11
16
|
let(:_name) { 'null_buffer' }
|
12
17
|
|
13
18
|
describe '#initialize' do
|
14
19
|
it { instance.must_be_instance_of(described) }
|
20
|
+
it {
|
21
|
+
instance.instance_variable_get('@attributes').must_equal(attributes)
|
22
|
+
}
|
15
23
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
16
24
|
end
|
17
25
|
|
@@ -7,7 +7,13 @@ module Vedeu
|
|
7
7
|
describe Generic do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::Null::Generic }
|
10
|
-
let(:instance) { described.new }
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes){
|
12
|
+
{
|
13
|
+
name: _name
|
14
|
+
}
|
15
|
+
}
|
16
|
+
let(:_name) { 'null_generic' }
|
11
17
|
|
12
18
|
describe 'alias methods' do
|
13
19
|
it { instance.must_respond_to(:visible?) }
|
@@ -15,6 +21,9 @@ module Vedeu
|
|
15
21
|
|
16
22
|
describe '#initialize' do
|
17
23
|
it { instance.must_be_instance_of(described) }
|
24
|
+
it {
|
25
|
+
instance.instance_variable_get('@attributes').must_equal(attributes)
|
26
|
+
}
|
18
27
|
end
|
19
28
|
|
20
29
|
describe '#add' do
|
@@ -7,7 +7,12 @@ module Vedeu
|
|
7
7
|
describe Geometry do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::Null::Geometry }
|
10
|
-
let(:instance) { described.new(
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes){
|
12
|
+
{
|
13
|
+
name: _name
|
14
|
+
}
|
15
|
+
}
|
11
16
|
let(:_name) { 'null_geometry' }
|
12
17
|
|
13
18
|
before do
|
@@ -17,6 +22,9 @@ module Vedeu
|
|
17
22
|
|
18
23
|
describe '#initialize' do
|
19
24
|
it { instance.must_be_instance_of(described) }
|
25
|
+
it {
|
26
|
+
instance.instance_variable_get('@attributes').must_equal(attributes)
|
27
|
+
}
|
20
28
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
21
29
|
end
|
22
30
|
|
@@ -7,22 +7,25 @@ module Vedeu
|
|
7
7
|
describe Interface do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::Null::Interface }
|
10
|
-
let(:instance) { described.new(
|
11
|
-
let(:
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes){
|
12
|
+
{
|
13
|
+
name: _name
|
14
|
+
}
|
15
|
+
}
|
16
|
+
let(:_name) { 'null_interface' }
|
12
17
|
|
13
18
|
describe '#initialize' do
|
14
19
|
it { instance.must_be_instance_of(described) }
|
20
|
+
it {
|
21
|
+
instance.instance_variable_get('@attributes').must_equal(attributes)
|
22
|
+
}
|
15
23
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
16
24
|
end
|
17
25
|
|
18
26
|
describe 'accessors' do
|
19
27
|
it { instance.must_respond_to(:name) }
|
20
|
-
|
21
|
-
|
22
|
-
describe '#attributes' do
|
23
|
-
subject { instance.attributes }
|
24
|
-
|
25
|
-
it { subject.must_be_instance_of(Hash) }
|
28
|
+
it { instance.must_respond_to(:attributes) }
|
26
29
|
end
|
27
30
|
|
28
31
|
describe '#hide' do
|
File without changes
|
@@ -25,6 +25,8 @@ module Vedeu
|
|
25
25
|
it { subject.must_be_instance_of(String) }
|
26
26
|
|
27
27
|
context 'when compression is enabled' do
|
28
|
+
before { Vedeu.configure { compression(true) } }
|
29
|
+
|
28
30
|
context 'when the output is all Vedeu::Char elements' do
|
29
31
|
let(:output) {
|
30
32
|
[
|
@@ -67,8 +69,51 @@ module Vedeu
|
|
67
69
|
end
|
68
70
|
|
69
71
|
context 'when compression is not enabled' do
|
70
|
-
|
71
|
-
|
72
|
+
before { Vedeu.configure { compression(false) } }
|
73
|
+
|
74
|
+
context 'when the output is all Vedeu::Char elements' do
|
75
|
+
let(:output) {
|
76
|
+
[
|
77
|
+
Vedeu::Char.new(value: 'Y', colour: { foreground: '#ff0000' }),
|
78
|
+
Vedeu::Char.new(value: 'e', colour: { foreground: '#ff0000' }),
|
79
|
+
Vedeu::Char.new(value: 's', colour: { foreground: '#ff0000' }),
|
80
|
+
]
|
81
|
+
}
|
82
|
+
it 'converts the non-Vedeu::Char elements into String elements' do
|
83
|
+
subject.must_equal(
|
84
|
+
"\e[38;2;255;0;0mY\e[38;2;255;0;0me\e[38;2;255;0;0ms"
|
85
|
+
)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when the output is all Vedeu::Char elements' do
|
90
|
+
let(:output) {
|
91
|
+
[
|
92
|
+
Vedeu::Char.new(value: 'a', colour: { foreground: '#ff0000' }),
|
93
|
+
Vedeu::Char.new(value: 'b', colour: { foreground: '#ff0000' }),
|
94
|
+
Vedeu::Char.new(value: 'c', colour: { foreground: '#0000ff' }),
|
95
|
+
Vedeu::Char.new(value: 'd', colour: { foreground: '#0000ff' }),
|
96
|
+
]
|
97
|
+
}
|
98
|
+
it 'compresses multiple colours and styles where possible' do
|
99
|
+
subject.must_equal(
|
100
|
+
"\e[38;2;255;0;0ma\e[38;2;255;0;0mb\e[38;2;0;0;255mc\e[38;2;0;0;255md"
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'when the output is not all Vedeu::Char elements' do
|
106
|
+
let(:output) {
|
107
|
+
[
|
108
|
+
Vedeu::Char.new(value: 'N'),
|
109
|
+
Vedeu::EscapeChar.new("\e[?25l"),
|
110
|
+
Vedeu::Char.new(value: 't'),
|
111
|
+
]
|
112
|
+
}
|
113
|
+
it 'converts the non-Vedeu::Char elements into String elements' do
|
114
|
+
subject.must_equal("N\e[?25lt")
|
115
|
+
end
|
116
|
+
end
|
72
117
|
end
|
73
118
|
end
|
74
119
|
|