Skip to content

Commit

Permalink
generation: refactor hand written adapters to generated ones
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Oct 3, 2017
1 parent b0dd098 commit 743b359
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions detox/src/ios/matchers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const invoke = require('../invoke');
const GreyMatchers = require('./earlgreyapi/GREYMatchers');
const GreyMatchersDetox = require('./earlgreyapi/GREYMatchers+Detox');

class Matcher {
Expand Down Expand Up @@ -48,8 +49,7 @@ class LabelMatcher extends Matcher {
class IdMatcher extends Matcher {
constructor(value) {
super();
if (typeof value !== 'string') throw new Error(`IdMatcher ctor argument must be a string, got ${typeof value}`);
this._call = invoke.call(invoke.IOS.Class('GREYMatchers'), 'matcherForAccessibilityID:', value);
this._call = invoke.callDirectly(GreyMatchers.matcherForAccessibilityID(value));
}
}

Expand Down Expand Up @@ -93,28 +93,28 @@ class TraitsMatcher extends Matcher {
class VisibleMatcher extends Matcher {
constructor() {
super();
this._call = invoke.call(invoke.IOS.Class('GREYMatchers'), 'matcherForSufficientlyVisible');
this._call = invoke.callDirectly(GreyMatchers.matcherForSufficientlyVisible());
}
}

class NotVisibleMatcher extends Matcher {
constructor() {
super();
this._call = invoke.call(invoke.IOS.Class('GREYMatchers'), 'matcherForNotVisible');
this._call = invoke.callDirectly(GreyMatchers.matcherForNotVisible());
}
}

class ExistsMatcher extends Matcher {
constructor() {
super();
this._call = invoke.call(invoke.IOS.Class('GREYMatchers'), 'matcherForNotNil');
this._call = invoke.callDirectly(GreyMatchers.matcherForNotNil());
}
}

class NotExistsMatcher extends Matcher {
constructor() {
super();
this._call = invoke.call(invoke.IOS.Class('GREYMatchers'), 'matcherForNil');
this._call = invoke.callDirectly(GreyMatchers.matcherForNil());
}
}

Expand All @@ -128,8 +128,7 @@ class TextMatcher extends Matcher {
class ValueMatcher extends Matcher {
constructor(value) {
super();
if (typeof value !== 'string') throw new Error(`ValueMatcher ctor argument must be a string, got ${typeof value}`);
this._call = invoke.call(invoke.IOS.Class('GREYMatchers'), 'matcherForAccessibilityValue:', value);
this._call = invoke.callDirectly(GreyMatchers.matcherForAccessibilityValue(value));
}
}

Expand Down

0 comments on commit 743b359

Please sign in to comment.