diff options
| author | danilsomsikov | 2013-01-22 16:59:09 +0100 |
|---|---|---|
| committer | Igor Minar | 2013-02-25 21:45:44 -0800 |
| commit | 77c4a7fd660c2520afc7a0fdcf81c8950321f559 (patch) | |
| tree | e74f1ea7707f4e1d67ad8258001235c8ff537150 /test/ng/compileSpec.js | |
| parent | e281413919db26dbb0cc1d4b892d22fd0475fb68 (diff) | |
| download | angular.js-77c4a7fd660c2520afc7a0fdcf81c8950321f559.tar.bz2 | |
fix($compile): compile replace directives in external template
Passing DOMNode#childNodes to compileNodes when compiling remote
template, so that directives with replace:true can be compiled.
The previous version used jqLite#contents which returned collection
that was not updated during the compilation.
Closes #1859
Diffstat (limited to 'test/ng/compileSpec.js')
| -rw-r--r-- | test/ng/compileSpec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 163eefba..d24a9dac 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -702,6 +702,10 @@ describe('$compile', function() { } })); + directive('replace', valueFn({ + replace: true, + template: '<span>Hello, {{name}}!</span>' + })); } )); @@ -817,6 +821,31 @@ describe('$compile', function() { )); + it('should compile template when replacing element in another template', + inject(function($compile, $templateCache, $rootScope) { + $templateCache.put('hello.html', '<div replace></div>'); + $rootScope.name = 'Elvis'; + element = $compile('<div><b class="hello"></b></div>')($rootScope); + + $rootScope.$digest(); + + expect(sortedHtml(element)). + toEqual('<div><b class="hello"><span replace="">Hello, Elvis!</span></b></div>'); + })); + + + it('should compile template when replacing root element', + inject(function($compile, $templateCache, $rootScope) { + $rootScope.name = 'Elvis'; + element = $compile('<div replace></div>')($rootScope); + + $rootScope.$digest(); + + expect(sortedHtml(element)). + toEqual('<span replace="">Hello, Elvis!</span>'); + })); + + it('should resolve widgets after cloning in append mode', function() { module(function($exceptionHandlerProvider) { $exceptionHandlerProvider.mode('log'); |
