我的Angular控制器中有以下ng-click
函数:
vm.slideToggle = function(index) {
var details = (angular.element('#a' + vm.accounts[index].id));
details.slideToggle();
};
我尝试通过以下规范调用details.slideToggle()
时调用vm.slideToggle
。我的问题在于如何正确访问details.slideToggle
:
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();
});