您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AbstractTestHint.js 1.5KB

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