uh-layout 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uh/layout/column.rb +5 -1
- data/lib/uh/layout/container.rb +5 -0
- data/lib/uh/layout/version.rb +1 -1
- data/lib/uh/layout.rb +1 -0
- data/spec/uh/layout/column_spec.rb +11 -4
- data/spec/uh/layout/container_spec.rb +19 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edf8a87089f0c32d03e6e00cbc1bc40a93c84011
|
4
|
+
data.tar.gz: a1d22d1bdb126e9a699e0ca2fe8c343e569ccc32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0cd253e73d437556eea6d053607a4f10d04b7f82d2c9cf13a6d985f44b2f346464de146bdc8f261d26196367ff5411abd725761eca691444bee1482e6c18180
|
7
|
+
data.tar.gz: f39cab274b9a47ac3a26a71dd736432bab091b3f425b9781f5aaaeceacbb08b490b49ea99c049bc4c3e234a2094ea8ef9d0b98c0a6ebc68220d7159c18537aee
|
data/lib/uh/layout/column.rb
CHANGED
data/lib/uh/layout/container.rb
CHANGED
@@ -23,6 +23,11 @@ module Uh
|
|
23
23
|
@current_index = @entries.index entry
|
24
24
|
end
|
25
25
|
|
26
|
+
def insert_after_current(entry)
|
27
|
+
fail RuntimeError, 'no current entry' unless current
|
28
|
+
@entries.insert @current_index + 1, entry
|
29
|
+
end
|
30
|
+
|
26
31
|
def remove(entry)
|
27
32
|
fail ArgumentError, 'unknown entry' unless include? entry
|
28
33
|
@entries.delete_at @entries.index entry
|
data/lib/uh/layout/version.rb
CHANGED
data/lib/uh/layout.rb
CHANGED
@@ -22,14 +22,21 @@ module Uh
|
|
22
22
|
describe '#<<' do
|
23
23
|
before { column << client }
|
24
24
|
|
25
|
-
it 'assigns column geo copy to given client' do
|
26
|
-
expect(client.geo).to eq(column.geo).and not_be column.geo
|
27
|
-
end
|
28
|
-
|
29
25
|
it 'adds given client' do
|
30
26
|
expect(column.clients).to include client
|
31
27
|
end
|
32
28
|
|
29
|
+
it 'adds given client after current one' do
|
30
|
+
column << other_client
|
31
|
+
column.current_client = client
|
32
|
+
column << new_client = build_client
|
33
|
+
expect(column.clients.to_a).to eq [client, new_client, other_client]
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'assigns column geo copy to given client' do
|
37
|
+
expect(client.geo).to eq(column.geo).and not_be column.geo
|
38
|
+
end
|
39
|
+
|
33
40
|
it 'returns self' do
|
34
41
|
expect(column << client).to be column
|
35
42
|
end
|
@@ -56,6 +56,22 @@ module Uh
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
describe '#insert_after_current' do
|
60
|
+
it 'inserts given entry after current one' do
|
61
|
+
container.insert_after_current :baz
|
62
|
+
expect(container.entries).to eq %i[foo baz bar]
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when container has no entry' do
|
66
|
+
let(:entries) { [] }
|
67
|
+
|
68
|
+
it 'raises a RuntimeError' do
|
69
|
+
expect { container.insert_after_current :foo }
|
70
|
+
.to raise_error Layout::RuntimeError
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
59
75
|
describe '#remove' do
|
60
76
|
let(:entries) { %i[foo bar baz] }
|
61
77
|
|
@@ -140,7 +156,7 @@ module Uh
|
|
140
156
|
|
141
157
|
it 'swaps current entry with consecutive one in given direction' do
|
142
158
|
container.set :next
|
143
|
-
expect(container.
|
159
|
+
expect(container.entries).to eq %i[bar foo baz]
|
144
160
|
end
|
145
161
|
|
146
162
|
it 'does not change current entry' do
|
@@ -150,7 +166,7 @@ module Uh
|
|
150
166
|
context 'when direction is out of range' do
|
151
167
|
it 'rotates the entries' do
|
152
168
|
container.set :pred
|
153
|
-
expect(container.
|
169
|
+
expect(container.entries).to eq %i[bar baz foo]
|
154
170
|
end
|
155
171
|
|
156
172
|
it 'does not change current entry' do
|
@@ -162,7 +178,7 @@ module Uh
|
|
162
178
|
describe '#swap' do
|
163
179
|
it 'swaps entries matched by given indexes' do
|
164
180
|
container.swap 0, 1
|
165
|
-
expect(container.
|
181
|
+
expect(container.entries).to eq %i[bar foo]
|
166
182
|
end
|
167
183
|
end
|
168
184
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uh-layout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault Jouan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uh
|