|
1 | 1 | describe('Grid factory', function () {
|
2 | 2 | var $q, $scope, grid, Grid, GridRow, GridColumn, rows, returnedRows, column, uiGridConstants;
|
| 3 | + var gridClassFactory; |
3 | 4 |
|
4 | 5 | beforeEach(module('ui.grid'));
|
5 | 6 |
|
6 |
| - beforeEach(inject(function (_$q_, _$rootScope_, _Grid_, _GridRow_, _GridColumn_, _uiGridConstants_) { |
| 7 | + beforeEach(inject(function (_$q_, _$rootScope_, _Grid_, _GridRow_, _GridColumn_, _uiGridConstants_, _gridClassFactory_) { |
7 | 8 | $q = _$q_;
|
8 | 9 | $scope = _$rootScope_;
|
9 | 10 | Grid = _Grid_;
|
10 | 11 | GridRow = _GridRow_;
|
11 | 12 | GridColumn = _GridColumn_;
|
12 | 13 | uiGridConstants = _uiGridConstants_;
|
| 14 | + gridClassFactory = _gridClassFactory_; |
13 | 15 |
|
14 | 16 | grid = new Grid({ id: 1 });
|
15 | 17 | rows = [
|
@@ -262,6 +264,27 @@ describe('Grid factory', function () {
|
262 | 264 |
|
263 | 265 | });
|
264 | 266 |
|
| 267 | + it('should replace constants in template', inject(function ($timeout) { |
| 268 | + |
| 269 | + var colDefs = [ |
| 270 | + {name:'simpleProp', cellTemplate:'<div ng-model="MODEL_COL_FIELD"/>'} |
| 271 | + ]; |
| 272 | + var grid = gridClassFactory.createGrid({columnDefs:colDefs }); |
| 273 | + var rows = [ |
| 274 | + new GridRow(entity,1,grid) |
| 275 | + ]; |
| 276 | + |
| 277 | + $timeout(function () { |
| 278 | + grid.buildColumns(); |
| 279 | + }); |
| 280 | + $timeout.flush(); |
| 281 | + grid.modifyRows([entity]); |
| 282 | + grid.preCompileCellTemplates(); |
| 283 | + |
| 284 | + var row = grid.rows[0]; |
| 285 | + expect(grid.getColumn('simpleProp').compiledElementFn).toBeDefined(); |
| 286 | + |
| 287 | + })); |
265 | 288 |
|
266 | 289 | it('should bind correctly to simple prop', function() {
|
267 | 290 |
|
|
0 commit comments