xolvio / rtd

DEPRECATED: The Test Runner for Meteor
164 stars 37 forks source link

How to set context attribute value in helpers? #166

Closed D-Ne0 closed 10 years ago

D-Ne0 commented 10 years ago

Hi

I have this code which I want to test.

Template.xyz.helpers({
  some_helper: function() {
    var id = Session.get('id');
    if(id == this._id)
      return true;
  }
});

But I don't know how to set the value of this._id. Template.xyz.addContextAttribute('_id', 1) doesn't work. It only works for events I think.

samhatoum commented 10 years ago

That's in the example :)

Here's the code and here's the test setup

D-Ne0 commented 10 years ago

My Bad. I missed it. Thanks!

samhatoum commented 10 years ago

No worries