Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choose fails on this code example #23

Open
jashmenn opened this issue Jul 13, 2016 · 1 comment
Open

choose fails on this code example #23

jashmenn opened this issue Jul 13, 2016 · 1 comment
Labels

Comments

@jashmenn
Copy link
Member

Given the following javascript:

const TimersDashboard = React.createClass({
  handleEditFormSubmit: function (attrs) {
    this.updateTimer(attrs);
  },
  handleTrashClick: function (timerId) {
    this.deleteTimer(timerId);
  },
  createTimer: function (timer) {
    const t = helpers.newTimer(timer);
    this.setState({
      timers: this.state.timers.concat(t),
    });
  },
  deleteTimer: function (timerId) {
    this.setState({
      timers: this.state.timers.filter((t => t.id !== timerId)),
    });
  }
});

We need to pick the range from handleTrackClick to deleteTimer.

The following query doesnt work:

(.TimersDashboard .handleTrashClick)-(choose(.deleteTimer, 1))

@jashmenn jashmenn added the bug label Jul 13, 2016
@acco
Copy link
Collaborator

acco commented Jul 14, 2016

Note: Not blocking, just discovered this.

Possibly related: It doesn't appear you can choose() a parent and then select a child?

const SomeOtherComponent = () => (
  <TimersDashboard />
);

const TimersDashboard = React.createClass({
  handleEditFormSubmit: function (attrs) {
    this.updateTimer(attrs);
  },
});

If I ran this query:

choose(.TimersDashboard,1)

I'd correctly get the whole TimersDashboard declaration. However, if I wanted to just grab this:

handleEditFormSubmit: function (attrs) {
    this.updateTimer(attrs);
  },

Running this:

choose(.TimersDashboard,1) .handleEditFormSubmit

Returns the whole parent:

const TimersDashboard = React.createClass({
  handleEditFormSubmit: function (attrs) {
    this.updateTimer(attrs);
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants