diff options
| author | Chirayu Krishnappa | 2013-09-20 18:03:29 -0700 | 
|---|---|---|
| committer | Chirayu Krishnappa | 2013-09-20 23:55:23 -0700 | 
| commit | e2751292dac5f7f4813bd2a3f0e8bbe3dcf4d6d9 (patch) | |
| tree | 9da95cf0092fbcca446af532b0a8b1381c78824b /test/ng/directive | |
| parent | e2068ad426075ac34c06c12e2fac5f594cc81969 (diff) | |
| download | angular.js-e2751292dac5f7f4813bd2a3f0e8bbe3dcf4d6d9.tar.bz2 | |
test(ng-non-bindable): test sibling bindings
Ref: https://github.com/angular/angular.dart/blob/master/test/directives/ng_non_bindable_spec.dart
Diffstat (limited to 'test/ng/directive')
| -rw-r--r-- | test/ng/directive/ngNonBindableSpec.js | 24 | 
1 files changed, 21 insertions, 3 deletions
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('<div ng-non-bindable text="{{name}}"><span ng-bind="name"></span></div>')($rootScope); -    $rootScope.name =  'misko'; +    element = $compile('<div>' + +                       '  <span id="s1">{{a}}</span>' + +                       '  <span id="s2" ng-bind="b"></span>' + +                       '  <div foo="{{a}}" ng-non-bindable>' + +                       '    <span ng-bind="a"></span>{{b}}' + +                       '  </div>' + +                       '  <span id="s3">{{a}}</span>' + +                       '  <span id="s4" ng-bind="b"></span>' + +                       '</div>')($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}}');    }));  });  | 
