lebowski 0.2.0 → 0.2.1
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.
- data/History.md +12 -5
- data/lib/lebowski/foundation/application.rb +5 -1
- data/lib/lebowski/foundation/proxy_object.rb +5 -0
- data/lib/lebowski/runtime/sprout_core_extensions.rb +4 -0
- data/lib/lebowski/scui/views/select_field_tab.rb +3 -3
- data/lib/lebowski/spec/matchers/match_supporters/has_object_function.rb +6 -0
- data/lib/lebowski/spec/matchers/method_missing.rb +5 -0
- data/lib/lebowski/version.rb +1 -1
- data/resources/user-extensions.js +65 -18
- metadata +6 -6
data/History.md
CHANGED
@@ -1,19 +1,26 @@
|
|
1
|
-
# lebowski 0.2.
|
1
|
+
# lebowski 0.2.1 October 6, 2010
|
2
2
|
|
3
|
-
*
|
3
|
+
* Fixed MainApplication object's define_root_object method
|
4
|
+
* Added functionality to check if a SproutCore bundle has been loaded
|
5
|
+
* Updated framework to handle cases when an object crossed application context boundaries
|
6
|
+
* replace select_field method with select_button on the SelectFieldTabView proxy
|
7
|
+
|
8
|
+
# lebowski 0.2.0 August 20, 2010
|
9
|
+
|
10
|
+
* Now use MainApplication to start a main SproutCore application
|
4
11
|
* Improved application support in order to communicate with SproutCore apps loaded in iframes and pop-up windows
|
5
12
|
* Changed how paths are defined. No longer use define. Now use define_path
|
6
13
|
* Changed how path proxies are defined. No longer use proxy. Now use define_proxy
|
14
|
+
* Now performs lazy loading of proxies that are accessed through defined paths and defined proxies
|
7
15
|
* Added proxy for SC.SelectButtonView
|
8
16
|
* Added proxy for SC.WebView
|
9
17
|
* Added proxy for SCUI.SelectFieldTab
|
10
18
|
* Added proxy for SCUI.ColorWell
|
11
19
|
* Added proxy for SCUI.ContentEditableView
|
12
|
-
* Can now supply a string value to the main application browser parameter
|
13
20
|
* Added functionality to the PositionedElement mixin
|
14
21
|
* Updated the drag and drop user action so that you can specify mouse offsets
|
15
|
-
* Updated what
|
22
|
+
* Updated what values can be passed to the main application browser parameter. Can now supply string values and :chrome
|
16
23
|
|
17
|
-
# lebowski 0.1.1 2010
|
24
|
+
# lebowski 0.1.1 May 7, 2010
|
18
25
|
|
19
26
|
* Open source beta release
|
@@ -64,8 +64,12 @@ module Lebowski
|
|
64
64
|
return @responding_panes
|
65
65
|
end
|
66
66
|
|
67
|
+
def bundle_loaded?(bundle)
|
68
|
+
return @driver.is_sc_bundle_loaded(bundle)
|
69
|
+
end
|
70
|
+
|
67
71
|
def define_root_object(key, name, expected_type=nil)
|
68
|
-
return
|
72
|
+
return define_path(key, '$' + name, expected_type)
|
69
73
|
end
|
70
74
|
|
71
75
|
alias_method :define_framework, :define_root_object
|
@@ -240,12 +240,17 @@ module Lebowski
|
|
240
240
|
# DEPRECATED
|
241
241
|
def proxy(klass, rel_path)
|
242
242
|
puts "DEPRECATED: proxy is deprecated. use define_proxy instead"
|
243
|
+
puts "... klass = #{klass}"
|
244
|
+
puts "... rel_path = #{rel_path}"
|
243
245
|
define_proxy(klass, rel_path)
|
244
246
|
end
|
245
247
|
|
246
248
|
# DEPRECATED
|
247
249
|
def define(path, rel_path=nil, expected_type=nil)
|
248
250
|
puts "DEPRECATED: define is deprecated. use define_path instead"
|
251
|
+
puts "... path = #{path}"
|
252
|
+
puts "... rel_path = #{rel_path}"
|
253
|
+
puts "... expected_type = #{expected_type}"
|
249
254
|
define_path(path, rel_path, expected_type)
|
250
255
|
end
|
251
256
|
|
@@ -365,6 +365,10 @@ module Lebowski
|
|
365
365
|
|
366
366
|
# Selenium User Extension Utility Function Selenium Calls
|
367
367
|
|
368
|
+
def is_sc_bundle_loaded(bundle)
|
369
|
+
return __boolean_command("isScBundleLoaded", [bundle])
|
370
|
+
end
|
371
|
+
|
368
372
|
def get_sc_object_array_index_lookup(scpath, lookup_params)
|
369
373
|
encoded_params = ObjectEncoder.encode_hash(lookup_params)
|
370
374
|
return __number_array_command("getScObjectArrayIndexLookup", [scpath, encoded_params])
|
@@ -13,9 +13,9 @@ module Lebowski
|
|
13
13
|
class SelectFieldTabView < Lebowski::Foundation::Views::View
|
14
14
|
representing_sc_class 'SCUI.SelectFieldTab'
|
15
15
|
|
16
|
-
def
|
17
|
-
@
|
18
|
-
return @
|
16
|
+
def select_button
|
17
|
+
@select_button = child_views.find_first(SelectButtonView) if @select_button.nil?
|
18
|
+
return @select_button
|
19
19
|
end
|
20
20
|
|
21
21
|
def container
|
@@ -13,6 +13,12 @@ module Lebowski
|
|
13
13
|
|
14
14
|
return false if @args.length == 0
|
15
15
|
|
16
|
+
#
|
17
|
+
# Note: If the method name is "test" then trying to invoke
|
18
|
+
# a method with name "test" on the given object will always
|
19
|
+
# fail whenever __send__ is used. There appears to be an
|
20
|
+
# actual method called test that belongs to a Ruby object.
|
21
|
+
#
|
16
22
|
method_name = obj_property(@expected)
|
17
23
|
|
18
24
|
ret_val = nil
|
@@ -15,6 +15,11 @@ module Spec
|
|
15
15
|
# try other default pattern matchers
|
16
16
|
#
|
17
17
|
def method_missing(sym, *args, &block)
|
18
|
+
#
|
19
|
+
# Note: Be sure that the symbol does not contain the word "test". test
|
20
|
+
# is a private method on Ruby objects and will cause the Be and Has
|
21
|
+
# matches to fail.
|
22
|
+
#
|
18
23
|
return Lebowski::Spec::Matchers::Be.new(sym, *args) if sym.to_s =~ /^be_/
|
19
24
|
return Lebowski::Spec::Matchers::Has.new(sym, *args) if sym.to_s =~ /^have_/
|
20
25
|
return Lebowski::Spec::Operators::That.new(sym, *args) if sym.to_s =~ /^that_/
|
data/lib/lebowski/version.rb
CHANGED
@@ -42,7 +42,15 @@ var ScExt = {};
|
|
42
42
|
Checks if the given value is indeed an SC.Object
|
43
43
|
*/
|
44
44
|
ScExt.isScObject = function(obj) {
|
45
|
-
return (obj
|
45
|
+
return $SC.typeOf(obj) === $SC.T_OBJECT;
|
46
|
+
};
|
47
|
+
|
48
|
+
/**
|
49
|
+
Checks if the given value is either an instance of SC.Object or a JS hash object
|
50
|
+
*/
|
51
|
+
ScExt.isObject = function(obj) {
|
52
|
+
var type = $SC.typeOf(obj);
|
53
|
+
return type === $SC.T_OBJECT || type === $SC.T_HASH;
|
46
54
|
};
|
47
55
|
|
48
56
|
/**
|
@@ -163,6 +171,27 @@ ScExt.typeOfArrayContent = function(array) {
|
|
163
171
|
*/
|
164
172
|
ScExt.PathParser = {
|
165
173
|
|
174
|
+
/**
|
175
|
+
In order to identify an object of a specific type, we check properties on
|
176
|
+
the object instead of using the standard SC.kindOf or obj.kindOf function.
|
177
|
+
Why? Because there are potential cases where the object you are trying to
|
178
|
+
identify the type of comes from a different application context instead of
|
179
|
+
the current application context that $SC and $App currently refer to. For instance,
|
180
|
+
the app context is refering to an SC app within an iframe but some objects
|
181
|
+
within that app context are actually coming from the parent window that the iframe
|
182
|
+
is contained within. This means an object is crossing an app context.
|
183
|
+
|
184
|
+
Passing around different app contexts becomes tricky, especially for these
|
185
|
+
types of corner cases. Therefore it is just easier to check for specific
|
186
|
+
properties on an object to identify its type. We just have to make sure the
|
187
|
+
property to use is unique enough.
|
188
|
+
*/
|
189
|
+
_identifiers: {
|
190
|
+
'SC.Object': 'isObject',
|
191
|
+
'SC.View': 'isView',
|
192
|
+
'SC.CollectionView': 'itemViewForContentIndex'
|
193
|
+
},
|
194
|
+
|
166
195
|
_isArrayIndex: function (val) {
|
167
196
|
return isNaN(parseInt(val, 0)) === false;
|
168
197
|
},
|
@@ -265,6 +294,19 @@ ScExt.PathParser = {
|
|
265
294
|
return objPathChain;
|
266
295
|
},
|
267
296
|
|
297
|
+
/**
|
298
|
+
Will return the value associated with the given SC property path. If the
|
299
|
+
path evaluates to nothing then null will be returned. Example:
|
300
|
+
|
301
|
+
getPath('path.to.some.property')
|
302
|
+
|
303
|
+
In cases where you want to confirm that the value returned is an object
|
304
|
+
of a specific type, you can pass in the type as a string, such as 'SC.Object'.
|
305
|
+
if the type is not matched then null is returned. Example:
|
306
|
+
|
307
|
+
getPath('path.to.object', 'SC.Object')
|
308
|
+
|
309
|
+
*/
|
268
310
|
getPath: function(path, scClass) {
|
269
311
|
var chain = this.computeObjectChain(path);
|
270
312
|
if (chain.length === 0 ) return null;
|
@@ -272,7 +314,8 @@ ScExt.PathParser = {
|
|
272
314
|
|
273
315
|
if (!scClass) return pathValue;
|
274
316
|
|
275
|
-
|
317
|
+
var identifier = this._identifiers[scClass];
|
318
|
+
if (ScExt.isObject(pathValue) && identifier && pathValue[identifier] !== undefined) {
|
276
319
|
return pathValue;
|
277
320
|
} else {
|
278
321
|
return null;
|
@@ -1063,7 +1106,7 @@ Selenium.prototype._getScOpenedWindow = function(locatorType, locatorValue) {
|
|
1063
1106
|
to an actual SC view object.
|
1064
1107
|
*/
|
1065
1108
|
Selenium.prototype.doScViewScrollToVisible = function(path) {
|
1066
|
-
var view = $ScPath.getPath(path,
|
1109
|
+
var view = $ScPath.getPath(path, 'SC.View');
|
1067
1110
|
if (!view) return;
|
1068
1111
|
ScExt.viewScrollToVisible(view);
|
1069
1112
|
};
|
@@ -1299,7 +1342,7 @@ Selenium.prototype.getScTypeOfArrayContent = function(path) {
|
|
1299
1342
|
Returns a SproutCore object's GUID
|
1300
1343
|
*/
|
1301
1344
|
Selenium.prototype.getScGuid = function(path) {
|
1302
|
-
var value = $ScPath.getPath(path,
|
1345
|
+
var value = $ScPath.getPath(path, 'SC.Object');
|
1303
1346
|
var guid = $SC.guidFor(value);
|
1304
1347
|
return guid;
|
1305
1348
|
};
|
@@ -1308,7 +1351,7 @@ Selenium.prototype.getScGuid = function(path) {
|
|
1308
1351
|
Returns a SproutCore object's type
|
1309
1352
|
*/
|
1310
1353
|
Selenium.prototype.getScObjectClassName = function(path) {
|
1311
|
-
var obj = $ScPath.getPath(path,
|
1354
|
+
var obj = $ScPath.getPath(path, 'SC.Object');
|
1312
1355
|
if (!obj) return "";
|
1313
1356
|
var className = $SC._object_className(obj.constructor);
|
1314
1357
|
return (className === 'Anonymous') ? "" : className;
|
@@ -1318,7 +1361,7 @@ Selenium.prototype.getScObjectClassName = function(path) {
|
|
1318
1361
|
Checks if a SproutCore object is a kind of type
|
1319
1362
|
*/
|
1320
1363
|
Selenium.prototype.isScObjectKindOfClass = function(path, className) {
|
1321
|
-
var obj = $ScPath.getPath(path,
|
1364
|
+
var obj = $ScPath.getPath(path, 'SC.Object');
|
1322
1365
|
if (!obj) return false;
|
1323
1366
|
|
1324
1367
|
var klass = ScExt.string2ScClass(className);
|
@@ -1332,7 +1375,7 @@ Selenium.prototype.isScObjectKindOfClass = function(path, className) {
|
|
1332
1375
|
object derives from.
|
1333
1376
|
*/
|
1334
1377
|
Selenium.prototype.getScObjectClassNames = function(path) {
|
1335
|
-
var obj = $ScPath.getPath(path,
|
1378
|
+
var obj = $ScPath.getPath(path, 'SC.Object');
|
1336
1379
|
var classNames = ScExt.getScObjectClassNames(obj);
|
1337
1380
|
return classNames;
|
1338
1381
|
};
|
@@ -1360,7 +1403,7 @@ Selenium.prototype.getScLocalizedString = function(str) {
|
|
1360
1403
|
DOM elements into a string.
|
1361
1404
|
*/
|
1362
1405
|
Selenium.prototype.getScViewLayer = function(path) {
|
1363
|
-
var view = $ScPath.getPath(path,
|
1406
|
+
var view = $ScPath.getPath(path, 'SC.View');
|
1364
1407
|
if (!view) return "";
|
1365
1408
|
return view.get('layer').outerHTML;
|
1366
1409
|
};
|
@@ -1369,7 +1412,7 @@ Selenium.prototype.getScViewLayer = function(path) {
|
|
1369
1412
|
Gets a SproutCore view's frame
|
1370
1413
|
*/
|
1371
1414
|
Selenium.prototype.getScViewFrame = function(path) {
|
1372
|
-
var view = $ScPath.getPath(path,
|
1415
|
+
var view = $ScPath.getPath(path, 'SC.View');
|
1373
1416
|
if (!view) return "";
|
1374
1417
|
var frame = view.get('frame');
|
1375
1418
|
if (!frame) return null;
|
@@ -1403,6 +1446,10 @@ Selenium.prototype.getCssSelectorCount = function(selector) {
|
|
1403
1446
|
return result;
|
1404
1447
|
};
|
1405
1448
|
|
1449
|
+
Selenium.prototype.isScBundleLoaded = function(bundle) {
|
1450
|
+
return $SC.bundleIsLoaded(bundle);
|
1451
|
+
};
|
1452
|
+
|
1406
1453
|
/////// SC Core Query Specific Selenium Calls /////////////////
|
1407
1454
|
|
1408
1455
|
/**
|
@@ -1420,7 +1467,7 @@ Selenium.prototype.getCssSelectorCount = function(selector) {
|
|
1420
1467
|
otherwise -1 is returned
|
1421
1468
|
*/
|
1422
1469
|
Selenium.prototype.getScCoreQuery = function(path, selector) {
|
1423
|
-
var view = $ScPath.getPath(path,
|
1470
|
+
var view = $ScPath.getPath(path, 'SC.View');
|
1424
1471
|
if (!view) return -1;
|
1425
1472
|
|
1426
1473
|
var cq = null;
|
@@ -1585,13 +1632,13 @@ Selenium.prototype.getElementChildNodesCount = function(selector, elemIndex) {
|
|
1585
1632
|
/////// SC Collection View Specific Selenium Calls /////////////////
|
1586
1633
|
|
1587
1634
|
Selenium.prototype.getScCollectionViewContentGroupIndexes = function(path) {
|
1588
|
-
var collectionView = $ScPath.getPath(path,
|
1635
|
+
var collectionView = $ScPath.getPath(path, 'SC.CollectionView');
|
1589
1636
|
if (!collectionView) return [];
|
1590
1637
|
return ScExt.CollectionView.getContentGroupIndexes(collectionView);
|
1591
1638
|
};
|
1592
1639
|
|
1593
1640
|
Selenium.prototype.getScCollectionViewContentSelectedIndexes = function(path) {
|
1594
|
-
var collectionView = $ScPath.getPath(path,
|
1641
|
+
var collectionView = $ScPath.getPath(path, 'SC.CollectionView');
|
1595
1642
|
if (!collectionView) return [];
|
1596
1643
|
var selectionSet = collectionView.get('selection');
|
1597
1644
|
if (!selectionSet) return [];
|
@@ -1600,31 +1647,31 @@ Selenium.prototype.getScCollectionViewContentSelectedIndexes = function(path) {
|
|
1600
1647
|
};
|
1601
1648
|
|
1602
1649
|
Selenium.prototype.getScCollectionViewContentNowShowingIndexes = function(path) {
|
1603
|
-
var collectionView = $ScPath.getPath(path,
|
1650
|
+
var collectionView = $ScPath.getPath(path, 'SC.CollectionView');
|
1604
1651
|
if (!collectionView) return [];
|
1605
1652
|
return ScExt.indexSet2Array(collectionView.get('nowShowing'));
|
1606
1653
|
};
|
1607
1654
|
|
1608
1655
|
Selenium.prototype.getScCollectionViewContentIsGroup = function(path, index) {
|
1609
|
-
var collectionView = $ScPath.getPath(path,
|
1656
|
+
var collectionView = $ScPath.getPath(path, 'SC.CollectionView');
|
1610
1657
|
if (!collectionView) -1;
|
1611
1658
|
return ScExt.CollectionView.getContentIsGroup(collectionView, parseInt(index, 0));
|
1612
1659
|
};
|
1613
1660
|
|
1614
1661
|
Selenium.prototype.getScCollectionViewContentIsSelected = function(path, index) {
|
1615
|
-
var collectionView = $ScPath.getPath(path,
|
1662
|
+
var collectionView = $ScPath.getPath(path, 'SC.CollectionView');
|
1616
1663
|
if (!collectionView) -1;
|
1617
1664
|
return ScExt.CollectionView.getContentIsSelected(collectionView, parseInt(index, 0));
|
1618
1665
|
};
|
1619
1666
|
|
1620
1667
|
Selenium.prototype.getScCollectionViewContentDisclosureState = function(path, index) {
|
1621
|
-
var collectionView = $ScPath.getPath(path,
|
1668
|
+
var collectionView = $ScPath.getPath(path, 'SC.CollectionView');
|
1622
1669
|
if (!collectionView) -1;
|
1623
1670
|
return ScExt.CollectionView.getContentDisclosureState(collectionView, parseInt(index, 0));
|
1624
1671
|
};
|
1625
1672
|
|
1626
1673
|
Selenium.prototype.getScCollectionViewContentOutlineLevel = function(path, index) {
|
1627
|
-
var collectionView = $ScPath.getPath(path,
|
1674
|
+
var collectionView = $ScPath.getPath(path, 'SC.CollectionView');
|
1628
1675
|
if (!collectionView) -1;
|
1629
1676
|
return ScExt.CollectionView.getContentOutlineLevel(collectionView, parseInt(index, 0));
|
1630
1677
|
};
|
@@ -1658,7 +1705,7 @@ Selenium.prototype.getScCollectionViewContentOutlineLevel = function(path, index
|
|
1658
1705
|
*/
|
1659
1706
|
PageBot.prototype.locateElementByScPath = function(path) {
|
1660
1707
|
|
1661
|
-
var obj = $ScPath.getPath(path,
|
1708
|
+
var obj = $ScPath.getPath(path, 'SC.View');
|
1662
1709
|
if (!obj) return null;
|
1663
1710
|
|
1664
1711
|
// Return the view's layer. The layer is the root DOM element of the view
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lebowski
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Cohen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-06 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -195,7 +195,7 @@ licenses: []
|
|
195
195
|
post_install_message: |
|
196
196
|
**************************************************
|
197
197
|
|
198
|
-
Thank you for installing lebowski-0.2.
|
198
|
+
Thank you for installing lebowski-0.2.1
|
199
199
|
|
200
200
|
Please be sure to read the README.md and History.md
|
201
201
|
for useful information on how to use this framework
|
@@ -238,6 +238,6 @@ rubyforge_project: lebowski
|
|
238
238
|
rubygems_version: 1.3.7
|
239
239
|
signing_key:
|
240
240
|
specification_version: 3
|
241
|
-
summary: lebowski 0.2.
|
241
|
+
summary: lebowski 0.2.1
|
242
242
|
test_files: []
|
243
243
|
|