aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive
diff options
context:
space:
mode:
authorTobias Bosch2013-11-21 21:54:42 -0800
committerTobias Bosch2013-11-21 22:20:11 -0800
commit0a7cbb33b06778833a4d99b1868cc07690a827a7 (patch)
treeced79c2c12dedd84e972b8fb29c543cbfcb6e5a1 /test/ng/directive
parent579242346c4202ea58fc2cae6df232289cbea0bb (diff)
downloadangular.js-0a7cbb33b06778833a4d99b1868cc07690a827a7.tar.bz2
fix(ngInclude): Don't throw when the ngInclude element contains content with directives.
Related to #5069
Diffstat (limited to 'test/ng/directive')
-rw-r--r--test/ng/directive/ngIncludeSpec.js40
1 files changed, 36 insertions, 4 deletions
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js
index 59f8b4ae..2d115e8b 100644
--- a/test/ng/directive/ngIncludeSpec.js
+++ b/test/ng/directive/ngIncludeSpec.js
@@ -465,10 +465,22 @@ describe('ngInclude', function() {
});
describe('ngInclude and transcludes', function() {
+ var element, directive;
+
+ beforeEach(module(function($compileProvider) {
+ element = null;
+ directive = $compileProvider.directive;
+ }));
+
+ afterEach(function() {
+ if (element) {
+ dealoc(element);
+ }
+ });
+
it('should allow access to directive controller from children when used in a replace template', function() {
var controller;
- module(function($compileProvider) {
- var directive = $compileProvider.directive;
+ module(function() {
directive('template', valueFn({
template: '<div ng-include="\'include.html\'"></div>',
replace: true,
@@ -485,13 +497,33 @@ describe('ngInclude and transcludes', function() {
});
inject(function($compile, $rootScope, $httpBackend) {
$httpBackend.expectGET('include.html').respond('<div><div test></div></div>');
- var element = $compile('<div><div template></div></div>')($rootScope);
+ element = $compile('<div><div template></div></div>')($rootScope);
$rootScope.$apply();
$httpBackend.flush();
expect(controller.flag).toBe(true);
- dealoc(element);
});
});
+
+ it("should compile it's content correctly (although we remove it later)", function() {
+ var testElement;
+ module(function() {
+ directive('test', function() {
+ return {
+ link: function(scope, element) {
+ testElement = element;
+ }
+ };
+ });
+ });
+ inject(function($compile, $rootScope, $httpBackend) {
+ $httpBackend.expectGET('include.html').respond(' ');
+ element = $compile('<div><div ng-include="\'include.html\'"><div test></div></div></div>')($rootScope);
+ $rootScope.$apply();
+ $httpBackend.flush();
+ expect(testElement[0].nodeName).toBe('DIV');
+ });
+
+ });
});
describe('ngInclude animations', function() {