選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AbstractTestHint.ts 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { GestureResponderEvent } from 'react-native';
  2. import { IReduxState } from '../../../app/types';
  3. import { isTestModeEnabled } from '../functions';
  4. /**
  5. * Describes the {@link TestHint}'s properties.
  6. *
  7. * A test hint is meant to resemble the lack of the ability to execute
  8. * JavaScript by the mobile torture tests. They are used to expose some of
  9. * the app's internal state that is not always expressed in a feasible manner by
  10. * the UI.
  11. */
  12. export type TestHintProps = {
  13. /**
  14. * The indicator which determines whether the test mode is enabled.
  15. * {@link TestHint} Components are rendered only if this flag is set to
  16. * {@code true}.
  17. */
  18. _testModeEnabled: boolean;
  19. /**
  20. * The test hint's identifier string. Must be unique in the app instance
  21. * scope.
  22. */
  23. id: string;
  24. /**
  25. * The optional "on press" handler which can be used to bind a click handler
  26. * to a {@link TestHint}.
  27. */
  28. onPress?: (e?: GestureResponderEvent) => void;
  29. /**
  30. * The test hint's (text) value which is to be consumed by the tests.
  31. */
  32. value: string;
  33. };
  34. /**
  35. * Maps (parts of) the redux state to {@link TestHint}'s React {@code Component}
  36. * props.
  37. *
  38. * @param {Object} state - The redux store/state.
  39. * @private
  40. * @returns {{
  41. * _testModeEnabled: boolean
  42. * }}
  43. */
  44. export function _mapStateToProps(state: IReduxState) {
  45. return {
  46. /**
  47. * The indicator which determines whether the test mode is enabled.
  48. *
  49. * @protected
  50. * @type {boolean}
  51. */
  52. _testModeEnabled: isTestModeEnabled(state)
  53. };
  54. }