under-os 1.1.0 → 1.2.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/.gitignore +1 -0
- data/Gemfile.lock +2 -2
- data/app/layouts/inputs.html +5 -1
- data/app/pages/http_page.rb +1 -1
- data/app/styles/inputs.css +20 -7
- data/lib/under_os/page/matcher.rb +61 -16
- data/lib/under_os/parser/css.rb +1 -1
- data/lib/under_os/ui/button.rb +21 -1
- data/lib/under_os/ui/div.rb +3 -0
- data/lib/under_os/ui/form.rb +60 -0
- data/lib/under_os/ui/icon.rb +19 -0
- data/lib/under_os/ui/input.rb +119 -20
- data/lib/under_os/ui/scroll.rb +1 -1
- data/lib/under_os/ui/select.rb +3 -6
- data/lib/under_os/ui/slider.rb +2 -14
- data/lib/under_os/ui/switch.rb +2 -5
- data/lib/under_os/ui/textarea.rb +13 -8
- data/lib/under_os.rb +1 -1
- data/spec/lib/under_os/page/matcher_spec.rb +107 -1
- data/spec/lib/under_os/ui/button_spec.rb +48 -3
- data/spec/lib/under_os/ui/div_spec.rb +24 -0
- data/spec/lib/under_os/ui/form_spec.rb +156 -0
- data/spec/lib/under_os/ui/icon_spec.rb +36 -5
- data/spec/lib/under_os/ui/input_spec.rb +45 -13
- data/spec/lib/under_os/ui/select_spec.rb +4 -0
- data/spec/lib/under_os/ui/slider_spec.rb +4 -0
- data/spec/lib/under_os/ui/switch_spec.rb +4 -0
- data/spec/lib/under_os/ui/textarea_spec.rb +4 -0
- metadata +16 -11
- data/lib/under_os/ui/utils/editable.rb +0 -43
@@ -50,6 +50,10 @@ describe UnderOs::Page::StylesMatcher do
|
|
50
50
|
it "should not add score if the css-rule is wrong" do
|
51
51
|
score_for(@view, 'view.some-class').should == 0
|
52
52
|
end
|
53
|
+
|
54
|
+
it "should handle the * as the tag name" do
|
55
|
+
score_for(@view, '*').should == 1
|
56
|
+
end
|
53
57
|
end
|
54
58
|
|
55
59
|
describe 'IDs matching' do
|
@@ -107,7 +111,90 @@ describe UnderOs::Page::StylesMatcher do
|
|
107
111
|
end
|
108
112
|
end
|
109
113
|
|
110
|
-
describe
|
114
|
+
describe "attribute matchers" do
|
115
|
+
before do
|
116
|
+
@view.id = "my-view"
|
117
|
+
end
|
118
|
+
|
119
|
+
def score_for(view, css_rule)
|
120
|
+
UnderOs::Page::StylesMatcher.new(css_rule).score_for(view)
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "with the '=' operator" do
|
124
|
+
it "scores when the value matches exactly" do
|
125
|
+
score_for(@view, '[id="my-view"]').should == 1
|
126
|
+
end
|
127
|
+
|
128
|
+
it "doesn't count when the value does not match" do
|
129
|
+
score_for(@view, "[id='my']").should == 0
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe "with the '*=' operator" do
|
134
|
+
it "scores when the attribute includes the value" do
|
135
|
+
score_for(@view, '[id*=vie]').should == 1
|
136
|
+
end
|
137
|
+
|
138
|
+
it "doesn't count when the value doesn't match attribute" do
|
139
|
+
score_for(@view, '[id*=mismatch]').should == 0
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe "with the ^= operator" do
|
144
|
+
it "scores when the attribute starts with the value" do
|
145
|
+
score_for(@view, '[id^=my]').should == 1
|
146
|
+
end
|
147
|
+
|
148
|
+
it "doesn't count when the attribute doesn't start with the value" do
|
149
|
+
score_for(@view, '[id^=view]').should == 0
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "with the $= operator" do
|
154
|
+
it "scores when the attribute ends with the value" do
|
155
|
+
score_for(@view, '[id$=view]').should == 1
|
156
|
+
end
|
157
|
+
|
158
|
+
it "doesn't count when the attribute doesn't ends with the value" do
|
159
|
+
score_for(@view, '[id$=my]').should == 0
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe "with the ~= operator" do
|
164
|
+
before { @view.id = "one two three" }
|
165
|
+
|
166
|
+
it "scores when the value is a token from the attribute" do
|
167
|
+
score_for(@view, '[id~=one]').should == 1
|
168
|
+
score_for(@view, '[id~=two]').should == 1
|
169
|
+
score_for(@view, '[id~=three]').should == 1
|
170
|
+
end
|
171
|
+
|
172
|
+
it "doesn't trigger on completely different strings" do
|
173
|
+
score_for(@view, '[id~=four]').should == 0
|
174
|
+
end
|
175
|
+
|
176
|
+
it "doesn't trigger on partial substrings" do
|
177
|
+
score_for(@view, '[id~=tw]').should == 0
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
describe "with the |= operator" do
|
182
|
+
it "scores when value is a dashed token of the attribute" do
|
183
|
+
score_for(@view, '[id|=my]').should == 1
|
184
|
+
score_for(@view, '[id|=view]').should == 1
|
185
|
+
end
|
186
|
+
|
187
|
+
it "doesn't trigger on completely different values" do
|
188
|
+
score_for(@view, '[id|=mismatch]').should == 0
|
189
|
+
end
|
190
|
+
|
191
|
+
it "doesn't trigger on partial matches" do
|
192
|
+
score_for(@view, '[id|=vie]').should == 0
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
describe 'multiple nested matches' do
|
111
198
|
it "should count in all the matches" do
|
112
199
|
@view.id = 'my-id'
|
113
200
|
@view.className = 'class1 class2'
|
@@ -150,5 +237,24 @@ describe UnderOs::Page::StylesMatcher do
|
|
150
237
|
score_for(@view, '.non-existing #my-view').should == 0
|
151
238
|
end
|
152
239
|
end
|
240
|
+
|
241
|
+
describe "multiple different matchers" do
|
242
|
+
before do
|
243
|
+
@view.id = 'my-view'
|
244
|
+
@view.className = 'classy'
|
245
|
+
end
|
246
|
+
|
247
|
+
it "gets score out of multiple matchers if one of them is matching" do
|
248
|
+
score_for(@view, "view, input, form").should == 1
|
249
|
+
end
|
250
|
+
|
251
|
+
it "return 0 if none of the matchers are matching" do
|
252
|
+
score_for(@view, "input,select").should == 0
|
253
|
+
end
|
254
|
+
|
255
|
+
it "gets the max score if there are multiple matches" do
|
256
|
+
score_for(@view, "view,.classy,view#my-view").should == 2
|
257
|
+
end
|
258
|
+
end
|
153
259
|
end
|
154
260
|
end
|
@@ -1,5 +1,50 @@
|
|
1
|
-
describe UnderOs::UI::Button do
|
2
|
-
|
3
|
-
UnderOs::UI::Button.new
|
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
|
4
49
|
end
|
5
50
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
describe "UnderOs::UI::Div" do
|
2
|
+
before do
|
3
|
+
@div = UnderOs::UI::Div.new
|
4
|
+
end
|
5
|
+
|
6
|
+
describe "constructor" do
|
7
|
+
it "builds an UnderOs::UI::Div instance" do
|
8
|
+
@div.class.should == UnderOs::UI::Div
|
9
|
+
end
|
10
|
+
|
11
|
+
it "wraps a generic UIView element" do
|
12
|
+
@div._.class.should == UIView
|
13
|
+
end
|
14
|
+
|
15
|
+
it "has the DIV tag assigned to the element" do
|
16
|
+
@div.tagName.should == "DIV"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "handles the usual options" do
|
20
|
+
div = UnderOs::UI::Div.new(id: 'my-div')
|
21
|
+
div.id.should == 'my-div'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
describe "UnderOs::UI::Form" do
|
2
|
+
before do
|
3
|
+
@form = UnderOs::UI::Form.new
|
4
|
+
end
|
5
|
+
|
6
|
+
describe "constructor" do
|
7
|
+
it "makes the UnderOs::UI::Form instances" do
|
8
|
+
@form.class.should == UnderOs::UI::Form
|
9
|
+
end
|
10
|
+
|
11
|
+
it "assigns the FORM tag for the element" do
|
12
|
+
@form.tagName.should == "FORM"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "takes the usual HTML params" do
|
16
|
+
form = UnderOs::UI::Form.new(id: 'my-form')
|
17
|
+
form.id.should == 'my-form'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#elements' do
|
22
|
+
before do
|
23
|
+
@view = UnderOs::UI::View.new
|
24
|
+
@icon = UnderOs::UI::Icon.new
|
25
|
+
@input = UnderOs::UI::Input.new
|
26
|
+
@button = UnderOs::UI::Button.new
|
27
|
+
|
28
|
+
@form.append @view.append(@icon), @input, @button
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns inputs and buttons" do
|
32
|
+
@form.elements.should == [@icon, @input, @button]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#inputs" do
|
37
|
+
it "returns an empty list when there is no input elements" do
|
38
|
+
@form.inputs.should == []
|
39
|
+
end
|
40
|
+
|
41
|
+
it "returns the list of the input elements only" do
|
42
|
+
v1 = UnderOs::UI::View.new
|
43
|
+
i1 = UnderOs::UI::Input.new
|
44
|
+
i2 = UnderOs::UI::Select.new
|
45
|
+
i3 = UnderOs::UI::Switch.new
|
46
|
+
i4 = UnderOs::UI::Textarea.new
|
47
|
+
|
48
|
+
@form.append v1.append(i1, i2), i3, i4
|
49
|
+
|
50
|
+
@form.inputs.should == [i1, i2, i3, i4]
|
51
|
+
end
|
52
|
+
|
53
|
+
class MyInput1 < UnderOs::UI::Input; end
|
54
|
+
class MyInput2 < MyInput1; end
|
55
|
+
|
56
|
+
it "handles subclasses of the inputs as well" do
|
57
|
+
i1 = MyInput1.new
|
58
|
+
i2 = MyInput2.new
|
59
|
+
i3 = UnderOs::UI::Input.new
|
60
|
+
|
61
|
+
@form.append i1, i2, i3
|
62
|
+
|
63
|
+
@form.inputs.should == [i1, i2, i3]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "#values" do
|
68
|
+
before do
|
69
|
+
@i1 = UnderOs::UI::Input.new(name: 'username', value: 'Nikolay')
|
70
|
+
@i2 = UnderOs::UI::Input.new(name: 'password', value: 'TheOsom')
|
71
|
+
|
72
|
+
@form.append @i1, @i2
|
73
|
+
end
|
74
|
+
|
75
|
+
it "returns a hash of the values" do
|
76
|
+
@form.values.should == {'username' => 'Nikolay', 'password' => 'TheOsom'}
|
77
|
+
end
|
78
|
+
|
79
|
+
it "skips inputs without names" do
|
80
|
+
@i2.name = nil
|
81
|
+
@form.values.should == {'username' => 'Nikolay'}
|
82
|
+
end
|
83
|
+
|
84
|
+
it "skips disabled inputs" do
|
85
|
+
@i1.disabled = true
|
86
|
+
@form.values.should == {'password' => 'TheOsom'}
|
87
|
+
end
|
88
|
+
|
89
|
+
it "handles nested hashes in the names" do
|
90
|
+
@i1.name = 'user[username]'
|
91
|
+
@i2.name = 'user[password]'
|
92
|
+
|
93
|
+
@form.values.should == {'user' => {'username' => 'Nikolay', 'password' => 'TheOsom'}}
|
94
|
+
end
|
95
|
+
|
96
|
+
it "handles the array names notation" do
|
97
|
+
@i1.name = 'fields[]'
|
98
|
+
@i2.name = 'fields[]'
|
99
|
+
|
100
|
+
@form.values.should == {'fields' => ['Nikolay', 'TheOsom']}
|
101
|
+
end
|
102
|
+
|
103
|
+
describe 'with a checkbox input' do
|
104
|
+
before do
|
105
|
+
@checkbox = UnderOs::UI::Switch.new(name: 'isawesome', value: 'true')
|
106
|
+
@form.append @checkbox
|
107
|
+
end
|
108
|
+
|
109
|
+
it "counts in checkboxes when they're switched on" do
|
110
|
+
@checkbox.checked = true
|
111
|
+
@form.values.should == {'username' => 'Nikolay', 'password' => 'TheOsom', 'isawesome' => 'true'}
|
112
|
+
end
|
113
|
+
|
114
|
+
it "skips the input if it's not ON" do
|
115
|
+
@checkbox.checked = false
|
116
|
+
@form.values.should == {'username' => 'Nikolay', 'password' => 'TheOsom'}
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#disable' do
|
122
|
+
before do
|
123
|
+
@icon = UnderOs::UI::Icon.new
|
124
|
+
@input = UnderOs::UI::Input.new
|
125
|
+
@button = UnderOs::UI::Button.new
|
126
|
+
|
127
|
+
@form.append @icon, @input, @button
|
128
|
+
end
|
129
|
+
|
130
|
+
it "disabled all the elements on the form" do
|
131
|
+
@form.disable
|
132
|
+
|
133
|
+
@icon.disabled.should == true
|
134
|
+
@input.disabled.should == true
|
135
|
+
@button.disabled.should == true
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#enable' do
|
140
|
+
before do
|
141
|
+
@icon = UnderOs::UI::Icon.new(disabled: true)
|
142
|
+
@input = UnderOs::UI::Input.new(disabled: true)
|
143
|
+
@button = UnderOs::UI::Button.new(disabled: true)
|
144
|
+
|
145
|
+
@form.append @icon, @input, @button
|
146
|
+
end
|
147
|
+
|
148
|
+
it "disabled all the elements on the form" do
|
149
|
+
@form.enable
|
150
|
+
|
151
|
+
@icon.disabled.should == false
|
152
|
+
@input.disabled.should == false
|
153
|
+
@button.disabled.should == false
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -1,6 +1,21 @@
|
|
1
|
-
describe UnderOs::UI::Icon do
|
1
|
+
describe "UnderOs::UI::Icon" do
|
2
|
+
before do
|
3
|
+
@icon = UnderOs::UI::Icon.new
|
4
|
+
end
|
2
5
|
|
3
6
|
describe '#initialize' do
|
7
|
+
it "builds the UnderOs::UI::Icon instances" do
|
8
|
+
@icon.class.should == UnderOs::UI::Icon
|
9
|
+
end
|
10
|
+
|
11
|
+
it "wraps an UIButton object" do
|
12
|
+
@icon._.class.should == UIButton
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should assign correct tag name" do
|
16
|
+
@icon.tagName.should == 'ICON'
|
17
|
+
end
|
18
|
+
|
4
19
|
it "should allow to initialize the icon with type" do
|
5
20
|
icon = UnderOs::UI::Icon.new('ok')
|
6
21
|
icon.type.should == 'ok'
|
@@ -10,10 +25,6 @@ describe UnderOs::UI::Icon do
|
|
10
25
|
icon = UnderOs::UI::Icon.new(type: 'ok')
|
11
26
|
icon.size.should == 20
|
12
27
|
end
|
13
|
-
|
14
|
-
it "should assign correct tag name" do
|
15
|
-
UnderOs::UI::Icon.new.tagName.should == 'ICON'
|
16
|
-
end
|
17
28
|
end
|
18
29
|
|
19
30
|
describe '#type' do
|
@@ -23,4 +34,24 @@ describe UnderOs::UI::Icon do
|
|
23
34
|
end
|
24
35
|
end
|
25
36
|
|
37
|
+
describe '#disabled' do
|
38
|
+
it "returns 'false' by default" do
|
39
|
+
@icon.disabled.should == false
|
40
|
+
end
|
41
|
+
|
42
|
+
it "reads the value right of the ios entity" do
|
43
|
+
@icon._.enabled = false
|
44
|
+
@icon.disabled.should == true
|
45
|
+
end
|
46
|
+
|
47
|
+
it "allows to disable the inputs" do
|
48
|
+
@icon.disabled = true
|
49
|
+
@icon._.isEnabled.should == false
|
50
|
+
end
|
51
|
+
|
52
|
+
it "has a ruby-style alias" do
|
53
|
+
@icon.disabled?.should == false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
26
57
|
end
|
@@ -16,6 +16,11 @@ describe UnderOs::UI::Input do
|
|
16
16
|
@input.tagName.should == 'INPUT'
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should accept the 'name' option" do
|
20
|
+
input = UnderOs::UI::Input.new(name: 'some_name')
|
21
|
+
input.name.should == 'some_name'
|
22
|
+
end
|
23
|
+
|
19
24
|
it "should accept the 'value' option" do
|
20
25
|
input = UnderOs::UI::Input.new(value: 'boo hoo')
|
21
26
|
input.value.should == 'boo hoo'
|
@@ -32,21 +37,28 @@ describe UnderOs::UI::Input do
|
|
32
37
|
end
|
33
38
|
end
|
34
39
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
describe '#type' do
|
41
|
+
# it "should handle the 'password' type correctly" do
|
42
|
+
# @input.type = 'password'
|
43
|
+
# @input._.secureTextEntry.should == true
|
44
|
+
# end
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
46
|
+
# it "should convert the input type back" do
|
47
|
+
# @input.type = 'password'
|
48
|
+
# @input.type.should == :password
|
49
|
+
# end
|
50
|
+
|
51
|
+
it "should return 'text' by default" do
|
52
|
+
@input.type.should == :text
|
53
|
+
end
|
54
|
+
end
|
45
55
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
describe '#name' do
|
57
|
+
it "should assign the name to an input field" do
|
58
|
+
@input.name = 'newname'
|
59
|
+
@input.name.should == 'newname'
|
60
|
+
end
|
61
|
+
end
|
50
62
|
|
51
63
|
describe '#value' do
|
52
64
|
it "should assign the value to the wrapped element" do
|
@@ -74,4 +86,24 @@ describe UnderOs::UI::Input do
|
|
74
86
|
end
|
75
87
|
end
|
76
88
|
|
89
|
+
describe '#disabled' do
|
90
|
+
it "returns 'false' by default" do
|
91
|
+
@input.disabled.should == false
|
92
|
+
end
|
93
|
+
|
94
|
+
it "reads the value right of the ios entity" do
|
95
|
+
@input._.enabled = false
|
96
|
+
@input.disabled.should == true
|
97
|
+
end
|
98
|
+
|
99
|
+
it "allows to disable the inputs" do
|
100
|
+
@input.disabled = true
|
101
|
+
@input._.isEnabled.should == false
|
102
|
+
end
|
103
|
+
|
104
|
+
it "has a ruby-style alias" do
|
105
|
+
@input.disabled?.should == false
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
77
109
|
end
|
@@ -3,6 +3,10 @@ describe UnderOs::UI::Select do
|
|
3
3
|
@select = UnderOs::UI::Select.new
|
4
4
|
end
|
5
5
|
|
6
|
+
it "inherits fromthe UnderOs::UI::Input" do
|
7
|
+
(UnderOs::UI::Select < UnderOs::UI::Input).should == true
|
8
|
+
end
|
9
|
+
|
6
10
|
describe '#initialize' do
|
7
11
|
it "should make select instances" do
|
8
12
|
@select.class.should == UnderOs::UI::Select
|
@@ -3,6 +3,10 @@ describe UnderOs::UI::Slider do
|
|
3
3
|
@slider = UnderOs::UI::Slider.new
|
4
4
|
end
|
5
5
|
|
6
|
+
it "inherits fromthe UnderOs::UI::Input" do
|
7
|
+
(UnderOs::UI::Slider < UnderOs::UI::Input).should == true
|
8
|
+
end
|
9
|
+
|
6
10
|
describe '#initialize' do
|
7
11
|
it "should spawn new sliders" do
|
8
12
|
@slider.class.should == UnderOs::UI::Slider
|
@@ -3,6 +3,10 @@ describe UnderOs::UI::Switch do
|
|
3
3
|
@switch = UnderOs::UI::Switch.new
|
4
4
|
end
|
5
5
|
|
6
|
+
it "inherits fromthe UnderOs::UI::Input" do
|
7
|
+
(UnderOs::UI::Switch < UnderOs::UI::Input).should == true
|
8
|
+
end
|
9
|
+
|
6
10
|
describe '#initialize' do
|
7
11
|
it "should spawn new switchs" do
|
8
12
|
@switch.class.should == UnderOs::UI::Switch
|
@@ -3,6 +3,10 @@ describe UnderOs::UI::Textarea do
|
|
3
3
|
@textarea = UnderOs::UI::Textarea.new
|
4
4
|
end
|
5
5
|
|
6
|
+
it "inherits fromthe UnderOs::UI::Input" do
|
7
|
+
(UnderOs::UI::Textarea < UnderOs::UI::Input).should == true
|
8
|
+
end
|
9
|
+
|
6
10
|
describe '#initialize' do
|
7
11
|
it "should spawn new textareas" do
|
8
12
|
@textarea.class.should == UnderOs::UI::Textarea
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: under-os
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikolay Nemshilov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: motion-facon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: A web-broser like wrapper over iOS
|
@@ -45,8 +45,8 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
49
|
-
- .travis.yml
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
50
|
- Gemfile
|
51
51
|
- Gemfile.lock
|
52
52
|
- README.md
|
@@ -124,6 +124,8 @@ files:
|
|
124
124
|
- lib/under_os/ui/collection/item.rb
|
125
125
|
- lib/under_os/ui/collection/layout.rb
|
126
126
|
- lib/under_os/ui/collection/styles.rb
|
127
|
+
- lib/under_os/ui/div.rb
|
128
|
+
- lib/under_os/ui/form.rb
|
127
129
|
- lib/under_os/ui/icon.rb
|
128
130
|
- lib/under_os/ui/icon/awesome.rb
|
129
131
|
- lib/under_os/ui/icon/engine.rb
|
@@ -148,7 +150,6 @@ files:
|
|
148
150
|
- lib/under_os/ui/utils/animation.rb
|
149
151
|
- lib/under_os/ui/utils/commons.rb
|
150
152
|
- lib/under_os/ui/utils/dimensions.rb
|
151
|
-
- lib/under_os/ui/utils/editable.rb
|
152
153
|
- lib/under_os/ui/utils/events.rb
|
153
154
|
- lib/under_os/ui/utils/manipulation.rb
|
154
155
|
- lib/under_os/ui/utils/position.rb
|
@@ -186,6 +187,8 @@ files:
|
|
186
187
|
- spec/lib/under_os/timer_spec.rb
|
187
188
|
- spec/lib/under_os/ui/button_spec.rb
|
188
189
|
- spec/lib/under_os/ui/collection_spec.rb
|
190
|
+
- spec/lib/under_os/ui/div_spec.rb
|
191
|
+
- spec/lib/under_os/ui/form_spec.rb
|
189
192
|
- spec/lib/under_os/ui/icon_spec.rb
|
190
193
|
- spec/lib/under_os/ui/image_spec.rb
|
191
194
|
- spec/lib/under_os/ui/input_spec.rb
|
@@ -225,12 +228,12 @@ require_paths:
|
|
225
228
|
- lib
|
226
229
|
required_ruby_version: !ruby/object:Gem::Requirement
|
227
230
|
requirements:
|
228
|
-
- -
|
231
|
+
- - ">="
|
229
232
|
- !ruby/object:Gem::Version
|
230
233
|
version: '0'
|
231
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
235
|
requirements:
|
233
|
-
- -
|
236
|
+
- - ">="
|
234
237
|
- !ruby/object:Gem::Version
|
235
238
|
version: '0'
|
236
239
|
requirements: []
|
@@ -267,6 +270,8 @@ test_files:
|
|
267
270
|
- spec/lib/under_os/timer_spec.rb
|
268
271
|
- spec/lib/under_os/ui/button_spec.rb
|
269
272
|
- spec/lib/under_os/ui/collection_spec.rb
|
273
|
+
- spec/lib/under_os/ui/div_spec.rb
|
274
|
+
- spec/lib/under_os/ui/form_spec.rb
|
270
275
|
- spec/lib/under_os/ui/icon_spec.rb
|
271
276
|
- spec/lib/under_os/ui/image_spec.rb
|
272
277
|
- spec/lib/under_os/ui/input_spec.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# A little trait to handle the common editable fields API
|
3
|
-
#
|
4
|
-
module UnderOs::UI::Editable
|
5
|
-
KEYBOARDS = {
|
6
|
-
default: UIKeyboardTypeDefault,
|
7
|
-
ascii: UIKeyboardTypeASCIICapable,
|
8
|
-
numeric: UIKeyboardTypeNumbersAndPunctuation,
|
9
|
-
url: UIKeyboardTypeURL,
|
10
|
-
numbers: UIKeyboardTypeNumberPad,
|
11
|
-
phone: UIKeyboardTypePhonePad,
|
12
|
-
name: UIKeyboardTypeNamePhonePad,
|
13
|
-
email: UIKeyboardTypeEmailAddress,
|
14
|
-
decimal: UIKeyboardTypeDecimalPad,
|
15
|
-
twitter: UIKeyboardTypeTwitter,
|
16
|
-
search: UIKeyboardTypeWebSearch
|
17
|
-
}
|
18
|
-
|
19
|
-
def value
|
20
|
-
@_.text
|
21
|
-
end
|
22
|
-
|
23
|
-
def value=(value)
|
24
|
-
@_.text = value
|
25
|
-
end
|
26
|
-
|
27
|
-
def placeholder
|
28
|
-
@_.placeholder
|
29
|
-
end
|
30
|
-
|
31
|
-
def placeholder=(value)
|
32
|
-
@_.placeholder = value
|
33
|
-
end
|
34
|
-
|
35
|
-
def keyboard
|
36
|
-
KEYBOARDS.detect{|n,v| v == @_.keyboardType }[0]
|
37
|
-
end
|
38
|
-
|
39
|
-
def keyboard=(keyboard)
|
40
|
-
keyboard = keyboard.to_sym if keyboard.is_a?(String)
|
41
|
-
@_.keyboardType = KEYBOARDS[keyboard] || keyboard
|
42
|
-
end
|
43
|
-
end
|