diff options
| author | Misko Hevery | 2010-07-15 13:35:00 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-07-15 13:35:00 -0700 |
| commit | 1de82283dbf1bed2fc04700584dc1123b1e159fe (patch) | |
| tree | 1c90427efab9838c40e44ece76c641dbf2dcccab /test/directivesSpec.js | |
| parent | 9abd10e7b8a34b9dcd1a6af5ff37f57bd27cf920 (diff) | |
| download | angular.js-1de82283dbf1bed2fc04700584dc1123b1e159fe.tar.bz2 | |
proper handlig of $element in filters
Diffstat (limited to 'test/directivesSpec.js')
| -rw-r--r-- | test/directivesSpec.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/directivesSpec.js b/test/directivesSpec.js index b6ccf764..fb1e868a 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -73,11 +73,14 @@ describe("directives", function(){ }); it('should have $element set to current bind element', function(){ - angularFilter.myFilter = function(){ - this.$element.text('HELLO'); + var innerText; + angularFilter.myFilter = function(text){ + innerText = this.$element.text(); + return text; }; - var scope = compile('<div>before<div ng:bind-template="{{0|myFilter}}"></div>after</div>'); + var scope = compile('<div>before<div ng:bind-template="{{\'HELLO\'|myFilter}}">INNER</div>after</div>'); expect(scope.$element.text()).toEqual("beforeHELLOafter"); + expect(innerText).toEqual('INNER'); }); }); |
