angularjs - calling selectRow on ng-grid in a jasmine unit test -
I have a jasmine test of an angular controller using ng-grid. I call selectRow (1, true) on the collar grid; I want to call, but when I get the error, then
TypeError: Object # & lt; Object & gt; I have an angle controller that sets the ng-grid like this:
code> $ scope.myGridOptions = {Data: 'myData', Multiple Choice: Incorrect, Selected Items: $ scope.mySelectedRow, Change after selection: Function (Data) {; If ($ scope.mySelectedRow === undefined) {// do somthing} else {// do somthing else}}};
Then I have a jasmine unit test, where I use my controller inject function, scope controllers controlling objects $ Scope . Then I have a bunch of tests that do not include the grid, and they all go well.
Although I want to test select handler logic so that I am testing it like this:
The selection of a line in the table makes the stuff. ', The function () {// Controller is created before each root. Scope. $ Digest (); / / is required to obtain the controller to start the scope Select myGridOptions. $Ro (1, true); Hopefully (scope.resultOfDoingSomthing) .toBe ("done");}); If more code examples are required, please let me know in the comments. For the background, I am using maven jessime: bdd to run the test, so my jasmine configuration has been established by that I do not think there is any problem with it because I have some other angular -Complete unit tests that are all working relatively well include ng-grid javascript I can add the module ("nggrid") without any change to before each I tried to try before before (module ("myMod", ['ng-grid']); but it's a $ injector error Blown up with the blast.
For others, it is okay for the following, after which I have selected Instead of choosing the option of selecting it, try to run it by trying it out. To make this effect, I had to do it again:
after selection: Function (Data) {; if ($ scope.mySelectedRow === undefined) {// do somthing} else {// do somthing else}} to < Pre> after selection: function (line item, event) {; If using data passed to somthing with which you can see (rowItem.entity === undefined) {// do somthing} else {// row rowItem}}
Does it
Comments
Post a Comment