I'm testing some base.js (dean edwards base.js) code and want to test that some base function gets called with specific args. Our testing stack looks like js code, qunit, sinon. For example, I have:
var Foo = Base.extend({
constructor: function () {
//do constructor stuff
},
render: function (config) {
config = config || {};
//do rendery stuff with specified config
}
});
var Bar = Foo.extend({
render: function () {
config = {a: 'a', b: 'b'};
this.base(config);
}
});
var b = (new Bar()).render();
So in the example above, I create a new instance of "Bar" and call the render method. The Bar render method specifies some config and passes that to the parent render method. Is there any way (using sinon.js) to spy on that base render call? I would typically do something like:
sinon.spy(b, 'render')
but that only gets me the initial call to render.