mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-20 16:30:26 +00:00
docs(ngList): fix example and add e2e test
This commit is contained in:
parent
cd11cc1083
commit
de4b048b49
1 changed files with 4 additions and 1 deletions
|
|
@ -1264,8 +1264,9 @@ var requiredDirective = function() {
|
|||
</script>
|
||||
<form name="myForm" ng-controller="Ctrl">
|
||||
List: <input name="namesInput" ng-model="names" ng-list required>
|
||||
<span class="error" ng-show="myForm.list.$error.required">
|
||||
<span class="error" ng-show="myForm.namesInput.$error.required">
|
||||
Required!</span>
|
||||
<br>
|
||||
<tt>names = {{names}}</tt><br/>
|
||||
<tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
|
||||
<tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
|
||||
|
|
@ -1277,12 +1278,14 @@ var requiredDirective = function() {
|
|||
it('should initialize to model', function() {
|
||||
expect(binding('names')).toEqual('["igor","misko","vojta"]');
|
||||
expect(binding('myForm.namesInput.$valid')).toEqual('true');
|
||||
expect(element('span.error').css('display')).toBe('none');
|
||||
});
|
||||
|
||||
it('should be invalid if empty', function() {
|
||||
input('names').enter('');
|
||||
expect(binding('names')).toEqual('[]');
|
||||
expect(binding('myForm.namesInput.$valid')).toEqual('false');
|
||||
expect(element('span.error').css('display')).not().toBe('none');
|
||||
});
|
||||
</doc:scenario>
|
||||
</doc:example>
|
||||
|
|
|
|||
Loading…
Reference in a new issue