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.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +25 -2
  4. data/README.md +1 -1
  5. data/Rakefile +2 -4
  6. data/lib/under-os.rb +3 -8
  7. data/under-os.gemspec +6 -2
  8. metadata +47 -191
  9. data/lib/assets/fontawesome-webfont.ttf +0 -0
  10. data/lib/assets/under-os.css +0 -115
  11. data/lib/under_os.rb +0 -41
  12. data/lib/under_os/app.rb +0 -33
  13. data/lib/under_os/color.rb +0 -184
  14. data/lib/under_os/config.rb +0 -33
  15. data/lib/under_os/core/array.rb +0 -5
  16. data/lib/under_os/core/hash.rb +0 -10
  17. data/lib/under_os/core/json.rb +0 -19
  18. data/lib/under_os/core/kernel.rb +0 -16
  19. data/lib/under_os/core/numeric.rb +0 -23
  20. data/lib/under_os/core/object.rb +0 -9
  21. data/lib/under_os/core/string.rb +0 -80
  22. data/lib/under_os/delegate.rb +0 -10
  23. data/lib/under_os/events.rb +0 -85
  24. data/lib/under_os/file.rb +0 -110
  25. data/lib/under_os/history.rb +0 -53
  26. data/lib/under_os/http.rb +0 -31
  27. data/lib/under_os/http/cookies.rb +0 -30
  28. data/lib/under_os/http/receiver.rb +0 -44
  29. data/lib/under_os/http/request.rb +0 -106
  30. data/lib/under_os/http/response.rb +0 -28
  31. data/lib/under_os/http/session.rb +0 -49
  32. data/lib/under_os/page.rb +0 -169
  33. data/lib/under_os/page/builder.rb +0 -96
  34. data/lib/under_os/page/layout.rb +0 -43
  35. data/lib/under_os/page/matcher.rb +0 -128
  36. data/lib/under_os/page/stylesheet.rb +0 -67
  37. data/lib/under_os/parser.rb +0 -24
  38. data/lib/under_os/parser/css.rb +0 -37
  39. data/lib/under_os/parser/html.rb +0 -97
  40. data/lib/under_os/point.rb +0 -47
  41. data/lib/under_os/screen.rb +0 -9
  42. data/lib/under_os/timer.rb +0 -65
  43. data/lib/under_os/ui.rb +0 -3
  44. data/lib/under_os/ui/alert.rb +0 -52
  45. data/lib/under_os/ui/button.rb +0 -42
  46. data/lib/under_os/ui/collection.rb +0 -65
  47. data/lib/under_os/ui/collection/cell.rb +0 -21
  48. data/lib/under_os/ui/collection/delegate.rb +0 -70
  49. data/lib/under_os/ui/collection/item.rb +0 -32
  50. data/lib/under_os/ui/collection/layout.rb +0 -43
  51. data/lib/under_os/ui/collection/styles.rb +0 -15
  52. data/lib/under_os/ui/div.rb +0 -3
  53. data/lib/under_os/ui/form.rb +0 -60
  54. data/lib/under_os/ui/icon.rb +0 -61
  55. data/lib/under_os/ui/icon/awesome.rb +0 -376
  56. data/lib/under_os/ui/icon/engine.rb +0 -10
  57. data/lib/under_os/ui/image.rb +0 -31
  58. data/lib/under_os/ui/input.rb +0 -140
  59. data/lib/under_os/ui/label.rb +0 -21
  60. data/lib/under_os/ui/locker.rb +0 -42
  61. data/lib/under_os/ui/navbar.rb +0 -123
  62. data/lib/under_os/ui/progress.rb +0 -17
  63. data/lib/under_os/ui/scroll.rb +0 -41
  64. data/lib/under_os/ui/select.rb +0 -95
  65. data/lib/under_os/ui/sidebar.rb +0 -45
  66. data/lib/under_os/ui/slider.rb +0 -37
  67. data/lib/under_os/ui/spinner.rb +0 -23
  68. data/lib/under_os/ui/style.rb +0 -21
  69. data/lib/under_os/ui/style/fonts.rb +0 -54
  70. data/lib/under_os/ui/style/margins.rb +0 -164
  71. data/lib/under_os/ui/style/outlining.rb +0 -170
  72. data/lib/under_os/ui/style/positioning.rb +0 -169
  73. data/lib/under_os/ui/switch.rb +0 -26
  74. data/lib/under_os/ui/textarea.rb +0 -19
  75. data/lib/under_os/ui/utils/animation.rb +0 -99
  76. data/lib/under_os/ui/utils/commons.rb +0 -70
  77. data/lib/under_os/ui/utils/dimensions.rb +0 -37
  78. data/lib/under_os/ui/utils/events.rb +0 -170
  79. data/lib/under_os/ui/utils/manipulation.rb +0 -44
  80. data/lib/under_os/ui/utils/position.rb +0 -21
  81. data/lib/under_os/ui/utils/size.rb +0 -21
  82. data/lib/under_os/ui/utils/styles.rb +0 -89
  83. data/lib/under_os/ui/utils/traversing.rb +0 -44
  84. data/lib/under_os/ui/utils/wrap.rb +0 -77
  85. data/lib/under_os/ui/view.rb +0 -31
  86. data/resources/test.png +0 -0
  87. data/spec/assets/app.css +0 -13
  88. data/spec/assets/test.css +0 -7
  89. data/spec/assets/test.html +0 -3
  90. data/spec/assets/test_page.rb +0 -2
  91. data/spec/lib/core/hash_spec.rb +0 -19
  92. data/spec/lib/core/json_spec.rb +0 -32
  93. data/spec/lib/core/numeric_spec.rb +0 -37
  94. data/spec/lib/core/string_spec.rb +0 -121
  95. data/spec/lib/under_os/color_spec.rb +0 -133
  96. data/spec/lib/under_os/events_spec.rb +0 -71
  97. data/spec/lib/under_os/file_spec.rb +0 -98
  98. data/spec/lib/under_os/http/cookies_spec.rb +0 -13
  99. data/spec/lib/under_os/http/request_spec.rb +0 -44
  100. data/spec/lib/under_os/http_spec.rb +0 -20
  101. data/spec/lib/under_os/page/builder_spec.rb +0 -128
  102. data/spec/lib/under_os/page/layout_spec.rb +0 -18
  103. data/spec/lib/under_os/page/matcher_spec.rb +0 -260
  104. data/spec/lib/under_os/page/stylesheet_spec.rb +0 -83
  105. data/spec/lib/under_os/page_spec.rb +0 -5
  106. data/spec/lib/under_os/parser/css_spec.rb +0 -77
  107. data/spec/lib/under_os/parser/html_spec.rb +0 -152
  108. data/spec/lib/under_os/parser_spec.rb +0 -16
  109. data/spec/lib/under_os/point_spec.rb +0 -54
  110. data/spec/lib/under_os/screen_spec.rb +0 -11
  111. data/spec/lib/under_os/timer_spec.rb +0 -93
  112. data/spec/lib/under_os/ui/button_spec.rb +0 -50
  113. data/spec/lib/under_os/ui/collection_spec.rb +0 -19
  114. data/spec/lib/under_os/ui/div_spec.rb +0 -24
  115. data/spec/lib/under_os/ui/form_spec.rb +0 -156
  116. data/spec/lib/under_os/ui/icon_spec.rb +0 -57
  117. data/spec/lib/under_os/ui/image_spec.rb +0 -39
  118. data/spec/lib/under_os/ui/input_spec.rb +0 -109
  119. data/spec/lib/under_os/ui/label_spec.rb +0 -22
  120. data/spec/lib/under_os/ui/locker_spec.rb +0 -31
  121. data/spec/lib/under_os/ui/progress_spec.rb +0 -31
  122. data/spec/lib/under_os/ui/scroll_spec.rb +0 -40
  123. data/spec/lib/under_os/ui/select_spec.rb +0 -135
  124. data/spec/lib/under_os/ui/sidebar_spec.rb +0 -35
  125. data/spec/lib/under_os/ui/slider_spec.rb +0 -69
  126. data/spec/lib/under_os/ui/spinner_spec.rb +0 -57
  127. data/spec/lib/under_os/ui/style/fonts_spec.rb +0 -73
  128. data/spec/lib/under_os/ui/style/margins_spec.rb +0 -106
  129. data/spec/lib/under_os/ui/style/outlining_spec.rb +0 -101
  130. data/spec/lib/under_os/ui/style/positioning_spec.rb +0 -69
  131. data/spec/lib/under_os/ui/style_spec.rb +0 -19
  132. data/spec/lib/under_os/ui/switch_spec.rb +0 -60
  133. data/spec/lib/under_os/ui/textarea_spec.rb +0 -34
  134. data/spec/lib/under_os/ui/utils/commons_spec.rb +0 -81
  135. data/spec/lib/under_os/ui/utils/events_spec.rb +0 -87
  136. data/spec/lib/under_os/ui/utils/manipulation_spec.rb +0 -130
  137. data/spec/lib/under_os/ui/utils/styles_spec.rb +0 -140
  138. data/spec/lib/under_os/ui/utils/traversing_spec.rb +0 -124
  139. data/spec/lib/under_os/ui/utils/wrap_spec.rb +0 -69
  140. data/spec/lib/under_os/ui/view_spec.rb +0 -39
@@ -1,19 +0,0 @@
1
- describe UnderOs::UI::Collection do
2
- describe '#initialize' do
3
- before do
4
- @collection = UnderOs::UI::Collection.new
5
- end
6
-
7
- it "makes instances of UI::Collection" do
8
- @collection.class.should == UnderOs::UI::Collection
9
- end
10
-
11
- it "wraps the UICollectionView object" do
12
- @collection._.class.should == UICollectionView
13
- end
14
-
15
- it "assigns the COLLECTION class" do
16
- @collection.tagName.should == "COLLECTION"
17
- end
18
- end
19
- end
@@ -1,24 +0,0 @@
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
@@ -1,156 +0,0 @@
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,57 +0,0 @@
1
- describe "UnderOs::UI::Icon" do
2
- before do
3
- @icon = UnderOs::UI::Icon.new
4
- end
5
-
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
-
19
- it "should allow to initialize the icon with type" do
20
- icon = UnderOs::UI::Icon.new('ok')
21
- icon.type.should == 'ok'
22
- end
23
-
24
- it "should set the default size of 20 pixels" do
25
- icon = UnderOs::UI::Icon.new(type: 'ok')
26
- icon.size.should == 20
27
- end
28
- end
29
-
30
- describe '#type' do
31
- it "should compile types into acutal UTF-8 keys" do
32
- icon = UnderOs::UI::Icon.new(:ok)
33
- icon._.currentTitle.should == "\xEF\x80\x8C"
34
- end
35
- end
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
-
57
- end
@@ -1,39 +0,0 @@
1
- describe UnderOs::UI::Image do
2
-
3
- describe '#initialize' do
4
- before do
5
- @image = UnderOs::UI::Image.new(src: 'test.png')
6
- end
7
-
8
- it "should say it has the 'IMG' tag name" do
9
- @image.tagName.should == 'IMG'
10
- end
11
-
12
- it "should extract and assign the image source" do
13
- @image._.image.class.should == UIImage
14
- end
15
- end
16
-
17
-
18
- describe '#src' do
19
- before do
20
- @image = UnderOs::UI::Image.new
21
- end
22
-
23
- it "should be nil" do
24
- @image.src.should == nil
25
- end
26
-
27
- it "should allow to specify the source as a file name" do
28
- @image.src = 'test.png'
29
- @image.src.class.should == UIImage
30
- end
31
-
32
- it "should allow to specify the source as an UIImage object" do
33
- src = UIImage.imageNamed('test.png')
34
- @image.src = src
35
- @image.src.should == src
36
- end
37
- end
38
-
39
- end
@@ -1,109 +0,0 @@
1
- describe UnderOs::UI::Input do
2
- before do
3
- @input = UnderOs::UI::Input.new
4
- end
5
-
6
- describe '#initialize' do
7
- it "should spawn new inputs" do
8
- @input.class.should == UnderOs::UI::Input
9
- end
10
-
11
- it "should wrap the UITextField class" do
12
- @input._.class.should == UITextField
13
- end
14
-
15
- it "should assign correct tag name" do
16
- @input.tagName.should == 'INPUT'
17
- end
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
-
24
- it "should accept the 'value' option" do
25
- input = UnderOs::UI::Input.new(value: 'boo hoo')
26
- input.value.should == 'boo hoo'
27
- end
28
-
29
- it "should accept the 'placeholder' option" do
30
- input = UnderOs::UI::Input.new(placeholder: 'enter here')
31
- input.placeholder.should == 'enter here'
32
- end
33
-
34
- it "should accept the 'keyboard' option" do
35
- input = UnderOs::UI::Input.new(keyboard: 'email')
36
- input.keyboard.should == :email
37
- end
38
- end
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
45
-
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
55
-
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
62
-
63
- describe '#value' do
64
- it "should assign the value to the wrapped element" do
65
- @input.value = 'new value'
66
- @input._.text.should == 'new value'
67
- end
68
- end
69
-
70
- describe '#placeholder' do
71
- it "should assign the placeholder property on the wrapped element" do
72
- @input.placeholder = 'tap here'
73
- @input._.placeholder.should == 'tap here'
74
- end
75
- end
76
-
77
- describe '#keyboard' do
78
- it "should allow to assign keyboard types" do
79
- @input.keyboard = :url
80
- @input._.keyboardType.should == UIKeyboardTypeURL
81
- end
82
-
83
- it "should convert the keybaord types back to symbolic name in the getter" do
84
- @input.keyboard = :email
85
- @input.keyboard.should == :email
86
- end
87
- end
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
-
109
- end
@@ -1,22 +0,0 @@
1
- describe UnderOs::UI::Label do
2
- describe '#initialize' do
3
- it "should spawn new inputs" do
4
- label = UnderOs::UI::Label.new
5
- label.class.should == UnderOs::UI::Label
6
- end
7
-
8
- it "should wrap the UILabel class" do
9
- label = UnderOs::UI::Label.new
10
- label._.class.should == UILabel
11
- end
12
-
13
- it "should accept the 'text' option" do
14
- label = UnderOs::UI::Label.new(text: 'label text')
15
- label.text.should == 'label text'
16
- end
17
-
18
- it "should assign correct tag name" do
19
- UnderOs::UI::Label.new.tagName.should == 'LABEL'
20
- end
21
- end
22
- end
@@ -1,31 +0,0 @@
1
- describe UnderOs::UI::Locker do
2
- before do
3
- @locker = UnderOs::UI::Locker.new
4
- end
5
-
6
- describe '#constructor' do
7
- it "builds locker instances" do
8
- @locker.class.should == UnderOs::UI::Locker
9
- end
10
-
11
- it "wraps plain UIView objects" do
12
- @locker._.class.should == UIView
13
- end
14
-
15
- it "sets the LOCKER tag" do
16
- @locker.tagName.should == "LOCKER"
17
- end
18
-
19
- it "builds the dialog box inside" do
20
- @locker.first('view.locker-dialog').should.not == nil
21
- @locker.first('view.locker-dialog spinner').should.not == nil
22
- @locker.first('view.locker-dialog label').should.not == nil
23
- end
24
-
25
- it "accepts the label text" do
26
- locker = UnderOs::UI::Locker.new(text: "Syncing...")
27
- locker.first('label').text.should == "Syncing..."
28
- locker.hasClass('with-label').should == true
29
- end
30
- end
31
- end