calabash-android 0.5.11 → 0.5.12.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94c6e2b470cedf9656247543c5dc1770aabcc1f4
4
- data.tar.gz: 802fa73e9c59c81b9bce5a916caf8efea09120ae
3
+ metadata.gz: 687749f90a3d6925e20572e3c8c0f8a5f0da70c7
4
+ data.tar.gz: 7dc8452b1af1937e782c8efc79648adfe16712af
5
5
  SHA512:
6
- metadata.gz: 48cf3da5067bafc7c92ced64f27ddec626bbe51e242a912778be62ccc75e7aa03851e50637d3ba9dd1abd1c1cdf4945bd04dacbbd490ea3a9f839814f518f836
7
- data.tar.gz: 3d94971acca24214001a20581a8257583e157ea4ddd3d47b9604b52e3bc2675df4f030538b9a9a742e4ce0d238c922e6e55b4653487b80c91246eff475372892
6
+ metadata.gz: 701ad3949e4f2d1349c34f02feb8ee7214bc0dae885b73309dff1b8642c44317a2ac1bd699db62556baa9b170fa339a4fe5f10d31fd7b2bf9a1148ad95bead84
7
+ data.tar.gz: 16130bdfef459dc8a6e5e0b2bc3bbe9cf8782655a6db9f71588f7c04db9c712ee1d807c1c6995a2b3565099a5dd7aa0186ac895d949a3a6fe50cad0ea88037b8
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.5.11"
3
+ VERSION = "0.5.12.pre1"
4
4
  end
5
5
  end
@@ -24,9 +24,14 @@
24
24
  if (isHostMethod(object,'getBoundingClientRect'))
25
25
  {
26
26
  boundingBox = object.getBoundingClientRect();
27
- res['rect'] = boundingBox;
28
- res['rect'].center_x = boundingBox.left + Math.floor(boundingBox.width/2);
29
- res['rect'].center_y = boundingBox.top + Math.floor(boundingBox.height/2);
27
+ var rect = {};
28
+ rect.width = boundingBox.width;
29
+ rect.height = boundingBox.height;
30
+ rect.left = boundingBox.left;
31
+ rect.top = boundingBox.top;
32
+ res.rect = rect;
33
+ res.rect.center_x = rect.left + Math.floor(rect.width/2);
34
+ res.rect.center_y = rect.top + Math.floor(rect.height/2);
30
35
  }
31
36
  res.nodeType = NODE_TYPES[object.nodeType] || res.nodeType + ' (Unexpected)';
32
37
  res.nodeName = object.nodeName;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.11
4
+ version: 0.5.12.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Maturana Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2015-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -250,7 +250,6 @@ files:
250
250
  - test-server/AndroidManifest.xml
251
251
  - test-server/build.xml
252
252
  - test-server/calabash-js/src/calabash.js
253
- - test-server/calabash-js/src/set_text.js
254
253
  - lib/calabash-android/lib/TestServer.apk
255
254
  homepage: http://github.com/calabash
256
255
  licenses: []
@@ -266,9 +265,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
265
  version: '0'
267
266
  required_rubygems_version: !ruby/object:Gem::Requirement
268
267
  requirements:
269
- - - '>='
268
+ - - '>'
270
269
  - !ruby/object:Gem::Version
271
- version: '0'
270
+ version: 1.3.1
272
271
  requirements: []
273
272
  rubyforge_project:
274
273
  rubygems_version: 2.0.2
@@ -1,139 +0,0 @@
1
- (function () {
2
- function simulateKeyEvent(elem, character) {
3
- var ch = character.charCodeAt(0);
4
-
5
- var evt;
6
- evt = document.createEvent('KeyboardEvent');
7
- evt.initKeyboardEvent('keydown', true, true, window, 0, 0, 0, 0, 0, ch);
8
- elem.dispatchEvent(evt);
9
-
10
- evt = document.createEvent('KeyboardEvent');
11
- evt.initKeyboardEvent('keyup', true, true, window, 0, 0, 0, 0, 0, ch);
12
- elem.dispatchEvent(evt);
13
- evt = document.createEvent('KeyboardEvent');
14
- evt.initKeyboardEvent('keypress', true, true, window, 0, 0, 0, 0, 0, ch);
15
- elem.dispatchEvent(evt);
16
- }
17
-
18
-
19
- function enterTextIntoInputField(elem, text) {
20
- elem.value = "";
21
- for (var i = 0; i < text.length; i++) {
22
- var ch = text.charAt(i);
23
- elem.value += ch;
24
- simulateKeyEvent(elem, ch);
25
- }
26
- }
27
-
28
-
29
- function fireHTMLEvent(elem, eventName) {
30
- var evt = document.createEvent("HTMLEvents");
31
- evt.initEvent(eventName, true, true );
32
- return !elem.dispatchEvent(evt);
33
- }
34
-
35
- function selectInputField(elem) {
36
- elem.click();
37
- elem.focus();
38
- }
39
-
40
-
41
- function deselectInputField(elem) {
42
- fireHTMLEvent(elem, 'change');
43
- fireHTMLEvent(elem, 'blur');
44
- }
45
-
46
-
47
- /** David Mark's isHostMethod function,
48
- * http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
49
- * Modified to use strict equality
50
- */
51
- function isHostMethod (object, property)
52
- {
53
- var t = typeof object[property];
54
- return t==='function' ||
55
- (!!(t==='object' && object[property])) ||
56
- t==='unknown';
57
- }
58
- //http://www.w3.org/TR/DOM-Level-2-Core/core.html
59
- var NODE_TYPES = {
60
- /*ELEMENT_NODE : */ 1 : 'ELEMENT_NODE',
61
- /*ATTRIBUTE_NODE : */ 2: 'ATTRIBUTE_NODE',
62
- /*TEXT_NODE : */ 3 : 'TEXT_NODE',
63
- /*DOCUMENT_NODE : */ 9 : 'DOCUMENT_NODE'
64
- };
65
-
66
- function toJSON(object)
67
- {
68
- var res, i, N;
69
- if (typeof object==='undefined')
70
- {
71
- throw {message:'Calling toJSON with undefined'};
72
- }
73
- else if (object instanceof Node)//TODO: support for frames!
74
- {
75
- res = {};
76
- if (isHostMethod(object,'getBoundingClientRect'))
77
- {
78
- res['rect'] = object.getBoundingClientRect();
79
- }
80
- res.nodeType = NODE_TYPES[object.nodeType] || res.nodeType + ' (Unexpected)';
81
- res.nodeName = object.nodeName;
82
- res.id = object.id || '';
83
- res['class'] = object.className || '';
84
- if (object.hasOwnProperty('value')) {
85
- res.value = object.value;
86
- }
87
- res.html = object.outerHTML || '';
88
- res.nodeValue = object.nodeValue;
89
- }
90
- else if (object instanceof NodeList || //TODO: support for frames!
91
- (typeof object=='object' && object &&
92
- typeof object.length === 'number' &&
93
- object.length > 0 //array like
94
- && typeof object[0] !== 'undefined'))
95
- {
96
- res = [];
97
- for (i=0,N=object.length;i<N;i++)
98
- {
99
- res[i] = toJSON(object[i]);
100
- }
101
- }
102
- else
103
- {
104
- res = object;
105
- }
106
- return res;
107
- }
108
-
109
- ///TODO: no support for now frames
110
- //idea would be map XPath across window.frames
111
- //must take care of visibility questions
112
-
113
- try
114
- {
115
- var exp = JSON.parse('%@')/* dynamic */,
116
- el,
117
- text = '%@',
118
- i,N;
119
-
120
- el=document.elementFromPoint(exp.rect.left + exp.rect.width / 2, exp.rect.top + exp.rect.height / 2);
121
- if(exp.id){
122
- el = document.getElementById(exp.id);
123
- }
124
- if (/input/i.test(el.tagName))
125
- {
126
- selectInputField(el);
127
- enterTextIntoInputField(el, text);
128
- }
129
- else
130
- {
131
-
132
- }
133
- }
134
- catch (e)
135
- {
136
- return JSON.stringify({error:'Exception while running query: '+exp, details:e.toString()})
137
- }
138
- return JSON.stringify(toJSON(el));
139
- })();