javascript - Check that inner function is called on ng-click -
i have following ng-click function within angular controller:
vm.slidetoggle = function(index) { var details = (angular.element('#a' + vm.accounts[index].id)); details.slidetoggle(); }; i'm attempting test details.slidetoggle() called when vm.slidetoggle called through following spec. issue lies how access details.slidetoggle properly:
it('should slide in more info when clicked', function() { expect(infocontroller.slidetoggle).tobedefined(); infocontroller.slidetoggle(0); expect(infocontroller.slidetoggle).tohavebeencalled(); expect(infocontroller.slidetoggle.call.length).toequal(1); expect(details.slidetoggle).tohavebeencalled(); });
Comments
Post a Comment