Skip to content

Commit

Permalink
move from tabs to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed May 8, 2018
1 parent 5f435e9 commit 51b8214
Show file tree
Hide file tree
Showing 24 changed files with 3,576 additions and 3,576 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"useTabs": true,
"useTabs": false,
"tabWidth": 2,
"printWidth": 140,
"singleQuote": true,
Expand Down
244 changes: 122 additions & 122 deletions detox/src/android/espressoapi/DetoxAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,136 +5,136 @@
*/

function sanitize_android_edge(edge) {
switch (edge) {
case 'left':
return 1;
case 'right':
return 2;
case 'top':
return 3;
case 'bottom':
return 4;
default:
throw new Error(`edge must be a 'left'/'right'/'top'/'bottom', got ${edge}`);
}
switch (edge) {
case 'left':
return 1;
case 'right':
return 2;
case 'top':
return 3;
case 'bottom':
return 4;
default:
throw new Error(`edge must be a 'left'/'right'/'top'/'bottom', got ${edge}`);
}
}
function sanitize_android_direction(direction) {
switch (direction) {
case 'left':
return 1;
case 'right':
return 2;
case 'up':
return 3;
case 'down':
return 4;
default:
throw new Error(`direction must be a 'left'/'right'/'up'/'down', got ${direction}`);
}
switch (direction) {
case 'left':
return 1;
case 'right':
return 2;
case 'up':
return 3;
case 'down':
return 4;
default:
throw new Error(`direction must be a 'left'/'right'/'up'/'down', got ${direction}`);
}
}
class DetoxAction {
static multiClick(times) {
if (typeof times !== 'number') throw new Error('times should be a number, but got ' + (times + (' (' + (typeof times + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'multiClick',
args: [
{
type: 'Integer',
value: times
}
]
};
}
static multiClick(times) {
if (typeof times !== 'number') throw new Error('times should be a number, but got ' + (times + (' (' + (typeof times + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'multiClick',
args: [
{
type: 'Integer',
value: times
}
]
};
}

static tapAtLocation(x, y) {
if (typeof x !== 'number') throw new Error('x should be a number, but got ' + (x + (' (' + (typeof x + ')'))));
if (typeof y !== 'number') throw new Error('y should be a number, but got ' + (y + (' (' + (typeof y + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'tapAtLocation',
args: [
{
type: 'Integer',
value: x
},
{
type: 'Integer',
value: y
}
]
};
}
static tapAtLocation(x, y) {
if (typeof x !== 'number') throw new Error('x should be a number, but got ' + (x + (' (' + (typeof x + ')'))));
if (typeof y !== 'number') throw new Error('y should be a number, but got ' + (y + (' (' + (typeof y + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'tapAtLocation',
args: [
{
type: 'Integer',
value: x
},
{
type: 'Integer',
value: y
}
]
};
}

static scrollToEdge(edge) {
if (typeof edge !== 'string') throw new Error('edge should be a string, but got ' + (edge + (' (' + (typeof edge + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'scrollToEdge',
args: [
{
type: 'Integer',
value: sanitize_android_edge(edge)
}
]
};
}
static scrollToEdge(edge) {
if (typeof edge !== 'string') throw new Error('edge should be a string, but got ' + (edge + (' (' + (typeof edge + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'scrollToEdge',
args: [
{
type: 'Integer',
value: sanitize_android_edge(edge)
}
]
};
}

static scrollInDirection(direction, amountInDP) {
if (typeof direction !== 'string')
throw new Error('direction should be a string, but got ' + (direction + (' (' + (typeof direction + ')'))));
if (typeof amountInDP !== 'number')
throw new Error('amountInDP should be a number, but got ' + (amountInDP + (' (' + (typeof amountInDP + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'scrollInDirection',
args: [
{
type: 'Integer',
value: sanitize_android_direction(direction)
},
{
type: 'Double',
value: amountInDP
}
]
};
}
static scrollInDirection(direction, amountInDP) {
if (typeof direction !== 'string')
throw new Error('direction should be a string, but got ' + (direction + (' (' + (typeof direction + ')'))));
if (typeof amountInDP !== 'number')
throw new Error('amountInDP should be a number, but got ' + (amountInDP + (' (' + (typeof amountInDP + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'scrollInDirection',
args: [
{
type: 'Integer',
value: sanitize_android_direction(direction)
},
{
type: 'Double',
value: amountInDP
}
]
};
}

static swipeInDirection(direction, fast) {
if (typeof direction !== 'string')
throw new Error('direction should be a string, but got ' + (direction + (' (' + (typeof direction + ')'))));
if (typeof fast !== 'boolean') throw new Error('fast should be a boolean, but got ' + (fast + (' (' + (typeof fast + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'swipeInDirection',
args: [
{
type: 'Integer',
value: sanitize_android_direction(direction)
},
{
type: 'boolean',
value: fast
}
]
};
}
static swipeInDirection(direction, fast) {
if (typeof direction !== 'string')
throw new Error('direction should be a string, but got ' + (direction + (' (' + (typeof direction + ')'))));
if (typeof fast !== 'boolean') throw new Error('fast should be a boolean, but got ' + (fast + (' (' + (typeof fast + ')'))));
return {
target: {
type: 'Class',
value: 'com.wix.detox.espresso.DetoxAction'
},
method: 'swipeInDirection',
args: [
{
type: 'Integer',
value: sanitize_android_direction(direction)
},
{
type: 'boolean',
value: fast
}
]
};
}
}

module.exports = DetoxAction;
Loading

0 comments on commit 51b8214

Please sign in to comment.