aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIgor Minar2013-11-07 00:24:07 -0800
committerIgor Minar2013-11-07 22:08:05 -0800
commit3fe4491a6bf57ddeb312b8a30cf1706f6f1d2355 (patch)
treec7394c86748040b711567150077084c2d9e62b4b /test
parent97c7a4e3791d7cb05c3317cc5f0c49ab93810bf6 (diff)
downloadangular.js-3fe4491a6bf57ddeb312b8a30cf1706f6f1d2355.tar.bz2
fix($compile): correct isolate scope distribution to controllers
Fixes an issue when we didn't share the isolate scope with the controller of the directive from the isolate directive's template when this directive was replaced onto the isolate directive element.
Diffstat (limited to 'test')
-rwxr-xr-xtest/ng/compileSpec.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index 75c111d7..356b1796 100755
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -2480,6 +2480,30 @@ describe('$compile', function() {
});
+ it('should give the isolate scope to the controller of another replaced directives in the template', function() {
+ module(function() {
+ directive('testDirective', function() {
+ return {
+ replace: true,
+ restrict: 'E',
+ scope: {},
+ template: '<input type="checkbox" ng-model="model">'
+ };
+ });
+ });
+
+ inject(function($rootScope) {
+ compile('<div><test-directive></test-directive></div>');
+
+ element = element.children().eq(0);
+ expect(element[0].checked).toBe(false);
+ element.isolateScope().model = true;
+ $rootScope.$digest();
+ expect(element[0].checked).toBe(true);
+ });
+ });
+
+
it('should share isolate scope with replaced directives', function() {
var normalScope;
var isolateScope;