diff options
| author | Tobias Bosch | 2013-11-12 15:53:06 -0800 |
|---|---|---|
| committer | Tobias Bosch | 2013-11-12 16:51:16 -0800 |
| commit | e1254b266dfa2d4e3756e4317152dbdbcabe44be (patch) | |
| tree | 0d0abdd45cefe6895e8cd2c80329684ce8389d03 /test | |
| parent | fa82a31fa6c7ded00c8b7b0a62ba05d409fcbf00 (diff) | |
| download | angular.js-e1254b266dfa2d4e3756e4317152dbdbcabe44be.tar.bz2 | |
fix($compile): correctly handle interpolated style in replace templates
A directive with a template with `replace: true` and an interpolated style at the root element should work correctly.
Closes #4882.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/ng/compileSpec.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 5bdbad42..3e35fae7 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -504,6 +504,14 @@ describe('$compile', function() { expect(element).toBe(attr.$$element); } })); + directive('replaceWithInterpolatedStyle', valueFn({ + replace: true, + template: '<div style="width:{{1+1}}px">Replace with interpolated style!</div>', + compile: function(element, attr) { + attr.$set('compiled', 'COMPILED'); + expect(element).toBe(attr.$$element); + } + })); })); @@ -581,13 +589,22 @@ describe('$compile', function() { })); - it('should handle interpolated css from replacing directive', inject( + it('should handle interpolated css class from replacing directive', inject( function($compile, $rootScope) { element = $compile('<div replace-with-interpolated-class></div>')($rootScope); $rootScope.$digest(); expect(element).toHaveClass('class_2'); })); + if (!msie || msie > 10) { + // style interpolation not working on IE<11. + it('should handle interpolated css style from replacing directive', inject( + function($compile, $rootScope) { + element = $compile('<div replace-with-interpolated-style></div>')($rootScope); + $rootScope.$digest(); + expect(element.css('width')).toBe('2px'); + })); + } it('should merge interpolated css class', inject(function($compile, $rootScope) { element = $compile('<div class="one {{cls}} three" replace></div>')($rootScope); |
