motion-kit 0.0.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +839 -0
- data/lib/motion-kit-cocoa/cocoa_util.rb +59 -0
- data/lib/motion-kit-cocoa/constraints/constraint.rb +765 -0
- data/lib/motion-kit-cocoa/constraints/constraint_placeholder.rb +22 -0
- data/lib/motion-kit-cocoa/constraints/constraints_layout.rb +536 -0
- data/lib/motion-kit-cocoa/constraints/constraints_target.rb +52 -0
- data/lib/motion-kit-cocoa/layouts/cagradientlayer_layout.rb +13 -0
- data/lib/motion-kit-cocoa/layouts/calayer_layout.rb +27 -0
- data/lib/motion-kit-cocoa/layouts/sugarcube_compat.rb +38 -0
- data/lib/motion-kit-ios/dummy.rb +93 -0
- data/lib/motion-kit-ios/ios_util.rb +20 -0
- data/lib/motion-kit-ios/layouts/constraints_layout.rb +22 -0
- data/lib/motion-kit-ios/layouts/layout_device.rb +32 -0
- data/lib/motion-kit-ios/layouts/layout_orientation.rb +47 -0
- data/lib/motion-kit-ios/layouts/uibutton_layout.rb +52 -0
- data/lib/motion-kit-ios/layouts/uiview_layout.rb +45 -0
- data/lib/motion-kit-ios/layouts/uiview_layout_autoresizing.rb +75 -0
- data/lib/motion-kit-ios/layouts/uiview_layout_constraints.rb +36 -0
- data/lib/motion-kit-ios/layouts/uiview_layout_frame.rb +307 -0
- data/lib/motion-kit-ios/layouts/uiview_layout_gradient.rb +20 -0
- data/lib/motion-kit-osx/dummy.rb +89 -0
- data/lib/motion-kit-osx/layouts/constraints_layout.rb +42 -0
- data/lib/motion-kit-osx/layouts/nsmenu_extensions.rb +186 -0
- data/lib/motion-kit-osx/layouts/nsmenu_layout.rb +109 -0
- data/lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb +45 -0
- data/lib/motion-kit-osx/layouts/nstablecolumn_layout.rb +12 -0
- data/lib/motion-kit-osx/layouts/nstableview_layout.rb +20 -0
- data/lib/motion-kit-osx/layouts/nsview_layout.rb +47 -0
- data/lib/motion-kit-osx/layouts/nsview_layout_autoresizing.rb +75 -0
- data/lib/motion-kit-osx/layouts/nsview_layout_constraints.rb +34 -0
- data/lib/motion-kit-osx/layouts/nsview_layout_frame.rb +375 -0
- data/lib/motion-kit-osx/layouts/nswindow_frame.rb +14 -0
- data/lib/motion-kit-osx/layouts/nswindow_layout.rb +77 -0
- data/lib/motion-kit-osx/osx_util.rb +16 -0
- data/lib/motion-kit.rb +33 -0
- data/lib/motion-kit/calculate.rb +263 -0
- data/lib/motion-kit/layouts/base_layout.rb +299 -0
- data/lib/motion-kit/layouts/base_layout_class_methods.rb +43 -0
- data/lib/motion-kit/layouts/parent.rb +68 -0
- data/lib/motion-kit/layouts/view_layout.rb +327 -0
- data/lib/motion-kit/motion-kit.rb +18 -0
- data/lib/motion-kit/object.rb +16 -0
- data/lib/motion-kit/util.rb +20 -0
- data/lib/motion-kit/version.rb +1 -1
- data/spec/ios/apply_styles_spec.rb +21 -0
- data/spec/ios/autoresizing_helper_spec.rb +224 -0
- data/spec/ios/calculate_spec.rb +322 -0
- data/spec/ios/calculator_spec.rb +31 -0
- data/spec/ios/constraints_helpers/attribute_lookup_spec.rb +27 -0
- data/spec/ios/constraints_helpers/axis_lookup_spec.rb +13 -0
- data/spec/ios/constraints_helpers/center_constraints_spec.rb +419 -0
- data/spec/ios/constraints_helpers/constraint_placeholder_spec.rb +72 -0
- data/spec/ios/constraints_helpers/priority_lookup_spec.rb +19 -0
- data/spec/ios/constraints_helpers/relationship_lookup_spec.rb +27 -0
- data/spec/ios/constraints_helpers/relative_corners_spec.rb +274 -0
- data/spec/ios/constraints_helpers/relative_location_spec.rb +111 -0
- data/spec/ios/constraints_helpers/simple_constraints_spec.rb +2763 -0
- data/spec/ios/constraints_helpers/size_constraints_spec.rb +422 -0
- data/spec/ios/constraints_helpers/view_lookup_constraints_spec.rb +93 -0
- data/spec/ios/create_layout_spec.rb +40 -0
- data/spec/ios/custom_layout_spec.rb +13 -0
- data/spec/ios/deferred_spec.rb +89 -0
- data/spec/ios/device_helpers_spec.rb +51 -0
- data/spec/ios/frame_helper_spec.rb +1150 -0
- data/spec/ios/layer_layout_spec.rb +36 -0
- data/spec/ios/layout_extensions_spec.rb +70 -0
- data/spec/ios/layout_spec.rb +74 -0
- data/spec/ios/layout_state_spec.rb +27 -0
- data/spec/ios/motionkit_util_spec.rb +102 -0
- data/spec/ios/objc_selectors_spec.rb +10 -0
- data/spec/ios/orientation_helper_specs.rb +67 -0
- data/spec/ios/parent_layout_spec.rb +19 -0
- data/spec/ios/parent_spec.rb +45 -0
- data/spec/ios/remove_layout_spec.rb +25 -0
- data/spec/ios/root_layout_spec.rb +53 -0
- data/spec/ios/setters_spec.rb +63 -0
- data/spec/ios/uibutton_layout_spec.rb +24 -0
- data/spec/ios/uitextfield_spec.rb +14 -0
- data/spec/ios/view_attr_spec.rb +25 -0
- data/spec/osx/autoresizing_helper_spec.rb +224 -0
- data/spec/osx/constraints_helper_spec.rb +0 -0
- data/spec/osx/constraints_helpers/orientation_lookup_spec.rb +13 -0
- data/spec/osx/constraints_helpers/simple_constraints_spec.rb +2095 -0
- data/spec/osx/constraints_helpers/size_constraints_spec.rb +362 -0
- data/spec/osx/create_menu_spec.rb +14 -0
- data/spec/osx/create_via_extensions_spec.rb +63 -0
- data/spec/osx/deferred_spec.rb +85 -0
- data/spec/osx/frame_helper_spec.rb +1881 -0
- data/spec/osx/menu_extensions_spec.rb +376 -0
- data/spec/osx/menu_layout_spec.rb +157 -0
- data/spec/osx/menu_spec.rb +70 -0
- data/spec/osx/root_menu_spec.rb +15 -0
- metadata +166 -14
@@ -0,0 +1,70 @@
|
|
1
|
+
describe MK::MenuLayout do
|
2
|
+
|
3
|
+
before do
|
4
|
+
@subject = MK::MenuLayout.new
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'should return a menu from `default_root`' do
|
8
|
+
@subject.default_root.should.be.kind_of(NSMenu)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be able to add a submenu' do
|
12
|
+
menu = @subject.default_root
|
13
|
+
item = NSMenuItem.alloc.initWithTitle('', action: nil, keyEquivalent: '')
|
14
|
+
@subject.context(menu) do
|
15
|
+
@subject.add_child(item)
|
16
|
+
end
|
17
|
+
menu.itemArray.should == [item]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should be able to remove a submenu' do
|
21
|
+
menu = @subject.default_root
|
22
|
+
item = NSMenuItem.alloc.initWithTitle('', action: nil, keyEquivalent: '')
|
23
|
+
menu.addItem(item)
|
24
|
+
@subject.context(menu) do
|
25
|
+
@subject.remove_child(item)
|
26
|
+
end
|
27
|
+
menu.itemArray.should == []
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should have a `root` method that accepts a title' do
|
31
|
+
@subject.instance_variable_set(:@assign_root, true)
|
32
|
+
menu = @subject.root('Title')
|
33
|
+
menu.title.should == 'Title'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should have a `create` method that returns a menu' do
|
37
|
+
menu = @subject.create('Title')
|
38
|
+
menu.title.should == 'Title'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should have an `item` method that returns an NSMenuItem' do
|
42
|
+
item = @subject.item('Title')
|
43
|
+
item.title.should == 'Title'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should have an `item` method that accepts a :key' do
|
47
|
+
key = 'p'
|
48
|
+
item = @subject.item('Title', key: key)
|
49
|
+
item.keyEquivalent.should == key
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should have an `item` method that accepts a :keyEquivalent' do
|
53
|
+
key = 'p'
|
54
|
+
item = @subject.item('Title', keyEquivalent: key)
|
55
|
+
item.keyEquivalent.should == key
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should have an `item` method that accepts a :mask' do
|
59
|
+
mask = NSCommandKeyMask | NSAlternateKeyMask
|
60
|
+
item = @subject.item('Title', mask: mask)
|
61
|
+
item.keyEquivalentModifierMask.should == mask
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should have an `item` method that accepts an :action' do
|
65
|
+
action = 'action:'
|
66
|
+
item = @subject.item('Title', action: action)
|
67
|
+
item.action.should == action.to_sym
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
describe TestRootMenu do
|
2
|
+
|
3
|
+
before do
|
4
|
+
@subject = TestRootMenu.new
|
5
|
+
@subject.view
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should create a menu via "root"' do
|
9
|
+
menu = @subject.menu
|
10
|
+
menu.should.not == nil
|
11
|
+
menu.should.be.kind_of(NSMenu)
|
12
|
+
menu.title.should == 'Test Root'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
metadata
CHANGED
@@ -1,49 +1,201 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.9.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Colin T.A. Gray
|
8
|
+
- Jamon Holmgren
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
13
|
-
dependencies:
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: dbt
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
description: |
|
29
|
+
Don't worry, this'll be neat.
|
17
30
|
email:
|
18
31
|
- colinta@gmail.com
|
32
|
+
- jamon@clearsightstudio.com
|
19
33
|
executables: []
|
20
34
|
extensions: []
|
21
35
|
extra_rdoc_files: []
|
22
36
|
files:
|
37
|
+
- lib/motion-kit/calculate.rb
|
38
|
+
- lib/motion-kit/layouts/base_layout.rb
|
39
|
+
- lib/motion-kit/layouts/base_layout_class_methods.rb
|
40
|
+
- lib/motion-kit/layouts/parent.rb
|
41
|
+
- lib/motion-kit/layouts/view_layout.rb
|
42
|
+
- lib/motion-kit/motion-kit.rb
|
43
|
+
- lib/motion-kit/object.rb
|
44
|
+
- lib/motion-kit/util.rb
|
23
45
|
- lib/motion-kit/version.rb
|
46
|
+
- lib/motion-kit-cocoa/cocoa_util.rb
|
47
|
+
- lib/motion-kit-cocoa/constraints/constraint.rb
|
48
|
+
- lib/motion-kit-cocoa/constraints/constraint_placeholder.rb
|
49
|
+
- lib/motion-kit-cocoa/constraints/constraints_layout.rb
|
50
|
+
- lib/motion-kit-cocoa/constraints/constraints_target.rb
|
51
|
+
- lib/motion-kit-cocoa/layouts/cagradientlayer_layout.rb
|
52
|
+
- lib/motion-kit-cocoa/layouts/calayer_layout.rb
|
53
|
+
- lib/motion-kit-cocoa/layouts/sugarcube_compat.rb
|
54
|
+
- lib/motion-kit-ios/dummy.rb
|
55
|
+
- lib/motion-kit-ios/ios_util.rb
|
56
|
+
- lib/motion-kit-ios/layouts/constraints_layout.rb
|
57
|
+
- lib/motion-kit-ios/layouts/layout_device.rb
|
58
|
+
- lib/motion-kit-ios/layouts/layout_orientation.rb
|
59
|
+
- lib/motion-kit-ios/layouts/uibutton_layout.rb
|
60
|
+
- lib/motion-kit-ios/layouts/uiview_layout.rb
|
61
|
+
- lib/motion-kit-ios/layouts/uiview_layout_autoresizing.rb
|
62
|
+
- lib/motion-kit-ios/layouts/uiview_layout_constraints.rb
|
63
|
+
- lib/motion-kit-ios/layouts/uiview_layout_frame.rb
|
64
|
+
- lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
|
65
|
+
- lib/motion-kit-osx/dummy.rb
|
66
|
+
- lib/motion-kit-osx/layouts/constraints_layout.rb
|
67
|
+
- lib/motion-kit-osx/layouts/nsmenu_extensions.rb
|
68
|
+
- lib/motion-kit-osx/layouts/nsmenu_layout.rb
|
69
|
+
- lib/motion-kit-osx/layouts/nsmenuitem_extensions.rb
|
70
|
+
- lib/motion-kit-osx/layouts/nstablecolumn_layout.rb
|
71
|
+
- lib/motion-kit-osx/layouts/nstableview_layout.rb
|
72
|
+
- lib/motion-kit-osx/layouts/nsview_layout.rb
|
73
|
+
- lib/motion-kit-osx/layouts/nsview_layout_autoresizing.rb
|
74
|
+
- lib/motion-kit-osx/layouts/nsview_layout_constraints.rb
|
75
|
+
- lib/motion-kit-osx/layouts/nsview_layout_frame.rb
|
76
|
+
- lib/motion-kit-osx/layouts/nswindow_frame.rb
|
77
|
+
- lib/motion-kit-osx/layouts/nswindow_layout.rb
|
78
|
+
- lib/motion-kit-osx/osx_util.rb
|
79
|
+
- lib/motion-kit.rb
|
80
|
+
- README.md
|
81
|
+
- spec/ios/apply_styles_spec.rb
|
82
|
+
- spec/ios/autoresizing_helper_spec.rb
|
83
|
+
- spec/ios/calculate_spec.rb
|
84
|
+
- spec/ios/calculator_spec.rb
|
85
|
+
- spec/ios/constraints_helpers/attribute_lookup_spec.rb
|
86
|
+
- spec/ios/constraints_helpers/axis_lookup_spec.rb
|
87
|
+
- spec/ios/constraints_helpers/center_constraints_spec.rb
|
88
|
+
- spec/ios/constraints_helpers/constraint_placeholder_spec.rb
|
89
|
+
- spec/ios/constraints_helpers/priority_lookup_spec.rb
|
90
|
+
- spec/ios/constraints_helpers/relationship_lookup_spec.rb
|
91
|
+
- spec/ios/constraints_helpers/relative_corners_spec.rb
|
92
|
+
- spec/ios/constraints_helpers/relative_location_spec.rb
|
93
|
+
- spec/ios/constraints_helpers/simple_constraints_spec.rb
|
94
|
+
- spec/ios/constraints_helpers/size_constraints_spec.rb
|
95
|
+
- spec/ios/constraints_helpers/view_lookup_constraints_spec.rb
|
96
|
+
- spec/ios/create_layout_spec.rb
|
97
|
+
- spec/ios/custom_layout_spec.rb
|
98
|
+
- spec/ios/deferred_spec.rb
|
99
|
+
- spec/ios/device_helpers_spec.rb
|
100
|
+
- spec/ios/frame_helper_spec.rb
|
101
|
+
- spec/ios/layer_layout_spec.rb
|
102
|
+
- spec/ios/layout_extensions_spec.rb
|
103
|
+
- spec/ios/layout_spec.rb
|
104
|
+
- spec/ios/layout_state_spec.rb
|
105
|
+
- spec/ios/motionkit_util_spec.rb
|
106
|
+
- spec/ios/objc_selectors_spec.rb
|
107
|
+
- spec/ios/orientation_helper_specs.rb
|
108
|
+
- spec/ios/parent_layout_spec.rb
|
109
|
+
- spec/ios/parent_spec.rb
|
110
|
+
- spec/ios/remove_layout_spec.rb
|
111
|
+
- spec/ios/root_layout_spec.rb
|
112
|
+
- spec/ios/setters_spec.rb
|
113
|
+
- spec/ios/uibutton_layout_spec.rb
|
114
|
+
- spec/ios/uitextfield_spec.rb
|
115
|
+
- spec/ios/view_attr_spec.rb
|
116
|
+
- spec/osx/autoresizing_helper_spec.rb
|
117
|
+
- spec/osx/constraints_helper_spec.rb
|
118
|
+
- spec/osx/constraints_helpers/orientation_lookup_spec.rb
|
119
|
+
- spec/osx/constraints_helpers/simple_constraints_spec.rb
|
120
|
+
- spec/osx/constraints_helpers/size_constraints_spec.rb
|
121
|
+
- spec/osx/create_menu_spec.rb
|
122
|
+
- spec/osx/create_via_extensions_spec.rb
|
123
|
+
- spec/osx/deferred_spec.rb
|
124
|
+
- spec/osx/frame_helper_spec.rb
|
125
|
+
- spec/osx/menu_extensions_spec.rb
|
126
|
+
- spec/osx/menu_layout_spec.rb
|
127
|
+
- spec/osx/menu_spec.rb
|
128
|
+
- spec/osx/root_menu_spec.rb
|
24
129
|
homepage: https://github.com/rubymotion/motion-kit
|
25
130
|
licenses:
|
26
131
|
- BSD
|
132
|
+
metadata: {}
|
27
133
|
post_install_message:
|
28
134
|
rdoc_options: []
|
29
135
|
require_paths:
|
30
136
|
- lib
|
31
137
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
-
none: false
|
33
138
|
requirements:
|
34
|
-
- -
|
139
|
+
- - '>='
|
35
140
|
- !ruby/object:Gem::Version
|
36
141
|
version: '0'
|
37
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
143
|
requirements:
|
40
|
-
- -
|
144
|
+
- - '>='
|
41
145
|
- !ruby/object:Gem::Version
|
42
146
|
version: '0'
|
43
147
|
requirements: []
|
44
148
|
rubyforge_project:
|
45
|
-
rubygems_version:
|
149
|
+
rubygems_version: 2.0.3
|
46
150
|
signing_key:
|
47
|
-
specification_version:
|
151
|
+
specification_version: 4
|
48
152
|
summary: Dibs.
|
49
|
-
test_files:
|
153
|
+
test_files:
|
154
|
+
- spec/ios/apply_styles_spec.rb
|
155
|
+
- spec/ios/autoresizing_helper_spec.rb
|
156
|
+
- spec/ios/calculate_spec.rb
|
157
|
+
- spec/ios/calculator_spec.rb
|
158
|
+
- spec/ios/constraints_helpers/attribute_lookup_spec.rb
|
159
|
+
- spec/ios/constraints_helpers/axis_lookup_spec.rb
|
160
|
+
- spec/ios/constraints_helpers/center_constraints_spec.rb
|
161
|
+
- spec/ios/constraints_helpers/constraint_placeholder_spec.rb
|
162
|
+
- spec/ios/constraints_helpers/priority_lookup_spec.rb
|
163
|
+
- spec/ios/constraints_helpers/relationship_lookup_spec.rb
|
164
|
+
- spec/ios/constraints_helpers/relative_corners_spec.rb
|
165
|
+
- spec/ios/constraints_helpers/relative_location_spec.rb
|
166
|
+
- spec/ios/constraints_helpers/simple_constraints_spec.rb
|
167
|
+
- spec/ios/constraints_helpers/size_constraints_spec.rb
|
168
|
+
- spec/ios/constraints_helpers/view_lookup_constraints_spec.rb
|
169
|
+
- spec/ios/create_layout_spec.rb
|
170
|
+
- spec/ios/custom_layout_spec.rb
|
171
|
+
- spec/ios/deferred_spec.rb
|
172
|
+
- spec/ios/device_helpers_spec.rb
|
173
|
+
- spec/ios/frame_helper_spec.rb
|
174
|
+
- spec/ios/layer_layout_spec.rb
|
175
|
+
- spec/ios/layout_extensions_spec.rb
|
176
|
+
- spec/ios/layout_spec.rb
|
177
|
+
- spec/ios/layout_state_spec.rb
|
178
|
+
- spec/ios/motionkit_util_spec.rb
|
179
|
+
- spec/ios/objc_selectors_spec.rb
|
180
|
+
- spec/ios/orientation_helper_specs.rb
|
181
|
+
- spec/ios/parent_layout_spec.rb
|
182
|
+
- spec/ios/parent_spec.rb
|
183
|
+
- spec/ios/remove_layout_spec.rb
|
184
|
+
- spec/ios/root_layout_spec.rb
|
185
|
+
- spec/ios/setters_spec.rb
|
186
|
+
- spec/ios/uibutton_layout_spec.rb
|
187
|
+
- spec/ios/uitextfield_spec.rb
|
188
|
+
- spec/ios/view_attr_spec.rb
|
189
|
+
- spec/osx/autoresizing_helper_spec.rb
|
190
|
+
- spec/osx/constraints_helper_spec.rb
|
191
|
+
- spec/osx/constraints_helpers/orientation_lookup_spec.rb
|
192
|
+
- spec/osx/constraints_helpers/simple_constraints_spec.rb
|
193
|
+
- spec/osx/constraints_helpers/size_constraints_spec.rb
|
194
|
+
- spec/osx/create_menu_spec.rb
|
195
|
+
- spec/osx/create_via_extensions_spec.rb
|
196
|
+
- spec/osx/deferred_spec.rb
|
197
|
+
- spec/osx/frame_helper_spec.rb
|
198
|
+
- spec/osx/menu_extensions_spec.rb
|
199
|
+
- spec/osx/menu_layout_spec.rb
|
200
|
+
- spec/osx/menu_spec.rb
|
201
|
+
- spec/osx/root_menu_spec.rb
|