diff options
Diffstat (limited to 'test/CompilerSpec.js')
| -rw-r--r-- | test/CompilerSpec.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index a212634a..2e1ae4ae 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -108,7 +108,7 @@ describe('compiler', function(){ it('should replace widgets', function(){ widgets['NG:BUTTON'] = function(element) { - element.replaceWith('<div>button</div>', element); + element.replaceWith('<div>button</div>'); return function(element) { log += 'init'; }; @@ -118,4 +118,20 @@ describe('compiler', function(){ expect(log).toEqual('init'); }); + it('should use the replaced element after calling widget', function(){ + widgets['H1'] = function(element) { + var span = angular.element('<span>{{1+2}}</span>'); + element.replaceWith(span); + this.descend(true); + this.directives(true); + return noop; + }; + textMarkup.push(function(text, textNode, parent){ + if (text == '{{1+2}}') + textNode.text('3'); + }); + var scope = compile('<div><h1>ignore me</h1></div>'); + expect(scope.$element.text()).toEqual('3'); + }); + }); |
