shoes-core 4.0.0.pre4 → 4.0.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +5 -0
- data/bin/shoes +1 -1
- data/bin/shoes-stub +1 -1
- data/ext/install/Rakefile +15 -5
- data/ext/install/shoes.bat +1 -1
- data/lib/shoes/animation.rb +2 -2
- data/lib/shoes/arc.rb +1 -0
- data/lib/shoes/builtin_methods.rb +5 -18
- data/lib/shoes/button.rb +1 -5
- data/lib/shoes/check_button.rb +1 -5
- data/lib/shoes/color.rb +5 -274
- data/lib/shoes/color/dsl.rb +166 -0
- data/lib/shoes/color/dsl_helpers.rb +84 -0
- data/lib/shoes/color/hex_converter.rb +32 -0
- data/lib/shoes/common/background_element.rb +5 -0
- data/lib/shoes/common/hover.rb +87 -0
- data/lib/shoes/common/initialization.rb +21 -8
- data/lib/shoes/common/remove.rb +2 -0
- data/lib/shoes/common/state.rb +17 -3
- data/lib/shoes/common/style.rb +8 -0
- data/lib/shoes/configuration.rb +18 -15
- data/lib/shoes/core/version.rb +1 -1
- data/lib/shoes/dimension.rb +6 -19
- data/lib/shoes/dimensions.rb +8 -0
- data/lib/shoes/download.rb +5 -3
- data/lib/shoes/dsl.rb +3 -3
- data/lib/shoes/image.rb +1 -0
- data/lib/shoes/image_pattern.rb +1 -1
- data/lib/shoes/input_box.rb +2 -5
- data/lib/shoes/internal_app.rb +13 -2
- data/lib/shoes/line.rb +1 -0
- data/lib/shoes/link.rb +8 -0
- data/lib/shoes/list_box.rb +2 -5
- data/lib/shoes/mock/check.rb +3 -0
- data/lib/shoes/mock/image.rb +6 -0
- data/lib/shoes/mock/progress.rb +6 -0
- data/lib/shoes/mock/radio.rb +3 -0
- data/lib/shoes/mock/sound.rb +1 -1
- data/lib/shoes/oval.rb +1 -0
- data/lib/shoes/packager.rb +1 -1
- data/lib/shoes/rect.rb +1 -0
- data/lib/shoes/shape.rb +4 -0
- data/lib/shoes/slot.rb +75 -38
- data/lib/shoes/slot_contents.rb +4 -0
- data/lib/shoes/sound.rb +3 -2
- data/lib/shoes/star.rb +1 -0
- data/lib/shoes/text_block.rb +18 -2
- data/lib/shoes/text_block_dimensions.rb +19 -3
- data/lib/shoes/timer.rb +2 -2
- data/lib/shoes/ui/picker.rb +4 -4
- data/lib/shoes/version.rb +1 -1
- data/shoes-core.gemspec +1 -1
- data/spec/shoes/animation_spec.rb +2 -2
- data/spec/shoes/app_spec.rb +6 -17
- data/spec/shoes/arc_spec.rb +2 -1
- data/spec/shoes/background_spec.rb +2 -2
- data/spec/shoes/border_spec.rb +2 -2
- data/spec/shoes/builtin_methods_spec.rb +68 -56
- data/spec/shoes/button_spec.rb +3 -3
- data/spec/shoes/check_spec.rb +3 -2
- data/spec/shoes/color_spec.rb +9 -3
- data/spec/shoes/common/remove_spec.rb +0 -1
- data/spec/shoes/common/rotate_spec.rb +13 -0
- data/spec/shoes/common/style_spec.rb +12 -3
- data/spec/shoes/configuration_spec.rb +18 -3
- data/spec/shoes/constants_spec.rb +1 -0
- data/spec/shoes/dialog_spec.rb +1 -3
- data/spec/shoes/dimension_spec.rb +33 -24
- data/spec/shoes/dimensions_spec.rb +21 -31
- data/spec/shoes/download_spec.rb +14 -3
- data/spec/shoes/flow_spec.rb +6 -7
- data/spec/shoes/font_spec.rb +2 -3
- data/spec/shoes/framework_learning_spec.rb +1 -2
- data/spec/shoes/gradient_spec.rb +1 -2
- data/spec/shoes/helpers/fake_absolute_element.rb +30 -0
- data/spec/shoes/helpers/sample17_helper.rb +0 -1
- data/spec/shoes/image_spec.rb +2 -1
- data/spec/shoes/input_box_spec.rb +2 -2
- data/spec/shoes/integration_spec.rb +0 -1
- data/spec/shoes/internal_app_spec.rb +4 -5
- data/spec/shoes/keypress_spec.rb +1 -1
- data/spec/shoes/keyrelease_spec.rb +1 -2
- data/spec/shoes/line_spec.rb +3 -2
- data/spec/shoes/link_spec.rb +26 -6
- data/spec/shoes/list_box_spec.rb +2 -2
- data/spec/shoes/oval_spec.rb +2 -1
- data/spec/shoes/packager_spec.rb +1 -1
- data/spec/shoes/point_spec.rb +1 -1
- data/spec/shoes/progress_spec.rb +1 -1
- data/spec/shoes/radio_spec.rb +1 -1
- data/spec/shoes/rect_spec.rb +2 -1
- data/spec/shoes/renamed_delegate_spec.rb +0 -1
- data/spec/shoes/shape_spec.rb +1 -1
- data/spec/shoes/shared_examples/common_methods.rb +1 -1
- data/spec/shoes/shared_examples/dsl/animate.rb +1 -1
- data/spec/shoes/shared_examples/dsl/background.rb +2 -2
- data/spec/shoes/shared_examples/dsl/rgb.rb +4 -2
- data/spec/shoes/shared_examples/dsl/star.rb +0 -1
- data/spec/shoes/shared_examples/dsl/style.rb +1 -1
- data/spec/shoes/shared_examples/dsl/text_elements.rb +2 -2
- data/spec/shoes/shared_examples/dsl/video.rb +1 -1
- data/spec/shoes/shared_examples/dsl_app_context.rb +4 -1
- data/spec/shoes/shared_examples/hover.rb +78 -0
- data/spec/shoes/shared_examples/slot.rb +34 -4
- data/spec/shoes/shared_examples/state.rb +9 -2
- data/spec/shoes/shared_examples/style.rb +0 -5
- data/spec/shoes/slot_spec.rb +11 -38
- data/spec/shoes/sound_spec.rb +3 -2
- data/spec/shoes/span_spec.rb +2 -2
- data/spec/shoes/spec_helper.rb +1 -1
- data/spec/shoes/stack_spec.rb +6 -6
- data/spec/shoes/star_spec.rb +2 -1
- data/spec/shoes/text_block_dimensions_spec.rb +3 -4
- data/spec/shoes/text_block_spec.rb +16 -11
- data/spec/shoes/ui/picker_spec.rb +5 -6
- data/spec/shoes/url_spec.rb +1 -2
- data/spec/shoes/widget_spec.rb +11 -3
- data/spec/shoes_spec.rb +1 -4
- data/spec/spec_helper.rb +2 -1
- metadata +16 -9
- data/bin/shoes-guard +0 -8
- data/lib/shoes/link_hover.rb +0 -5
- data/spec/shoes/shared_examples/hover_leave.rb +0 -11
data/spec/shoes/line_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Shoes::Line do
|
4
4
|
include_context "dsl app"
|
@@ -16,7 +16,8 @@ describe Shoes::Line do
|
|
16
16
|
let(:subject_with_style) { Shoes::Line.new(app, parent, Shoes::Point.new(left, top), Shoes::Point.new(300, 430), arg_styles) }
|
17
17
|
end
|
18
18
|
it_behaves_like "object with dimensions"
|
19
|
-
it_behaves_like
|
19
|
+
it_behaves_like "object with parent"
|
20
|
+
it_behaves_like "object with hover"
|
20
21
|
end
|
21
22
|
|
22
23
|
describe "line with point a at leftmost, topmost" do
|
data/spec/shoes/link_spec.rb
CHANGED
@@ -1,12 +1,32 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Shoes::Link do
|
4
4
|
let(:gui) { double("gui").as_null_object }
|
5
|
-
let(:
|
5
|
+
let(:user_facing_app) { double("user facing app") }
|
6
|
+
let(:element_styles) { Hash.new }
|
7
|
+
let(:app) { double("app", gui: gui, style: {}, element_styles: element_styles,
|
8
|
+
warn: true, add_mouse_hover_control: nil) }
|
9
|
+
let(:parent) { double("parent") }
|
6
10
|
let(:internal_app) { double("internal app", app: app, gui: gui, style: {}, element_styles: {}) }
|
7
11
|
let(:texts) { ["text", "goes", "first"] }
|
8
12
|
|
9
|
-
subject {
|
13
|
+
subject {
|
14
|
+
link = Shoes::Link.new(app, texts, color: :blue)
|
15
|
+
link.parent = parent
|
16
|
+
link
|
17
|
+
}
|
18
|
+
|
19
|
+
before do
|
20
|
+
allow(user_facing_app).to receive(:style) do |clazz, styles|
|
21
|
+
element_styles[clazz] = styles
|
22
|
+
end
|
23
|
+
|
24
|
+
allow(parent).to receive(:eval_hover_block) do |blk|
|
25
|
+
blk.call(subject) if blk
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it_behaves_like "object with hover"
|
10
30
|
|
11
31
|
context "initialize" do
|
12
32
|
it "should set up text" do
|
@@ -29,15 +49,15 @@ describe Shoes::Link do
|
|
29
49
|
underline: false, bg: Shoes::COLORS[:green]) }
|
30
50
|
|
31
51
|
it "should include defaults" do
|
32
|
-
expect(subject.style).to include(:
|
52
|
+
expect(subject.style).to include(stroke: Shoes::COLORS[:blue])
|
33
53
|
end
|
34
54
|
|
35
55
|
it "should override defaults" do
|
36
|
-
expect(subject.style).to include(:
|
56
|
+
expect(subject.style).to include(underline: false)
|
37
57
|
end
|
38
58
|
|
39
59
|
it "should include other options" do
|
40
|
-
expect(subject.style).to include(:
|
60
|
+
expect(subject.style).to include(bg: Shoes::COLORS[:green])
|
41
61
|
end
|
42
62
|
end
|
43
63
|
|
data/spec/shoes/list_box_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Shoes::ListBox do
|
4
4
|
include_context "dsl app"
|
@@ -49,7 +49,7 @@ describe Shoes::ListBox do
|
|
49
49
|
|
50
50
|
it "updates the gui when self-modifying array methods like map! are called" do
|
51
51
|
expect(list_box.gui).to receive(:update_items)
|
52
|
-
list_box.items.map!{"replaced!"}
|
52
|
+
list_box.items.map! {"replaced!"}
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
data/spec/shoes/oval_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Shoes::Oval do
|
4
4
|
include_context "dsl app"
|
@@ -18,6 +18,7 @@ describe Shoes::Oval do
|
|
18
18
|
it_behaves_like "movable object"
|
19
19
|
it_behaves_like "left, top as center"
|
20
20
|
it_behaves_like "object with parent"
|
21
|
+
it_behaves_like "object with hover"
|
21
22
|
|
22
23
|
#it_styles_with :art_styles, :center, :dimensions, :radius
|
23
24
|
end
|
data/spec/shoes/packager_spec.rb
CHANGED
data/spec/shoes/point_spec.rb
CHANGED
data/spec/shoes/progress_spec.rb
CHANGED
data/spec/shoes/radio_spec.rb
CHANGED
data/spec/shoes/rect_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
shared_examples_for "basic rect" do
|
4
4
|
it "retains app" do
|
@@ -36,4 +36,5 @@ describe Shoes::Rect do
|
|
36
36
|
it_behaves_like "movable object"
|
37
37
|
it_behaves_like "left, top as center"
|
38
38
|
it_behaves_like 'object with parent'
|
39
|
+
it_behaves_like "object with hover"
|
39
40
|
end
|
data/spec/shoes/shape_spec.rb
CHANGED
@@ -25,7 +25,7 @@ shared_examples_for "movable object" do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
shared_examples_for "left, top as center" do |*params|
|
28
|
-
let(:centered_object) { described_class.new(app, parent, left, top, width, height, *params, :
|
28
|
+
let(:centered_object) { described_class.new(app, parent, left, top, width, height, *params, center: true) }
|
29
29
|
it "should now be located somewhere" do
|
30
30
|
expect(centered_object.left).to eq(left-(width/2))
|
31
31
|
expect(centered_object.top).to eq(top-(height/2))
|
@@ -20,7 +20,7 @@ shared_examples_for "animate DSL method" do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
context "with hash argument" do
|
23
|
-
let(:animation) { dsl.animate(:
|
23
|
+
let(:animation) { dsl.animate(framerate: 17) {} }
|
24
24
|
|
25
25
|
it "sets framerate" do
|
26
26
|
expect(animation.framerate).to eq(17)
|
@@ -8,13 +8,13 @@ shared_examples_for "background DSL method" do
|
|
8
8
|
|
9
9
|
context "with an invalid hex string" do
|
10
10
|
it 'raises an argument error' do
|
11
|
-
expect{ subject.background('#ffq') }.to raise_error('Bad hex color: #ffq')
|
11
|
+
expect { subject.background('#ffq') }.to raise_error('Bad hex color: #ffq')
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
context 'with no valid image' do
|
16
16
|
it 'ignores the background' do
|
17
|
-
expect{ subject.background('fake-shoes.jpg') }.not_to raise_error
|
17
|
+
expect { subject.background('fake-shoes.jpg') }.not_to raise_error
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -5,13 +5,15 @@ shared_examples_for "rgb DSL method" do
|
|
5
5
|
let(:alpha) { 133 } # cornflowerblue
|
6
6
|
|
7
7
|
it "sends args to Shoes::Color" do
|
8
|
-
|
8
|
+
allow(Shoes::Color).to receive(:new)
|
9
9
|
dsl.rgb(red, green, blue, alpha)
|
10
|
+
expect(Shoes::Color).to have_received(:new).with(red, green, blue, alpha)
|
10
11
|
end
|
11
12
|
|
12
13
|
it "defaults to opaque" do
|
13
|
-
|
14
|
+
allow(Shoes::Color).to receive(:new)
|
14
15
|
dsl.rgb(red, green, blue)
|
16
|
+
expect(Shoes::Color).to have_received(:new).with(red, green, blue, Shoes::Color::OPAQUE)
|
15
17
|
end
|
16
18
|
|
17
19
|
describe "named color method" do
|
@@ -4,7 +4,7 @@ shared_examples_for "style DSL method" do
|
|
4
4
|
let(:size) { 42 }
|
5
5
|
let(:fill) { Shoes::COLORS[:peru] }
|
6
6
|
let(:font) { "SOME FONT" }
|
7
|
-
let(:style) { {:
|
7
|
+
let(:style) { {stroke: stroke, size: size, fill: fill, font: font} }
|
8
8
|
|
9
9
|
%w(Banner Title Subtitle Tagline Caption Para Inscription).each do |text_block|
|
10
10
|
describe text_block do
|
@@ -41,7 +41,7 @@ shared_examples_for "text element DSL methods" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should handle a splatted array of links' do
|
44
|
-
expect{dsl.span(*[dsl.link('foo'), dsl.link('foo')])}.not_to raise_error
|
44
|
+
expect {dsl.span(*[dsl.link('foo'), dsl.link('foo')])}.not_to raise_error
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should handle a splatted array of links and parse the color' do
|
@@ -51,7 +51,7 @@ shared_examples_for "text element DSL methods" do
|
|
51
51
|
|
52
52
|
it 'should handle a splatted array of links with a block' do
|
53
53
|
link = dsl.link('foo') { "Bar" }
|
54
|
-
expect{dsl.span(*[link, link])}.not_to raise_error
|
54
|
+
expect {dsl.span(*[link, link])}.not_to raise_error
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -3,5 +3,8 @@ shared_context "dsl app" do
|
|
3
3
|
let(:input_opts) { Hash.new }
|
4
4
|
let(:user_facing_app) { Shoes::App.new input_opts, &input_block }
|
5
5
|
let(:app) { user_facing_app.instance_variable_get(:@__app__) }
|
6
|
-
let(:parent) { Shoes::Flow.new app, app
|
6
|
+
let(:parent) { Shoes::Flow.new app, app,
|
7
|
+
width: Shoes::InternalApp::DEFAULT_OPTIONS[:width],
|
8
|
+
height: Shoes::InternalApp::DEFAULT_OPTIONS[:height]
|
9
|
+
}
|
7
10
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
shared_examples "object with hover" do
|
2
|
+
let(:teal) { Shoes::COLORS[:teal] }
|
3
|
+
let(:gold) { Shoes::COLORS[:gold] }
|
4
|
+
|
5
|
+
let(:hover_class) { subject.hover_class }
|
6
|
+
|
7
|
+
it "registers hover" do
|
8
|
+
expect(subject).to receive(:add_mouse_hover_control)
|
9
|
+
subject.hover { }
|
10
|
+
end
|
11
|
+
|
12
|
+
it "registers with leave" do
|
13
|
+
expect(subject).to receive(:add_mouse_hover_control)
|
14
|
+
subject.leave { }
|
15
|
+
end
|
16
|
+
|
17
|
+
it "marks itself as hovered" do
|
18
|
+
subject.mouse_hovered
|
19
|
+
expect(subject.hovered?).to eq(true)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "marks itself not hovered after leaving" do
|
23
|
+
subject.mouse_hovered
|
24
|
+
expect(subject.hovered?).to eq(true)
|
25
|
+
|
26
|
+
subject.mouse_left
|
27
|
+
expect(subject.hovered?).to eq(false)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "only calls hover block once" do
|
31
|
+
count = 0
|
32
|
+
subject.hover do
|
33
|
+
count += 1
|
34
|
+
end
|
35
|
+
|
36
|
+
subject.mouse_hovered
|
37
|
+
subject.mouse_hovered
|
38
|
+
|
39
|
+
expect(count).to eq(1)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "only calls leave block once after we're hovering" do
|
43
|
+
count = 0
|
44
|
+
subject.leave do
|
45
|
+
count += 1
|
46
|
+
end
|
47
|
+
|
48
|
+
subject.mouse_hovered
|
49
|
+
subject.mouse_left
|
50
|
+
subject.mouse_left
|
51
|
+
|
52
|
+
expect(count).to eq(1)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "doesn't update styles on hover by default" do
|
56
|
+
original_style = subject.style.dup
|
57
|
+
subject.mouse_hovered
|
58
|
+
|
59
|
+
expect(subject.style).to eq(original_style)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "updates styles on hover" do
|
63
|
+
user_facing_app.style(hover_class, stroke: teal)
|
64
|
+
|
65
|
+
subject.mouse_hovered
|
66
|
+
expect(subject.style[:stroke]).to eq(teal)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "restores style after hover's done" do
|
70
|
+
user_facing_app.style(hover_class, stroke: teal)
|
71
|
+
|
72
|
+
subject.style[:stroke] = gold
|
73
|
+
subject.mouse_hovered
|
74
|
+
subject.mouse_left
|
75
|
+
|
76
|
+
expect(subject.style[:stroke]).to eq(gold)
|
77
|
+
end
|
78
|
+
end
|
@@ -90,7 +90,6 @@ shared_context 'element one with bottom and right' do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
shared_examples_for 'positioning through :_position' do
|
93
|
-
|
94
93
|
let(:element) {Shoes::FakeElement.new nil, height: 100, width: 50}
|
95
94
|
|
96
95
|
def add_child_and_align
|
@@ -109,11 +108,34 @@ shared_examples_for 'positioning through :_position' do
|
|
109
108
|
subject.contents_alignment
|
110
109
|
end
|
111
110
|
|
111
|
+
it 'does not send _position if element does not need positioning' do
|
112
|
+
allow(element).to receive(:takes_up_space?) { false }
|
113
|
+
allow(element).to receive(:needs_positioning?) { false }
|
114
|
+
expect(element).not_to receive(:_position)
|
115
|
+
add_child_and_align
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'sends _position even when element does not take up space' do
|
119
|
+
allow(element).to receive(:takes_up_space?) { false }
|
120
|
+
allow(element).to receive(:needs_positioning?) { true }
|
121
|
+
expect(element).to receive(:_position).and_call_original
|
122
|
+
add_child_and_align
|
123
|
+
end
|
124
|
+
|
112
125
|
it 'is resilient to exceptions during positioning' do
|
113
126
|
allow(element).to receive(:contents_alignment).and_raise("O_o")
|
114
127
|
allow(subject).to receive(:puts) # Quiet, you
|
115
128
|
add_child_and_align
|
116
129
|
end
|
130
|
+
|
131
|
+
describe 'absolute dimensions' do
|
132
|
+
let(:element) { Shoes::FakeAbsoluteElement.new }
|
133
|
+
|
134
|
+
it 'positions element via _position' do
|
135
|
+
expect(element).to receive(:_position).and_call_original
|
136
|
+
add_child_and_align
|
137
|
+
end
|
138
|
+
end
|
117
139
|
end
|
118
140
|
|
119
141
|
shared_examples_for 'element one positioned with top and left' do
|
@@ -261,8 +283,8 @@ end
|
|
261
283
|
|
262
284
|
shared_examples_for 'prepending' do
|
263
285
|
include_context 'two slot children'
|
264
|
-
let(:prepend1) {
|
265
|
-
let(:prepend2) {
|
286
|
+
let(:prepend1) { Shoes::FakeElement.new(nil, width: 100) }
|
287
|
+
let(:prepend2) { Shoes::FakeElement.new(nil, width: 100) }
|
266
288
|
|
267
289
|
describe 'one element' do
|
268
290
|
before :each do
|
@@ -304,7 +326,7 @@ shared_examples_for 'prepending' do
|
|
304
326
|
describe 'two times' do
|
305
327
|
before :each do
|
306
328
|
subject.prepend { subject.add_child prepend1 }
|
307
|
-
subject.prepend {subject.add_child prepend2 }
|
329
|
+
subject.prepend { subject.add_child prepend2 }
|
308
330
|
end
|
309
331
|
|
310
332
|
it 'has the last prepended element as the first' do
|
@@ -384,6 +406,14 @@ shared_examples_for 'margin and positioning' do
|
|
384
406
|
it 'leaves the left value as zero' do
|
385
407
|
expect(element.absolute_left).to eq 0
|
386
408
|
end
|
409
|
+
|
410
|
+
it 'sets the slot element_height to the height of the child + adjustment' do
|
411
|
+
expect(subject.element_height).to eq element.height
|
412
|
+
end
|
413
|
+
|
414
|
+
it 'sets the slot total height to element height + margin' do
|
415
|
+
expect(subject.height).to eq element.height + margin_top
|
416
|
+
end
|
387
417
|
end
|
388
418
|
|
389
419
|
describe 'margin left' do
|
@@ -1,7 +1,8 @@
|
|
1
1
|
shared_examples_for "object with state" do
|
2
|
-
let(:input_opts) { {:
|
2
|
+
let(:input_opts) { {state: "disabled"} }
|
3
3
|
|
4
|
-
it "should initialize" do
|
4
|
+
it "should initialize in the right state" do
|
5
|
+
expect_any_instance_of(Shoes.configuration.backend_class(described_class)).to receive(:enabled).with(false)
|
5
6
|
expect(subject.state).to eq("disabled")
|
6
7
|
end
|
7
8
|
|
@@ -16,4 +17,10 @@ shared_examples_for "object with state" do
|
|
16
17
|
subject.state = "disabled"
|
17
18
|
expect(subject.state).to eq("disabled")
|
18
19
|
end
|
20
|
+
|
21
|
+
it "does not disable when a string other than disabled is passed" do
|
22
|
+
expect(subject.gui).to receive(:enabled).with(true)
|
23
|
+
subject.state = "enabled"
|
24
|
+
expect(subject.state).to eq("enabled")
|
25
|
+
end
|
19
26
|
end
|