Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

bug(mocks): Correctly calls workFn with "this". #6102

Closed
wants to merge 1 commit into from

Conversation

wesalvaro
Copy link
Contributor

Currently, the workFn is called with the implied, global "this" instead of the current context as it should be.
See this bin for the problem and suggested solution:
http://jsbin.com/EDohOlih/1/edit

Currently, the workFn is called with the implied, global "this" instead of the current context as it should be.
See this bin for the problem and suggested solution:
http://jsbin.com/EDohOlih/1/edit
@IgorMinar
Copy link
Contributor

oops.. I'll get this in tonight. any chance you can add a test?

IgorMinar pushed a commit to IgorMinar/angular.js that referenced this pull request Feb 4, 2014
…set to the current spec

Currently when a function is injected inside of a test we set the context to undefined which
is a bug.

Closes angular#6102
@IgorMinar
Copy link
Contributor

I think your patch is not quite correct. I amended it and added a test.

@wesalvaro
Copy link
Contributor Author

Ah, well if you're going to change it to currentSpec, you could just change the call inside the workFn when the blockFn is called with this to currentSpec on :2142. I was just cascading the way it already was. I think putting currentSpec as the context to the workFn obscures the way that Jasmine intends it to work.

Thanks for adding that test for me!

@IgorMinar IgorMinar closed this in 3bf4390 Feb 4, 2014
@wesalvaro wesalvaro deleted the patch-5 branch February 4, 2014 06:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants