diff options
| author | Julie | 2014-01-11 16:59:15 -0800 | 
|---|---|---|
| committer | Caitlin Potter | 2014-01-28 14:14:20 -0500 | 
| commit | 7aef2d54e0a48fae18a289813f699962d8310565 (patch) | |
| tree | 60d1d559510c17e879aff798f298e6bcc262d3ab /docs/content/guide/expression.ngdoc | |
| parent | ce37ae28687167f7b4274ba547f013980126a219 (diff) | |
| download | angular.js-7aef2d54e0a48fae18a289813f699962d8310565.tar.bz2 | |
test(docs): convert example end to end doc tests from scenario runner to protractor
Thanks to jeffbcross, petebacondarwin, btford, jdeboer, tbosch for contributions!
Closes #6023
Diffstat (limited to 'docs/content/guide/expression.ngdoc')
| -rw-r--r-- | docs/content/guide/expression.ngdoc | 46 | 
1 files changed, 21 insertions, 25 deletions
| diff --git a/docs/content/guide/expression.ngdoc b/docs/content/guide/expression.ngdoc index b884dd45..f1e2735b 100644 --- a/docs/content/guide/expression.ngdoc +++ b/docs/content/guide/expression.ngdoc @@ -37,11 +37,11 @@ JavaScript, use the {@link api/ng.$rootScope.Scope#methods_$eval `$eval()`} meth  <doc:source>   1+2={{1+2}}  </doc:source> -<doc:scenario> +<doc:protractor>   it('should calculate expression in binding', function() { -   expect(binding('1+2')).toEqual('3'); +   expect(element(by.binding('1+2')).getText()).toEqual('1+2=3');   }); -</doc:scenario> +</doc:protractor>  </doc:example>  You can try evaluating different expressions here: @@ -73,14 +73,14 @@ You can try evaluating different expressions here:     </ul>   </div>  </doc:source> -<doc:scenario> +<doc:protractor>   it('should allow user expression testing', function() { -    element('.expressions :button').click(); -    var li = using('.expressions ul').repeater('li'); -    expect(li.count()).toBe(1); -    expect(li.row(0)).toEqual(["3*10|currency", "$30.00"]); +    element(by.css('.expressions button')).click(); +    var lis = element(by.css('.expressions ul')).element.all(by.repeater('expr in exprs')); +    expect(lis.count()).toBe(1); +    expect(lis.get(0).getText()).toEqual('[ X ] 3*10|currency => $30.00');   }); -</doc:scenario> +</doc:protractor>  </doc:example> @@ -99,7 +99,7 @@ prevent accidental access to the global state (a common source of subtle bugs).       $scope.name = 'World';       $scope.greet = function() { -       ($window.mockWindow || $window).alert('Hello ' + $scope.name); +       $window.alert('Hello ' + $scope.name);       }     }   </script> @@ -108,21 +108,17 @@ prevent accidental access to the global state (a common source of subtle bugs).     <button ng-click="greet()">Greet</button>   </div>  </doc:source> -<doc:scenario> - it('should calculate expression in binding', function() { -   var alertText; -   this.addFutureAction('set mock', function($window, $document, done) { -     $window.mockWindow = { -       alert: function(text){ alertText = text; } -     }; -     done(); -   }); -   element(':button:contains(Greet)').click(); -   expect(this.addFuture('alert text', function(done) { -     done(null, alertText); -   })).toBe('Hello World'); - }); -</doc:scenario> +<doc:protractor> +  it('should calculate expression in binding', function() { +    element(by.css('[ng-click="greet()"]')).click(); + +    var alertDialog = browser.switchTo().alert(); + +    expect(alertDialog.getText()).toEqual('Hello World'); + +    alertDialog.accept(); +  }); +</doc:protractor>  </doc:example>  ## Forgiving | 
