diff options
| author | jankuca | 2013-09-25 16:37:59 -0700 |
|---|---|---|
| committer | Brian Ford | 2013-09-30 16:44:19 -0700 |
| commit | 5a1a6b86a8dbcd8aa4fe9c59fad8d005eead686c (patch) | |
| tree | 451269b873ad3a603dcc414b6bcc637ff9c89bd1 /test/ng/compileSpec.js | |
| parent | 742271ffa3a518d9e8ef2cb97c24b45b44e3378d (diff) | |
| download | angular.js-5a1a6b86a8dbcd8aa4fe9c59fad8d005eead686c.tar.bz2 | |
fix(ngTransclude): detect ngTranslude usage without a transclusion directive
Closes #3759
Diffstat (limited to 'test/ng/compileSpec.js')
| -rwxr-xr-x | test/ng/compileSpec.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index c6ba5480..580d51c3 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2834,6 +2834,22 @@ describe('$compile', function() { }); + it('should throw on an ng-translude element inside no transclusion directive', function() { + inject(function ($rootScope, $compile) { + // we need to do this because different browsers print empty attributres differently + try { + $compile('<div><div ng-transclude></div></div>')($rootScope); + } catch(e) { + expect(e.message).toMatch(new RegExp( + '^\\\[ngTransclude:orphan\\\] ' + + 'Illegal use of ngTransclude directive in the template! ' + + 'No parent directive that requires a transclusion found\. ' + + 'Element: <div ng-transclude.+')); + } + }); + }); + + it('should make the result of a transclusion available to the parent directive in post-linking phase (template)', function() { module(function() { |
