How to use the cavy.hook function in cavy

To help you get started, we’ve selected a few cavy examples, based on popular ways it is used in public projects.

github pixielabs / cavy / sample-app / CavyDirectory / app / ActionBar.js View on Github external
}

  render() {
    const TestableActionButton = wrap(ActionButton);

    return (
      <View style={styles.container}>
        <TestableActionButton ref={this.props.generateTestHook('ActionBar.EmailButton')} text="email" icon={require('./assets/email.png')} onPress={this.sendMail.bind(this)}/>
        <ActionButton text="call" icon={require('./assets/call.png')} onPress={this.callNumber.bind(this)}/>
        <ActionButton text="message" icon={require('./assets/sms.png')} onPress={this.sendMessage.bind(this)}/>
      </View>
    );
  }
}

export default hook(ActionBar);

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
    justifyContent: 'space-around',
    backgroundColor: '#FAFAFF',
    paddingVertical: 8
  }
});
github pixielabs / cavy / sample-app / CavyDirectory / app / SearchBar.js View on Github external
render() {
    return (
      <View style={styles.container}>
        <TextInput
          ref={this.props.generateTestHook('SearchBar.TextInput', this.textInput)}
          style={styles.input}
          placeholder="Search"
          onChangeText={(value) => this._onChangeText(value)}
          value={this.state.value}
        />
      </View>
    )
  }
}

export default hook(SearchBar);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 8,
    flexDirection: 'row',
    alignItems: 'center',
    backgroundColor: '#C9C9CE',
  },
  input: {
    height: 30,
    flex: 1,
    paddingHorizontal: 8,
    backgroundColor: '#FFFFFF',
    borderRadius: 4,
  },

cavy

An integration test framework for React Native.

MIT
Latest version published 12 months ago

Package Health Score

67 / 100
Full package analysis

Similar packages