From 6b0e6f13b0e5d330c43096a390782f4c23237e67 Mon Sep 17 00:00:00 2001 From: Chirayu Krishnappa Date: Fri, 9 Aug 2013 19:56:10 -0700 Subject: [PATCH] squash! wip --- test/ng/compileSpec.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 36a8b990f70d..bb144d1f8afa 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2455,6 +2455,34 @@ describe('$compile', function() { }); + it('should instantiate the controller after the isolate scope bindings are initialized', function () { + module(function () { + var Ctrl = function ($scope, log) { + log($scope.foo); + // $scope.$evalAsync(function() { log($scope.foo); }); + }; + + directive('myDirective', function () { + return { + scope: { + foo: "=attrFoo", + }, + templateUrl: 'hello.html', + controller: Ctrl + }; + }); + }); + + inject(function ($templateCache, $compile, $rootScope, log) { + $templateCache.put('hello.html', '

Hello

'); + $rootScope.foo = "bar"; + element = $compile('
')($rootScope); + $rootScope.$apply(); + expect(log).toEqual('bar'); + }); + }); + + it('should instantiate controllers in the parent->child->baby order when nested transluction, templateUrl and ' + 'replacement are in the mix', function() { // similar to the test above, except that we have one more layer of nesting and nested transclusion