under-os 1.3.0 → 1.4.0
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/Gemfile +4 -0
- data/Gemfile.lock +25 -2
- data/README.md +1 -1
- data/Rakefile +2 -4
- data/lib/under-os.rb +3 -8
- data/under-os.gemspec +6 -2
- metadata +47 -191
- data/lib/assets/fontawesome-webfont.ttf +0 -0
- data/lib/assets/under-os.css +0 -115
- data/lib/under_os.rb +0 -41
- data/lib/under_os/app.rb +0 -33
- data/lib/under_os/color.rb +0 -184
- data/lib/under_os/config.rb +0 -33
- data/lib/under_os/core/array.rb +0 -5
- data/lib/under_os/core/hash.rb +0 -10
- data/lib/under_os/core/json.rb +0 -19
- data/lib/under_os/core/kernel.rb +0 -16
- data/lib/under_os/core/numeric.rb +0 -23
- data/lib/under_os/core/object.rb +0 -9
- data/lib/under_os/core/string.rb +0 -80
- data/lib/under_os/delegate.rb +0 -10
- data/lib/under_os/events.rb +0 -85
- data/lib/under_os/file.rb +0 -110
- data/lib/under_os/history.rb +0 -53
- data/lib/under_os/http.rb +0 -31
- data/lib/under_os/http/cookies.rb +0 -30
- data/lib/under_os/http/receiver.rb +0 -44
- data/lib/under_os/http/request.rb +0 -106
- data/lib/under_os/http/response.rb +0 -28
- data/lib/under_os/http/session.rb +0 -49
- data/lib/under_os/page.rb +0 -169
- data/lib/under_os/page/builder.rb +0 -96
- data/lib/under_os/page/layout.rb +0 -43
- data/lib/under_os/page/matcher.rb +0 -128
- data/lib/under_os/page/stylesheet.rb +0 -67
- data/lib/under_os/parser.rb +0 -24
- data/lib/under_os/parser/css.rb +0 -37
- data/lib/under_os/parser/html.rb +0 -97
- data/lib/under_os/point.rb +0 -47
- data/lib/under_os/screen.rb +0 -9
- data/lib/under_os/timer.rb +0 -65
- data/lib/under_os/ui.rb +0 -3
- data/lib/under_os/ui/alert.rb +0 -52
- data/lib/under_os/ui/button.rb +0 -42
- data/lib/under_os/ui/collection.rb +0 -65
- data/lib/under_os/ui/collection/cell.rb +0 -21
- data/lib/under_os/ui/collection/delegate.rb +0 -70
- data/lib/under_os/ui/collection/item.rb +0 -32
- data/lib/under_os/ui/collection/layout.rb +0 -43
- data/lib/under_os/ui/collection/styles.rb +0 -15
- data/lib/under_os/ui/div.rb +0 -3
- data/lib/under_os/ui/form.rb +0 -60
- data/lib/under_os/ui/icon.rb +0 -61
- data/lib/under_os/ui/icon/awesome.rb +0 -376
- data/lib/under_os/ui/icon/engine.rb +0 -10
- data/lib/under_os/ui/image.rb +0 -31
- data/lib/under_os/ui/input.rb +0 -140
- data/lib/under_os/ui/label.rb +0 -21
- data/lib/under_os/ui/locker.rb +0 -42
- data/lib/under_os/ui/navbar.rb +0 -123
- data/lib/under_os/ui/progress.rb +0 -17
- data/lib/under_os/ui/scroll.rb +0 -41
- data/lib/under_os/ui/select.rb +0 -95
- data/lib/under_os/ui/sidebar.rb +0 -45
- data/lib/under_os/ui/slider.rb +0 -37
- data/lib/under_os/ui/spinner.rb +0 -23
- data/lib/under_os/ui/style.rb +0 -21
- data/lib/under_os/ui/style/fonts.rb +0 -54
- data/lib/under_os/ui/style/margins.rb +0 -164
- data/lib/under_os/ui/style/outlining.rb +0 -170
- data/lib/under_os/ui/style/positioning.rb +0 -169
- data/lib/under_os/ui/switch.rb +0 -26
- data/lib/under_os/ui/textarea.rb +0 -19
- data/lib/under_os/ui/utils/animation.rb +0 -99
- data/lib/under_os/ui/utils/commons.rb +0 -70
- data/lib/under_os/ui/utils/dimensions.rb +0 -37
- data/lib/under_os/ui/utils/events.rb +0 -170
- data/lib/under_os/ui/utils/manipulation.rb +0 -44
- data/lib/under_os/ui/utils/position.rb +0 -21
- data/lib/under_os/ui/utils/size.rb +0 -21
- data/lib/under_os/ui/utils/styles.rb +0 -89
- data/lib/under_os/ui/utils/traversing.rb +0 -44
- data/lib/under_os/ui/utils/wrap.rb +0 -77
- data/lib/under_os/ui/view.rb +0 -31
- data/resources/test.png +0 -0
- data/spec/assets/app.css +0 -13
- data/spec/assets/test.css +0 -7
- data/spec/assets/test.html +0 -3
- data/spec/assets/test_page.rb +0 -2
- data/spec/lib/core/hash_spec.rb +0 -19
- data/spec/lib/core/json_spec.rb +0 -32
- data/spec/lib/core/numeric_spec.rb +0 -37
- data/spec/lib/core/string_spec.rb +0 -121
- data/spec/lib/under_os/color_spec.rb +0 -133
- data/spec/lib/under_os/events_spec.rb +0 -71
- data/spec/lib/under_os/file_spec.rb +0 -98
- data/spec/lib/under_os/http/cookies_spec.rb +0 -13
- data/spec/lib/under_os/http/request_spec.rb +0 -44
- data/spec/lib/under_os/http_spec.rb +0 -20
- data/spec/lib/under_os/page/builder_spec.rb +0 -128
- data/spec/lib/under_os/page/layout_spec.rb +0 -18
- data/spec/lib/under_os/page/matcher_spec.rb +0 -260
- data/spec/lib/under_os/page/stylesheet_spec.rb +0 -83
- data/spec/lib/under_os/page_spec.rb +0 -5
- data/spec/lib/under_os/parser/css_spec.rb +0 -77
- data/spec/lib/under_os/parser/html_spec.rb +0 -152
- data/spec/lib/under_os/parser_spec.rb +0 -16
- data/spec/lib/under_os/point_spec.rb +0 -54
- data/spec/lib/under_os/screen_spec.rb +0 -11
- data/spec/lib/under_os/timer_spec.rb +0 -93
- data/spec/lib/under_os/ui/button_spec.rb +0 -50
- data/spec/lib/under_os/ui/collection_spec.rb +0 -19
- data/spec/lib/under_os/ui/div_spec.rb +0 -24
- data/spec/lib/under_os/ui/form_spec.rb +0 -156
- data/spec/lib/under_os/ui/icon_spec.rb +0 -57
- data/spec/lib/under_os/ui/image_spec.rb +0 -39
- data/spec/lib/under_os/ui/input_spec.rb +0 -109
- data/spec/lib/under_os/ui/label_spec.rb +0 -22
- data/spec/lib/under_os/ui/locker_spec.rb +0 -31
- data/spec/lib/under_os/ui/progress_spec.rb +0 -31
- data/spec/lib/under_os/ui/scroll_spec.rb +0 -40
- data/spec/lib/under_os/ui/select_spec.rb +0 -135
- data/spec/lib/under_os/ui/sidebar_spec.rb +0 -35
- data/spec/lib/under_os/ui/slider_spec.rb +0 -69
- data/spec/lib/under_os/ui/spinner_spec.rb +0 -57
- data/spec/lib/under_os/ui/style/fonts_spec.rb +0 -73
- data/spec/lib/under_os/ui/style/margins_spec.rb +0 -106
- data/spec/lib/under_os/ui/style/outlining_spec.rb +0 -101
- data/spec/lib/under_os/ui/style/positioning_spec.rb +0 -69
- data/spec/lib/under_os/ui/style_spec.rb +0 -19
- data/spec/lib/under_os/ui/switch_spec.rb +0 -60
- data/spec/lib/under_os/ui/textarea_spec.rb +0 -34
- data/spec/lib/under_os/ui/utils/commons_spec.rb +0 -81
- data/spec/lib/under_os/ui/utils/events_spec.rb +0 -87
- data/spec/lib/under_os/ui/utils/manipulation_spec.rb +0 -130
- data/spec/lib/under_os/ui/utils/styles_spec.rb +0 -140
- data/spec/lib/under_os/ui/utils/traversing_spec.rb +0 -124
- data/spec/lib/under_os/ui/utils/wrap_spec.rb +0 -69
- data/spec/lib/under_os/ui/view_spec.rb +0 -39
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
describe UnderOs::Parser::CSS do
|
|
2
|
-
before do
|
|
3
|
-
@parser = UnderOs::Parser::CSS.new
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
it "should parse simple tags" do
|
|
7
|
-
@parser.parse(%Q[
|
|
8
|
-
page {
|
|
9
|
-
background-color: darkgray;
|
|
10
|
-
}
|
|
11
|
-
]).should == {'page' => {backgroundColor: "darkgray"}}
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "should unquote quoted values" do
|
|
15
|
-
@parser.parse(%Q{
|
|
16
|
-
page {
|
|
17
|
-
background-image: "image.png";
|
|
18
|
-
}
|
|
19
|
-
}).should == {'page' => {backgroundImage: "image.png"}}
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "should parse heaps of styles" do
|
|
23
|
-
@parser.parse(%Q{
|
|
24
|
-
button {
|
|
25
|
-
width: 79px;
|
|
26
|
-
height: 79px;
|
|
27
|
-
color: black;
|
|
28
|
-
background: white;
|
|
29
|
-
border-radius: 0px;
|
|
30
|
-
}
|
|
31
|
-
}).should == {'button' => {
|
|
32
|
-
width: 79.0, height: 79.0, color: "black", backgroundColor: "white", borderRadius: 0.0
|
|
33
|
-
}}
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "should parse classes" do
|
|
37
|
-
@parser.parse(%Q[
|
|
38
|
-
.row1 { bottom: 0px; }
|
|
39
|
-
.row2 { bottom: 80px; }
|
|
40
|
-
|
|
41
|
-
.col1.col2 { left: 0; }
|
|
42
|
-
]).should == {
|
|
43
|
-
'.row1' => {bottom: 0.0},
|
|
44
|
-
'.row2' => {bottom: 80.0},
|
|
45
|
-
'.col1.col2' => {left: 0.0}
|
|
46
|
-
}
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it "should parse tags and styles" do
|
|
50
|
-
@parser.parse(%Q[
|
|
51
|
-
button.double { width: 159; }
|
|
52
|
-
button.ops { background: yellow }
|
|
53
|
-
]).should == {
|
|
54
|
-
'button.double' => {width: 159.0},
|
|
55
|
-
'button.ops' => {backgroundColor: "yellow"}
|
|
56
|
-
}
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "should parse complex rules" do
|
|
60
|
-
@parser.parse(%Q{
|
|
61
|
-
icon#delete .col1.col2 { color: red }
|
|
62
|
-
}).should == {
|
|
63
|
-
'icon#delete .col1.col2' => {color: "red"}
|
|
64
|
-
}
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it "should parse several rules" do
|
|
68
|
-
@parser.parse(%Q{
|
|
69
|
-
input, textarea {
|
|
70
|
-
width: 100;
|
|
71
|
-
}
|
|
72
|
-
}).should == {
|
|
73
|
-
'input' => {width: 100.0},
|
|
74
|
-
'textarea' => {width: 100.0}
|
|
75
|
-
}
|
|
76
|
-
end
|
|
77
|
-
end
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
describe UnderOs::Parser::HTML do
|
|
2
|
-
|
|
3
|
-
def parse(src)
|
|
4
|
-
@parser ||= UnderOs::Parser::HTML.new
|
|
5
|
-
@parser.parse(src)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it "should parse simple tags" do
|
|
9
|
-
parse(%Q{
|
|
10
|
-
<page>
|
|
11
|
-
asdf
|
|
12
|
-
</page>
|
|
13
|
-
}).should == [{
|
|
14
|
-
tag: 'page',
|
|
15
|
-
text: 'asdf',
|
|
16
|
-
attrs: {}
|
|
17
|
-
}]
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should parse tag attributes" do
|
|
21
|
-
parse(%Q{
|
|
22
|
-
<page title="My Page" id='my-page'>
|
|
23
|
-
</page>
|
|
24
|
-
}).should == [{
|
|
25
|
-
tag: 'page',
|
|
26
|
-
attrs: {
|
|
27
|
-
title: "My Page",
|
|
28
|
-
id: "my-page"
|
|
29
|
-
}
|
|
30
|
-
}]
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it "should parse tad data-attributes" do
|
|
34
|
-
parse(%Q{
|
|
35
|
-
<view data-one="1" data-two="2" data-three="true" data-four-and-half="four/2"></view>
|
|
36
|
-
}).should == [{
|
|
37
|
-
tag: 'view',
|
|
38
|
-
attrs: {
|
|
39
|
-
data: {
|
|
40
|
-
one: '1',
|
|
41
|
-
two: '2',
|
|
42
|
-
three: true,
|
|
43
|
-
fourAndHalf: 'four/2'
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}]
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it "should process nested views" do
|
|
50
|
-
parse(%Q{
|
|
51
|
-
<page>
|
|
52
|
-
<view id="my-view">
|
|
53
|
-
<view class="my-view">
|
|
54
|
-
</view>
|
|
55
|
-
</view>
|
|
56
|
-
</page>
|
|
57
|
-
}).should == [{
|
|
58
|
-
tag: "page", attrs: {}, children: [
|
|
59
|
-
{tag: "view", attrs: {id: "my-view"}, children: [
|
|
60
|
-
{tag: "view", attrs: {class: "my-view"}}
|
|
61
|
-
]}
|
|
62
|
-
]
|
|
63
|
-
}]
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it "should handle terminal nodes correctly" do
|
|
67
|
-
parse(%Q{
|
|
68
|
-
<page>
|
|
69
|
-
<img src="my-image.jpg" />
|
|
70
|
-
<button>Boo Hoo</button>
|
|
71
|
-
</page>
|
|
72
|
-
}).should == [{
|
|
73
|
-
tag: "page", attrs: {}, children: [
|
|
74
|
-
{tag: "img", attrs: {src: "my-image.jpg"}},
|
|
75
|
-
{tag: "button", attrs: {}, text: "Boo Hoo"}
|
|
76
|
-
]
|
|
77
|
-
}]
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "should handle same tags correctly" do
|
|
81
|
-
parse(%Q{
|
|
82
|
-
<view id="level1">
|
|
83
|
-
<view id='level2'>
|
|
84
|
-
<button>A</button>
|
|
85
|
-
<button>B</button>
|
|
86
|
-
|
|
87
|
-
<view id="level3">
|
|
88
|
-
<img src="test.png" />
|
|
89
|
-
</view>
|
|
90
|
-
|
|
91
|
-
<view id="level4">
|
|
92
|
-
<icon type="ok">
|
|
93
|
-
<label>A</label>
|
|
94
|
-
<label>B</label>
|
|
95
|
-
</view>
|
|
96
|
-
</view>
|
|
97
|
-
</view>
|
|
98
|
-
}).should == [{
|
|
99
|
-
tag: "view", attrs: {id: "level1"}, children: [
|
|
100
|
-
{tag: "view", attrs: {id: "level2"}, children: [
|
|
101
|
-
{tag: "button", attrs: {}, text: "A"},
|
|
102
|
-
{tag: "button", attrs: {}, text: "B"},
|
|
103
|
-
|
|
104
|
-
{tag: "view", attrs: {id: "level3"}, children: [
|
|
105
|
-
{tag: "img", attrs: {src: "test.png"}}
|
|
106
|
-
]},
|
|
107
|
-
|
|
108
|
-
{tag: "view", attrs: {id: "level4"}, children: [
|
|
109
|
-
{tag: "icon", attrs: {type: "ok"}},
|
|
110
|
-
{tag: "label", attrs: {}, text: "A"},
|
|
111
|
-
{tag: "label", attrs: {}, text: "B"}
|
|
112
|
-
]}
|
|
113
|
-
]}
|
|
114
|
-
]}
|
|
115
|
-
]
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
it "should handle multiple single tags correctly" do
|
|
119
|
-
parse(%Q{
|
|
120
|
-
<view>
|
|
121
|
-
<img>
|
|
122
|
-
<icon>
|
|
123
|
-
<slide>
|
|
124
|
-
</view>
|
|
125
|
-
<switch>
|
|
126
|
-
<progress>
|
|
127
|
-
}).should == [
|
|
128
|
-
{tag: "view", attrs: {}, children: [
|
|
129
|
-
{tag: "img", attrs: {}},
|
|
130
|
-
{tag: "icon", attrs: {}},
|
|
131
|
-
{tag: "slide", attrs: {}}
|
|
132
|
-
]},
|
|
133
|
-
{tag: "switch", attrs: {}},
|
|
134
|
-
{tag: "progress", attrs: {}}
|
|
135
|
-
]
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
it "should skipp all the comments" do
|
|
139
|
-
parse(%Q{
|
|
140
|
-
<view>
|
|
141
|
-
<!-- <img> -->
|
|
142
|
-
<icon>
|
|
143
|
-
<!-- <slide> -->
|
|
144
|
-
</view>
|
|
145
|
-
}).should == [
|
|
146
|
-
{tag: "view", attrs: {}, children: [
|
|
147
|
-
{tag: "icon", attrs: {}}
|
|
148
|
-
]}
|
|
149
|
-
]
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
describe UnderOs::Parser do
|
|
2
|
-
|
|
3
|
-
it "should parse .css files" do
|
|
4
|
-
UnderOs::Parser.parse('test.css').size.should.not == 0
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
it "should parse .html files" do
|
|
8
|
-
UnderOs::Parser.parse('test.html').size.should.not == 0
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "should not fail on non existing files" do
|
|
12
|
-
UnderOs::Parser.parse('non-existing.css').should == {}
|
|
13
|
-
UnderOs::Parser.parse('non-existing.html').should == []
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
describe UnderOs::Point do
|
|
2
|
-
|
|
3
|
-
describe '#initialize' do
|
|
4
|
-
it "should eat numbers" do
|
|
5
|
-
point = UnderOs::Point.new(10, 20)
|
|
6
|
-
point.x.should == 10
|
|
7
|
-
point.y.should == 20
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "should eat hashes" do
|
|
11
|
-
point = UnderOs::Point.new(x: 20, y: 30)
|
|
12
|
-
point.x.should == 20
|
|
13
|
-
point.y.should == 30
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "should eat hashes with string keys" do
|
|
17
|
-
point = UnderOs::Point.new('x' => 30, 'y' => 40)
|
|
18
|
-
point.x.should == 30
|
|
19
|
-
point.y.should == 40
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "should eat other opints" do
|
|
23
|
-
other_point = UnderOs::Point.new(x: 40, y: 50)
|
|
24
|
-
new_point = UnderOs::Point.new(other_point)
|
|
25
|
-
new_point.x.should == other_point.x
|
|
26
|
-
new_point.y.should == other_point.y
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe '#==' do
|
|
31
|
-
before do
|
|
32
|
-
@point = UnderOs::Point.new(x: 50, y: 60)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "should allow comparison to another point" do
|
|
36
|
-
@point.should == UnderOs::Point.new(x: 50, y: 60)
|
|
37
|
-
@point.should.not == UnderOs::Point.new(x: 60, y: 50)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it "should allow comparison to a hash" do
|
|
41
|
-
@point.should == {x: 50, y: 60}
|
|
42
|
-
@point.should.not == {x: 60, y: 50}
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
describe '#*' do
|
|
47
|
-
it "should allow to multiply pointers by a factor" do
|
|
48
|
-
point = UnderOs::Point.new(x: 15, y: 25)
|
|
49
|
-
new_point = point * 2
|
|
50
|
-
new_point.should.not == point
|
|
51
|
-
new_point.should == {x: 30, y: 50}
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
describe UnderOs::Timer do
|
|
2
|
-
describe '#initialize' do
|
|
3
|
-
before do
|
|
4
|
-
@block = Proc.new {}
|
|
5
|
-
@timer = UnderOs::Timer.new(11, repeat: true, &@block)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it "saves the block" do
|
|
9
|
-
@timer.block.should == @block
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "sets the interval correctly" do
|
|
13
|
-
@timer.interval.should == 11
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "sets the repeating cycle correctly" do
|
|
17
|
-
@timer.repeats.should == true
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe UnderOs::Timer::Duration do
|
|
22
|
-
before do
|
|
23
|
-
@duration = UnderOs::Timer::Duration.new(10)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "saves the value in seconds" do
|
|
27
|
-
@duration.seconds.should == 10.0
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "knows how to convert itself to floats" do
|
|
31
|
-
@duration.to_f.should == 10.0
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "knows how to convert itself into integers" do
|
|
35
|
-
@duration.to_i.should == 10
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "knows how to convert itself into strings" do
|
|
39
|
-
@duration.to_s.should == "10.0 seconds"
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "knows how to compare itself to other durations" do
|
|
43
|
-
@duration.should == UnderOs::Timer::Duration.new(10)
|
|
44
|
-
@duration.should.not == UnderOs::Timer::Duration.new(9)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
describe '#later' do
|
|
48
|
-
before do
|
|
49
|
-
@block = Proc.new {}
|
|
50
|
-
@timer = 10.seconds.later &@block
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "spawns a timer" do
|
|
54
|
-
@timer.class.should == UnderOs::Timer
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it "spawns one-time timer" do
|
|
58
|
-
@timer.repeats.should == false
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it "spawns a timer with correct interval" do
|
|
62
|
-
@timer.interval.should == 10.0
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it "spawns a timer with correct block to call" do
|
|
66
|
-
@timer.block.should == @block
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
describe '#repeat' do
|
|
71
|
-
before do
|
|
72
|
-
@block = Proc.new {}
|
|
73
|
-
@timer = 20.seconds.repeat &@block
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "spawns a timer" do
|
|
77
|
-
@timer.class.should == UnderOs::Timer
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "spawns a recursive timer" do
|
|
81
|
-
@timer.repeats.should == true
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it "spawns a timer with correct interval" do
|
|
85
|
-
@timer.interval.should == 20.0
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
it "spawns a timer with correct block to call" do
|
|
89
|
-
@timer.block.should == @block
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
describe "UnderOs::UI::Button" do
|
|
2
|
-
before do
|
|
3
|
-
@button = UnderOs::UI::Button.new(text: "Hello")
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
describe "constructor" do
|
|
7
|
-
it "builds an instance of the UnderOs::UI::Button" do
|
|
8
|
-
@button.class.should == UnderOs::UI::Button
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "wraps an UIButton instance" do
|
|
12
|
-
@button._.class.should == UIButton
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "assigns the BUTTON tag after it" do
|
|
16
|
-
@button.tagName.should == "BUTTON"
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe "#text" do
|
|
21
|
-
it "returns the button's label text" do
|
|
22
|
-
@button.text.should == "Hello"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it "allows to set a new value" do
|
|
26
|
-
@button.text = "New Label"
|
|
27
|
-
@button._.currentTitle.should == "New Label"
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe '#disabled' do
|
|
32
|
-
it "returns 'false' by default" do
|
|
33
|
-
@button.disabled.should == false
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "reads the value right of the ios entity" do
|
|
37
|
-
@button._.enabled = false
|
|
38
|
-
@button.disabled.should == true
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "allows to disable the inputs" do
|
|
42
|
-
@button.disabled = true
|
|
43
|
-
@button._.isEnabled.should == false
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "has a ruby-style alias" do
|
|
47
|
-
@button.disabled?.should == false
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|