nytimes / react-tracking

🎯 Declarative tracking for React apps.
https://open.nytimes.com/introducing-react-tracking-declarative-tracking-for-react-apps-2c76706bb79a
Other
1.88k stars 123 forks source link

Add test for `@track((props, [event]) => {})` signature #46

Closed tizmagik closed 7 years ago

tizmagik commented 7 years ago

45 revealed that we're missing a test for this use case/function signature mentioned in the docs

  // In this case the tracking data depends on
  // some unknown (until runtime) value
  @track((props, [event]) => ({ // NOTE: This PR would change this function signature
    action: 'click',
    label: event.currentTarget.title || event.currentTarget.textContent
  }))
  handleClick = (event) => {
    if (this.props.onClick) {
      this.props.onClick(event);
    }
  }
tizmagik commented 7 years ago

Done in #45