From 5a1a6b86a8dbcd8aa4fe9c59fad8d005eead686c Mon Sep 17 00:00:00 2001 From: jankuca Date: Wed, 25 Sep 2013 16:37:59 -0700 Subject: fix(ngTransclude): detect ngTranslude usage without a transclusion directive Closes #3759 --- test/ng/compileSpec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/ng/compileSpec.js') 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('
')($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: