You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractTestHint.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 test hint's (text) value which is to be consumed by the tests.
  25. */
  26. value: string
  27. }
  28. /**
  29. * Maps (parts of) the redux state to {@link TestHint}'s React {@code Component}
  30. * props.
  31. *
  32. * @param {Object} state - The redux store/state.
  33. * @private
  34. * @returns {{
  35. * _testModeEnabled: boolean
  36. * }}
  37. */
  38. export function _mapStateToProps(state: Object) {
  39. return {
  40. /**
  41. * The indicator which determines whether the test mode is enabled.
  42. *
  43. * @protected
  44. * @type {boolean}
  45. */
  46. _testModeEnabled: isTestModeEnabled(state)
  47. };
  48. }