-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Fixes URL-based template loading for
header-cell
, `foote…
…r-cell`, `filter`. Fixes issues #4744, #5717, #5115, #5196, #5712, #5260, #5196, #4851, #4514, #5601 For URL-based templates we need to be sure that content arrived before `$compile` and `$elm.append` call.
- Loading branch information
1 parent
85c3c90
commit f0b2fa7
Showing
8 changed files
with
183 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
describe('uiGridFilter', function () { | ||
var grid, recompile, $compile, $scope, $document, $httpBackend; | ||
|
||
var data = [ | ||
{ 'name': 'Ethel Price', 'gender': 'female', 'company': 'Enersol' }, | ||
{ 'name': 'Claudine Neal', 'gender': 'female', 'company': 'Sealoud' }, | ||
{ 'name': 'Beryl Rice', 'gender': 'female', 'company': 'Velity' }, | ||
{ 'name': 'Wilder Gonzales', 'gender': 'male', 'company': 'Geekko' } | ||
]; | ||
|
||
var columnDefs = [ | ||
{ name: 'name' }, | ||
{ name: 'gender' }, | ||
{ name: 'company' } | ||
]; | ||
|
||
beforeEach(module('ui.grid')); | ||
|
||
beforeEach(inject(function (_$compile_, $rootScope, _$document_, _$httpBackend_) { | ||
$compile = _$compile_; | ||
$scope = $rootScope; | ||
$document = _$document_; | ||
$httpBackend = _$httpBackend_; | ||
|
||
$scope.gridOpts = { | ||
columnDefs: columnDefs, | ||
data: data | ||
}; | ||
|
||
recompile = function () { | ||
grid = angular.element('<div style="width: 500px; height: 300px" ui-grid="gridOpts"></div>'); | ||
|
||
$compile(grid)($scope); | ||
$document[0].body.appendChild(grid[0]); | ||
|
||
$scope.$digest(); | ||
}; | ||
|
||
recompile(); | ||
})); | ||
|
||
afterEach(function() { | ||
grid.remove(); | ||
}); | ||
|
||
describe('should handle a URL-based template defined in filterHeaderTemplate', function () { | ||
it('should handle', function () { | ||
var el, url = 'http://www.a-really-fake-url.com/filterHeaderTemplate.html'; | ||
|
||
$scope.gridOpts.enableFiltering = true; | ||
$scope.gridOpts.columnDefs[0].filterHeaderTemplate = url; | ||
|
||
$httpBackend.expectGET(url).respond('<div class="filterHeaderTemplate">filterHeaderTemplate content</div>'); | ||
recompile(); | ||
|
||
el = $(grid).find('.filterHeaderTemplate'); | ||
expect(el.text()).toEqual(''); | ||
|
||
$httpBackend.flush(); | ||
el = $(grid).find('.filterHeaderTemplate'); | ||
expect(el.text()).toEqual('filterHeaderTemplate content'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters