From e2751292dac5f7f4813bd2a3f0e8bbe3dcf4d6d9 Mon Sep 17 00:00:00 2001 From: Chirayu Krishnappa Date: Fri, 20 Sep 2013 18:03:29 -0700 Subject: test(ng-non-bindable): test sibling bindings Ref: https://github.com/angular/angular.dart/blob/master/test/directives/ng_non_bindable_spec.dart --- test/ng/directive/ngNonBindableSpec.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/ng/directive/ngNonBindableSpec.js b/test/ng/directive/ngNonBindableSpec.js index ed9ea6ab..87ba89d2 100644 --- a/test/ng/directive/ngNonBindableSpec.js +++ b/test/ng/directive/ngNonBindableSpec.js @@ -13,9 +13,27 @@ describe('ngNonBindable', function() { it('should prevent compilation of the owning element and its children', inject(function($rootScope, $compile) { element = $compile('
')($rootScope); - $rootScope.name = 'misko'; + element = $compile('
' + + ' {{a}}' + + ' ' + + '
' + + ' {{b}}' + + '
' + + ' {{a}}' + + ' ' + + '
')($rootScope); + $rootScope.a = "one"; + $rootScope.b = "two"; $rootScope.$digest(); - expect(element.text()).toEqual(''); - expect(element.attr('text')).toEqual('{{name}}'); + // Bindings not contained by ng-non-bindable should resolve. + var spans = element.find("span"); + expect(spans.eq(0).text()).toEqual('one'); + expect(spans.eq(1).text()).toEqual('two'); + expect(spans.eq(3).text()).toEqual('one'); + expect(spans.eq(4).text()).toEqual('two'); + // Bindings contained by ng-non-bindable should be left alone. + var nonBindableDiv = element.find("div"); + expect(nonBindableDiv.attr('foo')).toEqual('{{a}}'); + expect(trim(nonBindableDiv.text())).toEqual('{{b}}'); })); }); -- cgit v1.2.3