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,106 +0,0 @@
|
|
|
1
|
-
describe UnderOs::UI::Style::Margins do
|
|
2
|
-
before do
|
|
3
|
-
@view = UnderOs::UI::View.new
|
|
4
|
-
@style = @view.style
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
describe '#display' do
|
|
8
|
-
it "should return :block by default" do
|
|
9
|
-
@view.style.display.should == :block
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "should understand the 'none' value" do
|
|
13
|
-
@view.style.display = 'none'
|
|
14
|
-
@view.hidden.should == true
|
|
15
|
-
@view.style.display.should == :none
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should understand the 'block' value" do
|
|
19
|
-
@view.style.display = 'block'
|
|
20
|
-
@view.visible.should == true
|
|
21
|
-
@view.style.display.should == :block
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe '#margin' do
|
|
26
|
-
it "should return an array of zeros by default" do
|
|
27
|
-
@style.margin.should == [0, 0, 0, 0]
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it 'should accept simple numbers' do
|
|
31
|
-
@style.margin = 10
|
|
32
|
-
@style.margin.should == [10, 10, 10, 10]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "should accept arrays" do
|
|
36
|
-
@style.margin = [20]
|
|
37
|
-
@style.margin.should == [20, 20, 20, 20]
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it "should accept two dim arrays" do
|
|
41
|
-
@style.margin = [10, 20]
|
|
42
|
-
@style.margin.should == [10, 20, 10, 20]
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it "should accept four dims arrays" do
|
|
46
|
-
@style.margin = [10, 20, 30, 40]
|
|
47
|
-
@style.margin.should == [10, 20, 30, 40]
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it "should accept single value strings" do
|
|
51
|
-
@style.margin = '10px'
|
|
52
|
-
@style.margin.should == [10, 10, 10, 10]
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
it "should accept two value strings" do
|
|
56
|
-
@style.margin = '10px 20'
|
|
57
|
-
@style.margin.should == [10, 20, 10, 20]
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
it "should accept the four values strings" do
|
|
61
|
-
@style.margin = '10px 20 30px 40'
|
|
62
|
-
@style.margin.should == [10, 20, 30, 40]
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
describe '#padding' do
|
|
67
|
-
it "should return an array of zeros by default" do
|
|
68
|
-
@style.padding.should == [0, 0, 0, 0]
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it 'should accept simple numbers' do
|
|
72
|
-
@style.padding = 10
|
|
73
|
-
@style.padding.should == [10, 10, 10, 10]
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "should accept arrays" do
|
|
77
|
-
@style.padding = [20]
|
|
78
|
-
@style.padding.should == [20, 20, 20, 20]
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
it "should accept two dim arrays" do
|
|
82
|
-
@style.padding = [10, 20]
|
|
83
|
-
@style.padding.should == [10, 20, 10, 20]
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
it "should accept four dims arrays" do
|
|
87
|
-
@style.padding = [10, 20, 30, 40]
|
|
88
|
-
@style.padding.should == [10, 20, 30, 40]
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
it "should accept single value strings" do
|
|
92
|
-
@style.padding = '10px'
|
|
93
|
-
@style.padding.should == [10, 10, 10, 10]
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
it "should accept two value strings" do
|
|
97
|
-
@style.padding = '10px 20'
|
|
98
|
-
@style.padding.should == [10, 20, 10, 20]
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
it "should accept the four values strings" do
|
|
102
|
-
@style.padding = '10px 20 30px 40'
|
|
103
|
-
@style.padding.should == [10, 20, 30, 40]
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
end
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
describe UnderOs::UI::Style::Outlining do
|
|
2
|
-
before do
|
|
3
|
-
@view = UnderOs::UI::View.new
|
|
4
|
-
@style = @view.style
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
describe '#borderRadius' do
|
|
8
|
-
it "should allow to set it" do
|
|
9
|
-
@style.borderRadius = 10
|
|
10
|
-
@style.borderRadius.should == 10
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "should change the view's layout property" do
|
|
14
|
-
@style.borderRadius = 20
|
|
15
|
-
@view._.clipsToBounds.should == true
|
|
16
|
-
@view._.layer.cornerRadius.should == 20
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe '#color' do
|
|
21
|
-
describe 'buttons' do
|
|
22
|
-
before do
|
|
23
|
-
@button = UnderOs::UI::Button.new
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "should allow to set the colors" do
|
|
27
|
-
@button.style.color = UIColor.redColor
|
|
28
|
-
@button._.titleColorForState(UIControlStateNormal).should == UIColor.redColor
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "should return the curent button color" do
|
|
32
|
-
@button.style.color = UIColor.yellowColor
|
|
33
|
-
@button.style.color.should == UIColor.yellowColor
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe 'label' do
|
|
38
|
-
before do
|
|
39
|
-
@label = UnderOs::UI::Label.new
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "should change the text color" do
|
|
43
|
-
@label.style.color = UIColor.redColor
|
|
44
|
-
@label._.textColor.should == UIColor.redColor
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "should return the current text color" do
|
|
48
|
-
@label.style.color = UIColor.yellowColor
|
|
49
|
-
@label.style.color.should == UIColor.yellowColor
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe 'spinner' do
|
|
54
|
-
before do
|
|
55
|
-
@spinner = UnderOs::UI::Spinner.new
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "should change the color of the spinner" do
|
|
59
|
-
@spinner.style.color = UIColor.redColor
|
|
60
|
-
@spinner._.color.should == UIColor.redColor
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it "should return the current spinner color" do
|
|
64
|
-
@spinner.style.color = UIColor.yellowColor
|
|
65
|
-
@spinner.style.color.should == UIColor.yellowColor
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
describe '#boxShadow' do
|
|
71
|
-
it "recognizes the x, y values" do
|
|
72
|
-
@view.style.boxShadow = "1px 2px"
|
|
73
|
-
@view.style.boxShadow.should == "1.0 2.0 3.0 0.0 #ff0000"
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "recognizes the x, y, radius values" do
|
|
77
|
-
@view.style.boxShadow = "-1 -2 4"
|
|
78
|
-
@view.style.boxShadow.should == "-1.0 -2.0 4.0 0.0 #ff0000"
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
it "recognizes the x, y, radius, opacity values" do
|
|
82
|
-
@view.style.boxShadow = "4 5 6 7"
|
|
83
|
-
@view.style.boxShadow.should == "4.0 5.0 6.0 7.0 #ff0000"
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
it "recognizes the x, y, radius, opacity, color values" do
|
|
87
|
-
@view.style.boxShadow = "4 5 6 7 blue"
|
|
88
|
-
@view.style.boxShadow.should == "4.0 5.0 6.0 7.0 #ff0000"
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
it "recognizes the x, y, radius, color values" do
|
|
92
|
-
@view.style.boxShadow = "4 5 6 blue"
|
|
93
|
-
@view.style.boxShadow.should == "4.0 5.0 6.0 0.0 #ff0000"
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
it "recognizes the x, y, color values" do
|
|
97
|
-
@view.style.boxShadow = "4 5 green"
|
|
98
|
-
@view.style.boxShadow.should == "4.0 5.0 3.0 0.0 #ff0000"
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
describe UnderOs::UI::Style::Positioning do
|
|
2
|
-
before do
|
|
3
|
-
@view = UnderOs::UI::View.new
|
|
4
|
-
@style = @view.style
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
describe '#contentWidth' do
|
|
8
|
-
before do
|
|
9
|
-
@view = UnderOs::UI::Scroll.new
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "should allow to set the content sizes" do
|
|
13
|
-
@view.style.contentWidth = 100
|
|
14
|
-
@view.style.contentHeight = 200
|
|
15
|
-
|
|
16
|
-
@view.style.contentWidth.should == 100
|
|
17
|
-
@view.style.contentHeight.should == 200
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe '#zIndex' do
|
|
22
|
-
it "should return 0 by default" do
|
|
23
|
-
@view.style.zIndex.should == 0
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "should allow to change it" do
|
|
27
|
-
@view.style.zIndex = 100
|
|
28
|
-
@view.style.zIndex.should == 100
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe 'scroller related styles' do
|
|
33
|
-
before do
|
|
34
|
-
@view = UnderOs::UI::Scroll.new
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe '#overflow' do
|
|
38
|
-
it "accepts 'visible'" do
|
|
39
|
-
@view.style.overflow = 'visible'
|
|
40
|
-
@view.style.overflowX.should == :visible
|
|
41
|
-
@view.style.overflowY.should == :visible
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "accepts 'hidden'" do
|
|
45
|
-
@view.style.overflow = :hidden
|
|
46
|
-
@view.style.overflowX.should == :hidden
|
|
47
|
-
@view.style.overflowY.should == :hidden
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it "accepts 'x'" do
|
|
51
|
-
@view.style.overflow = 'x'
|
|
52
|
-
@view.style.overflowX.should == :visible
|
|
53
|
-
@view.style.overflowY.should == :hidden
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it "accepts 'y'" do
|
|
57
|
-
@view.style.overflow = 'y'
|
|
58
|
-
@view.style.overflowX.should == :hidden
|
|
59
|
-
@view.style.overflowY.should == :visible
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
it "falls back to 'visible'" do
|
|
63
|
-
@view.style.overflow = 'weird stuff'
|
|
64
|
-
@view.style.overflowX.should == :visible
|
|
65
|
-
@view.style.overflowY.should == :visible
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
describe UnderOs::UI::Style do
|
|
2
|
-
before do
|
|
3
|
-
@view = UnderOs::UI::View.new
|
|
4
|
-
@style = @view.style
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
it "should be an instance of UnderOs::UI::Style" do
|
|
8
|
-
@style.class.should == UnderOs::UI::Style
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "should incapsulate the Element's raw uiview object" do
|
|
12
|
-
@style.view.should === @view._
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "should always return the same object" do
|
|
16
|
-
@view.style.should === @style
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
describe UnderOs::UI::Switch do
|
|
2
|
-
before do
|
|
3
|
-
@switch = UnderOs::UI::Switch.new
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
it "inherits fromthe UnderOs::UI::Input" do
|
|
7
|
-
(UnderOs::UI::Switch < UnderOs::UI::Input).should == true
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe '#initialize' do
|
|
11
|
-
it "should spawn new switchs" do
|
|
12
|
-
@switch.class.should == UnderOs::UI::Switch
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "should wrap the UISwitch class" do
|
|
16
|
-
@switch._.class.should == UISwitch
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "should assign correct tag name" do
|
|
20
|
-
@switch.tagName.should == 'SWITCH'
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "should accept the 'value' option" do
|
|
24
|
-
switch = UnderOs::UI::Switch.new(value: 'smth')
|
|
25
|
-
switch.value.should == 'smth'
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "should accept the 'checked' option" do
|
|
29
|
-
switch = UnderOs::UI::Switch.new(checked: true)
|
|
30
|
-
switch.checked.should == true
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe '#value' do
|
|
35
|
-
it "should save the value correctly" do
|
|
36
|
-
@switch.value = 'something'
|
|
37
|
-
@switch.value.should == 'something'
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe '#checked' do
|
|
42
|
-
it "should allow to flip the switch on" do
|
|
43
|
-
@switch.checked = true
|
|
44
|
-
@switch._.on?.should == true
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "should allow to flip the switch off" do
|
|
48
|
-
@switch.checked = false
|
|
49
|
-
@switch._.on?.should == false
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "should return the state back correctly" do
|
|
53
|
-
@switch.checked = true
|
|
54
|
-
@switch.checked.should == true
|
|
55
|
-
|
|
56
|
-
@switch.checked = false
|
|
57
|
-
@switch.checked.should == false
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
describe UnderOs::UI::Textarea do
|
|
2
|
-
before do
|
|
3
|
-
@textarea = UnderOs::UI::Textarea.new
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
it "inherits fromthe UnderOs::UI::Input" do
|
|
7
|
-
(UnderOs::UI::Textarea < UnderOs::UI::Input).should == true
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe '#initialize' do
|
|
11
|
-
it "should spawn new textareas" do
|
|
12
|
-
@textarea.class.should == UnderOs::UI::Textarea
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "should wrap the UITextView class" do
|
|
16
|
-
@textarea._.class.should == UITextView
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "should assign correct tag name" do
|
|
20
|
-
@textarea.tagName.should == 'TEXTAREA'
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "should accept the 'value' option" do
|
|
24
|
-
textarea = UnderOs::UI::Textarea.new(value: 'boo hoo')
|
|
25
|
-
textarea.value.should == 'boo hoo'
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "should accept the 'keyboard' option" do
|
|
29
|
-
textarea = UnderOs::UI::Textarea.new(keyboard: 'email')
|
|
30
|
-
textarea.keyboard.should == :email
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
describe UnderOs::UI::Commons do
|
|
2
|
-
before do
|
|
3
|
-
@view = UnderOs::UI::View.new
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
describe '#id' do
|
|
7
|
-
it "should allow build views with ids" do
|
|
8
|
-
view = UnderOs::UI::View.new(id: 'my-id')
|
|
9
|
-
view.id.should == 'my-id'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "should allow to change the id" do
|
|
13
|
-
view = UnderOs::UI::View.new(id: 'old-id')
|
|
14
|
-
view.id = 'new-id'
|
|
15
|
-
view.id.should == 'new-id'
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe '#data' do
|
|
20
|
-
it "should allow to specify the data hash with views constructor" do
|
|
21
|
-
view = UnderOs::UI::View.new(data: {my: 'data'})
|
|
22
|
-
view.data.should == {my: 'data'}
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it "should allow to assign the new data" do
|
|
26
|
-
view = UnderOs::UI::View.new(data: {old: 'data'})
|
|
27
|
-
view.data = {new: 'data'}
|
|
28
|
-
view.data.should == {new: 'data'}
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe '#hidden' do
|
|
33
|
-
it "shoudl return 'false' for visible views" do
|
|
34
|
-
@view.hidden.should == false
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "should return 'true' for hidden views" do
|
|
38
|
-
@view._.hidden = true
|
|
39
|
-
@view.hidden.should == true
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
describe '#visible' do
|
|
44
|
-
it "should return 'true' if the element's visible" do
|
|
45
|
-
@view.visible.should == true
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "should return 'false' if the element's is hidden" do
|
|
49
|
-
@view._.hidden = true
|
|
50
|
-
@view.visible.should == false
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
describe '#hide' do
|
|
55
|
-
it "should hide elmements" do
|
|
56
|
-
@view.hide
|
|
57
|
-
@view.hidden.should == true
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe '#show' do
|
|
62
|
-
it "should show hidden elements" do
|
|
63
|
-
@view.hide
|
|
64
|
-
@view.show
|
|
65
|
-
@view.visible.should == true
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
describe '#toggle' do
|
|
70
|
-
it "should show an element if it's hidden" do
|
|
71
|
-
@view.hide
|
|
72
|
-
@view.toggle
|
|
73
|
-
@view.visible.should == true
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "should hide visible elements" do
|
|
77
|
-
@view.toggle
|
|
78
|
-
@view.hidden.should == true
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|