From 649b892205615a144dafff9984c0e6ab10ed341d Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Wed, 23 Jan 2013 00:01:13 -0500 Subject: feat(Scope): expose transcluded and isolate scope info for batarang test($compile): add test for exposing transclude and isolate scope info to batarang --- test/ng/compileSpec.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test/ng/compileSpec.js') diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 363b4329..b4ec0292 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -1938,6 +1938,21 @@ describe('$compile', function() { compile('
'); }).toThrow('Invalid isolate scope definition for directive badDeclaration: xxx'); })); + + it('should expose a $$isolateBindings property onto the scope', inject(function() { + compile('
'); + + expect(typeof componentScope.$$isolateBindings).toBe('object'); + + expect(componentScope.$$isolateBindings.attr).toBe('@attr'); + expect(componentScope.$$isolateBindings.attrAlias).toBe('@attr'); + expect(componentScope.$$isolateBindings.ref).toBe('=ref'); + expect(componentScope.$$isolateBindings.refAlias).toBe('=ref'); + expect(componentScope.$$isolateBindings.reference).toBe('=reference'); + expect(componentScope.$$isolateBindings.expr).toBe('&expr'); + expect(componentScope.$$isolateBindings.exprAlias).toBe('&expr'); + + })); }); @@ -2264,5 +2279,28 @@ describe('$compile', function() { expect(element.text()).toBe('-->|x|'); })); + + + it('should add a $$transcluded property onto the transcluded scope', function() { + module(function() { + directive('trans', function() { + return { + transclude: true, + replace: true, + scope: true, + template: '
I:{{$$transcluded}}
' + }; + }); + }); + inject(function(log, $rootScope, $compile) { + element = $compile('
T:{{$$transcluded}}
') + ($rootScope); + $rootScope.$apply(); + expect(jqLite(element.find('span')[0]).text()).toEqual('I:'); + expect(jqLite(element.find('span')[1]).text()).toEqual('T:true'); + }); + }); + + }); }); -- cgit v1.2.3