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

#5060 compare tests #5299

Closed
wants to merge 2 commits into from
Closed

Conversation

knownasilya
Copy link
Contributor

Not sure, but they don't return the results specified by OP of #5060. Might be botching the test..

@knownasilya
Copy link
Contributor Author

Might not be passing the Comparable.detect test..

@knownasilya
Copy link
Contributor Author

@rwjblue @stefanpenner any ideas why this might return an unexpected result?

Failed assertion: First item comparable - returns -1 (not negated), expected: -1, but was: 1
Failed assertion: First item comparable - returns 0 (not negated), expected: 0, but was: 1
Failed assertion: Second item comparable - returns -1 (negated), expected: 1, but was: -1
Failed assertion: Second item comparable - returns 0 (negated), expected: 0, but was: -1

@adamnemecek
Copy link
Contributor

I think that there's an issue with the implementation of the compare function. It is supposed to take two arguments that it will compare, not return the value of the object.

@knownasilya
Copy link
Contributor Author

@adamnemecek my implementation? Could you point me to where you see this?

@adamnemecek
Copy link
Contributor

var Comp = EmberObject.extend(Comparable, {
  compare: function () {
    return this.get('val');
  }
});

I mean this. It's in your commit 8f2cab9.

@knownasilya
Copy link
Contributor Author

@adamnemecek that's a way to force a compare result so I don't have to deal with writing a compare function. So I set what it should output, e.g. var comp1 = Comp.create({ val: -1 });

@knownasilya
Copy link
Contributor Author

@adamnemecek not sure how to debug tests, so it's hard to see where the problem is. cc @rwjblue

@wagenet
Copy link
Member

wagenet commented Nov 1, 2014

@rwjblue @stefanpenner ping

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

Successfully merging this pull request may close these issues.

None yet

3 participants