This is my function
$scope.buildForm = function (majorObjectId, name) { $window.open("/FormBuilder/Index#/" + $scope.currentAppId + "/form/" + majorObjectId + "/" + name); };
This is my jasmine test specification.
it('should open new window for buildForm and with expected id', function () { scope.majorObjectId = mockObjectId; scope.currentAppId = mockApplicationId; var name = "DepartmentMajor"; scope.buildForm(mockObjectId, name); scope.$digest(); expect(window.open).toHaveBeenCalled(); spyOn(window, 'open'); spyOn(window, 'open').and.returnValue("/FormBuilder/Index#/" + scope.currentAppId + "/form/" + scope.majorObjectId + "/" + name); });
but when I try to run this, it opens a new tab, and I donβt want this to happen, I just want to check if returnValues ββare present!
angularjs karma-runner jasmine
Syed rasheed
source share