Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b89320a

Browse files
committed
test(compile): failing test - respect controller return value
failing test for #11147 Controllers instantiated for directives by the $compile service do not respect explicit return values from the controller function.
1 parent 3613a60 commit b89320a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/ng/compileSpec.js

+21
Original file line numberDiff line numberDiff line change
@@ -4197,6 +4197,27 @@ describe('$compile', function() {
41974197
});
41984198

41994199

4200+
it('should respect controller return value', function() {
4201+
module(function() {
4202+
directive('logControllerProp', function(log) {
4203+
return {
4204+
controller: function($scope) {
4205+
this.foo = 'baz'; // value should not be used.
4206+
return {foo: 'bar'};
4207+
},
4208+
link: function(scope, element, attrs, controller) {
4209+
log(controller.foo);
4210+
}
4211+
};
4212+
});
4213+
});
4214+
inject(function(log, $compile, $rootScope) {
4215+
element = $compile('<log-controller-prop></log-controller-prop>')($rootScope);
4216+
expect(log).toEqual('bar');
4217+
});
4218+
});
4219+
4220+
42004221
it('should get required parent controller', function() {
42014222
module(function() {
42024223
directive('nested', function(log) {

0 commit comments

Comments
 (0)