I have an angular controller jasmine test using ng mesh. I want to call selectRow(1, true);angular in the grid, but when I do this, I get an errorTypeError: Object #<Object> has no method 'selectRow'
I have an angular controller that sets up an ng grid as follows:
$scope.myGridOptions = {
data : 'myData',
multiSelect: false,
selectedItems: $scope.mySelectedRow,
afterSelectionChange: function(data) {;
if($scope.mySelectedRow === undefined){
}else{
}
}
};
Then I have jasmine unit test, where I create an instance of my controller using the input function, setting the object scopeto equal controllers $scope. Then I have a bunch of tests that are not related to the grid, and they all run and pass fine.
However, I want to test the logic of the select handler, so I test it as follows:
it('selecting a row in the table does stuff.', function() {
rootScope.$digest();
scope.myGridOptions.$selectRow(1, true);
expect(scope.resultOfDoingSomthing).toBe("done");
});
, . maven jasime:bdd , . , , angular -jasmine, . javascript ng-grid. module("ngGrid") beforeEach . beforeEach(module("myMod",['ng-grid'])); $injector.