Insert(SpyOn 2 times) jQuery value to input during Jasmine tests
问题 Hi i have a works tests it("should add a model", function() { spyOn($.fn, "val").and.returnValue("Bar"); foodtype.addNewFoodtype(); //My view expect($("#newFoodtype").val()).toEqual("Bar"); expect(foodtype.collection.length).toEqual(1); }); on next test when I set spyOn($.fn, "val").and.returnValue("Bar"); $("#newFoodtype").val() spyOn($.fn, "val").and.returnValue("Foo"); $("#newFoodtype").val() to checking a change but have a error Error: spyOn : val has already been spied upon Usage: spyOn