2018-03-07 15:23:04 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2018-04-18 18:06:04 +00:00
|
|
|
import { isTestModeEnabled } from '../functions';
|
|
|
|
|
2018-03-07 15:23:04 +00:00
|
|
|
/**
|
|
|
|
* 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 = {
|
|
|
|
|
2018-04-18 18:06:04 +00:00
|
|
|
/**
|
|
|
|
* 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,
|
|
|
|
|
2018-03-07 15:23:04 +00:00
|
|
|
/**
|
|
|
|
* The test hint's identifier string. Must be unique in the app instance
|
|
|
|
* scope.
|
|
|
|
*/
|
|
|
|
id: string,
|
|
|
|
|
2018-04-18 18:15:01 +00:00
|
|
|
/**
|
|
|
|
* The optional "on press" handler which can be used to bind a click handler
|
|
|
|
* to a {@link TestHint}.
|
|
|
|
*/
|
|
|
|
onPress: ?Function,
|
|
|
|
|
2018-03-07 15:23:04 +00:00
|
|
|
/**
|
|
|
|
* The test hint's (text) value which is to be consumed by the tests.
|
|
|
|
*/
|
|
|
|
value: string
|
|
|
|
}
|
2018-04-18 18:06:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
};
|
|
|
|
}
|