I noticed an issue where Jasmine's mock setInterval and setTimeout functions had different behavior from most browsers (read, non-IE).
In non-IE browsers, you can pass more than two arguments to setInterval. The first two, which are implemented in Jasmine, are the callback and the time in ms. The additional arguments specify the arguments that are supposed to be applied to the callback function; Jasmine does not capture these arguments or pass them to the callback.
setInterval(callback, time, [arg1, arg2, ...])
See the attached code for an example of this usage.
I could imagine that this behavior was not included intentionally in order to avoid Internet Explorer compatibility issues. I am also aware of one basic workaround to this issue that involves wrapping the callback in an anonymous function.
However, if you agree that these specs are correct, reply to this pull request, and I can try to implement the behavior.
See also: http://msdn.microsoft.com/en-us/library/ie/ms536753(v=vs.85).aspx
Add specs for passing arguments with setInterval and setTimeout
We do need to support IE so please make sure any tests/implementation you add take that into account. Happy to comment on progressions on this. Thanks!
Does anyone know what the status on this is? We also need it on our project.
We have fixed this on master. So 2.0 will behave properly. See https://github.com/pivotal/jasmine/blob/master/spec/core/ClockSpec.js