paweldomas 6931b8f2fb feat(TestHint): add 'onPress' property
Allows to bind a click handler to a TestHint.

When a mobile test wants to click an UI element it must be able to
locate it through the accessibility layer. Now the problem with that is
that there is currently no uniform way for finding element on both iOS
and Android. This problem is solved by TestHint component which takes
an id parameter which then can be specified in the corresponding java
TestHint class in jitsi-meet-torture to easily find it. By being able to
add a click handler to a TestHint, it's possible to duplicate original
handler under nested TestHint and then find it easily on the torture
side.
2018-04-19 16:49:22 -05:00

62 lines
1.5 KiB
JavaScript

/* @flow */
import { isTestModeEnabled } from '../functions';
/**
* Describes the {@link TestHint}'s properties.
*
* A test hint is meant to resemble the lack of the ability to execute
* JavaScript by the mobile torture tests. They are used to expose some of
* the app's internal state that is not always expressed in a feasible manner by
* the UI.
*/
export type TestHintProps = {
/**
* The indicator which determines whether the test mode is enabled.
* {@link TestHint} components are rendered only if this flag is set to
* {@code true}.
*/
_testModeEnabled: boolean,
/**
* The test hint's identifier string. Must be unique in the app instance
* scope.
*/
id: string,
/**
* The optional "on press" handler which can be used to bind a click handler
* to a {@link TestHint}.
*/
onPress: ?Function,
/**
* The test hint's (text) value which is to be consumed by the tests.
*/
value: string
}
/**
* Maps (parts of) the redux state to {@link TestHint}'s React {@code Component}
* props.
*
* @param {Object} state - The redux store/state.
* @private
* @returns {{
* _testModeEnabled: boolean
* }}
*/
export function _mapStateToProps(state: Object) {
return {
/**
* The indicator which determines whether the test mode is enabled.
*
* @protected
* @type {boolean}
*/
_testModeEnabled: isTestModeEnabled(state)
};
}