How to spyOn a value property (rather than a method) with Jasmine

前端 未结 10 2252
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 04:12

Jasmine\'s spyOn is good to change a method\'s behavior, but is there any way to change a value property (rather than a method) for an object? the code could be

10条回答
  •  甜味超标
    2020-12-01 04:35

    Any reason you cannot just change it on the object directly? It is not as if javascript enforces visibility of a property on an object.

提交回复
热议问题