@@ -18,7 +18,8 @@ describe('ui.grid.resizeColumns', function () {
1818
1919 $scope . gridOpts = {
2020 enableColumnResizing : true ,
21- data : data
21+ data : data ,
22+ onRegisterApi : function ( gridApi ) { $scope . gridApi = gridApi ; }
2223 } ;
2324
2425 recompile = function ( ) {
@@ -100,15 +101,15 @@ describe('ui.grid.resizeColumns', function () {
100101 xit ( 'should resize the column to the maximum width of the rendered columns' , function ( done ) {
101102 var firstResizer = $ ( grid ) . find ( '[ui-grid-column-resizer]' ) . first ( ) ;
102103
103- var colWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + '0' ) . first ( ) . width ( ) ;
104+ var colWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + $scope . gridApi . grid . columns [ 0 ] . uid ) . first ( ) . width ( ) ;
104105
105106 expect ( colWidth === 166 || colWidth === 167 ) . toBe ( true ) ; // allow for column widths that don't equally divide
106107
107108 firstResizer . trigger ( 'dblclick' ) ;
108109
109110 $scope . $digest ( ) ;
110111
111- var newColWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + '0' ) . first ( ) . width ( ) ;
112+ var newColWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + $scope . gridApi . grid . columns [ 0 ] . uid ) . first ( ) . width ( ) ;
112113
113114 // Can't really tell how big the columns SHOULD be, we'll just expect them to be different in width now
114115 expect ( newColWidth ) . not . toEqual ( colWidth ) ;
@@ -137,7 +138,7 @@ describe('ui.grid.resizeColumns', function () {
137138 var firstResizer = $ ( grid ) . find ( '[ui-grid-column-resizer]' ) . first ( ) ;
138139
139140 // Get the initial width of the column
140- initialWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + '0' ) . first ( ) . width ( ) ;
141+ initialWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + $scope . gridApi . grid . columns [ 0 ] . uid ) . first ( ) . width ( ) ;
141142
142143 initialX = firstResizer . position ( ) . left ;
143144
@@ -176,7 +177,7 @@ describe('ui.grid.resizeColumns', function () {
176177 } ) ;
177178
178179 it ( 'should cause the column to resize by the amount change in the X axis' , function ( ) {
179- var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + '0' ) . first ( ) . width ( ) ;
180+ var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + $scope . gridApi . grid . columns [ 0 ] . uid ) . first ( ) . width ( ) ;
180181
181182 expect ( newWidth - initialWidth ) . toEqual ( xDiff ) ;
182183 } ) ;
@@ -212,7 +213,7 @@ describe('ui.grid.resizeColumns', function () {
212213 $ ( firstResizer ) . simulate ( 'dblclick' ) ;
213214 $scope . $digest ( ) ;
214215
215- var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + '0' ) . first ( ) . width ( ) ;
216+ var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + $scope . gridApi . grid . columns [ 0 ] . uid ) . first ( ) . width ( ) ;
216217
217218 expect ( newWidth >= minWidth ) . toEqual ( true ) ;
218219 } ) ;
@@ -233,7 +234,7 @@ describe('ui.grid.resizeColumns', function () {
233234 } ) ;
234235
235236 it ( 'should not go below the minWidth' , function ( ) {
236- var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + '0' ) . first ( ) . width ( ) ;
237+ var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + $scope . gridApi . grid . columns [ 0 ] . uid ) . first ( ) . width ( ) ;
237238
238239 expect ( newWidth >= minWidth ) . toEqual ( true ) ;
239240 } ) ;
@@ -262,7 +263,7 @@ describe('ui.grid.resizeColumns', function () {
262263 $ ( firstResizer ) . simulate ( 'dblclick' ) ;
263264 $scope . $digest ( ) ;
264265
265- var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + '0' ) . first ( ) . width ( ) ;
266+ var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + $scope . gridApi . grid . columns [ 0 ] . uid ) . first ( ) . width ( ) ;
266267
267268 expect ( newWidth <= maxWidth ) . toEqual ( true ) ;
268269 } ) ;
@@ -283,7 +284,7 @@ describe('ui.grid.resizeColumns', function () {
283284 } ) ;
284285
285286 it ( 'should not go above the maxWidth' , function ( ) {
286- var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + '0' ) . first ( ) . width ( ) ;
287+ var newWidth = $ ( grid ) . find ( '.' + uiGridConstants . COL_CLASS_PREFIX + $scope . gridApi . grid . columns [ 0 ] . uid ) . first ( ) . width ( ) ;
287288
288289 expect ( newWidth <= maxWidth ) . toEqual ( true ) ;
289290 } ) ;
0 commit comments