mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-09 15:24:43 +00:00
test(ng-non-bindable): test sibling bindings
Ref: https://github.com/angular/angular.dart/blob/master/test/directives/ng_non_bindable_spec.dart
This commit is contained in:
parent
e2068ad426
commit
e2751292da
1 changed files with 21 additions and 3 deletions
|
|
@ -13,9 +13,27 @@ describe('ngNonBindable', function() {
|
||||||
it('should prevent compilation of the owning element and its children',
|
it('should prevent compilation of the owning element and its children',
|
||||||
inject(function($rootScope, $compile) {
|
inject(function($rootScope, $compile) {
|
||||||
element = $compile('<div ng-non-bindable text="{{name}}"><span ng-bind="name"></span></div>')($rootScope);
|
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();
|
$rootScope.$digest();
|
||||||
expect(element.text()).toEqual('');
|
// Bindings not contained by ng-non-bindable should resolve.
|
||||||
expect(element.attr('text')).toEqual('{{name}}');
|
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}}');
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue