36
rated 0 times
[
42]
[
6]
/ answers: 1 / hits: 44816
/ 9 Years ago, thu, october 15, 2015, 12:00:00
How can I spy on a getter property using jasmine?
var o = { get foo() {}, };
spyOn(o, 'foo').and.returnValue('bar'); // Doesn't work.
This also does not work AFAICT:
spyOn(Object.getOwnPropertyDescriptor(o, 'foo'), 'get').and.returnValue('bar');
More From » jasmine