How can I spy on a getter property using jasmine?
var o = { get foo() {}, }; spyOn(o, \'foo\').and.returnValue(\'bar\'); // Doesn\'t work.
I think the best way is to use spyOnProperty. It expects 3 properties and you need to pass get or set as third property.
spyOnProperty
get
set
spyOnProperty(o, 'foo', 'get').and.returnValue('bar');