I write a test like this
describe('execCommand', function () {
it('should call document.execCommand', function () {
spyOn(document, 'execCommand').and.callThrough();
expect(document.execCommand).toHaveBeenCalledWith('foreColor', false, 'red');
document.execCommand('foreColor', false, 'red');
});
});
But it fail Expected spy execCommand to have been called with [ 'foreColor', false, 'red' ] but it was never called.
and I don't know why?
Please help.
Note: I run it using grunt-contrib-jasmine
0.9.2