app/assets/javascripts/angular/angular-route.js in angular-rails-engine-1.2.5.0 vs app/assets/javascripts/angular/angular-route.js in angular-rails-engine-1.2.13.0

- old
+ new

@@ -1,7 +1,7 @@ /** - * @license AngularJS v1.2.5 + * @license AngularJS v1.2.13 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; @@ -188,11 +188,11 @@ }, keys = ret.keys = []; path = path .replace(/([().])/g, '\\$1') - .replace(/(\/)?:(\w+)([\?|\*])?/g, function(_, slash, key, option){ + .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option){ var optional = option === '?' ? option : null; var star = option === '*' ? option : null; keys.push({ name: key, optional: !!optional }); slash = slash || ''; return '' @@ -348,21 +348,21 @@ $scope.name = "ChapterCntl"; $scope.params = $routeParams; } </file> - <file name="scenario.js"> + <file name="protractorTest.js"> it('should load and compile correct template', function() { - element('a:contains("Moby: Ch1")').click(); - var content = element('.doc-example-live [ng-view]').text(); + element(by.linkText('Moby: Ch1')).click(); + var content = element(by.css('.doc-example-live [ng-view]')).getText(); expect(content).toMatch(/controller\: ChapterCntl/); expect(content).toMatch(/Book Id\: Moby/); expect(content).toMatch(/Chapter Id\: 1/); - element('a:contains("Scarlet")').click(); - sleep(2); // promises are not part of scenario waiting - content = element('.doc-example-live [ng-view]').text(); + element(by.partialLinkText('Scarlet')).click(); + + content = element(by.css('.doc-example-live [ng-view]')).getText(); expect(content).toMatch(/controller\: BookCntl/); expect(content).toMatch(/Book Id\: Scarlet/); }); </file> </example> @@ -373,11 +373,11 @@ * @name ngRoute.$route#$routeChangeStart * @eventOf ngRoute.$route * @eventType broadcast on root scope * @description * Broadcasted before a route change. At this point the route services starts - * resolving all of the dependencies needed for the route change to occurs. + * resolving all of the dependencies needed for the route change to occur. * Typically this involves fetching the view template as well as any dependencies * defined in `resolve` route property. Once all of the dependencies are resolved * `$routeChangeSuccess` is fired. * * @param {Object} angularEvent Synthetic event object. @@ -667,10 +667,19 @@ * * The enter and leave animation occur concurrently. * * @scope * @priority 400 + * @param {string=} onload Expression to evaluate whenever the view updates. + * + * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll + * $anchorScroll} to scroll the viewport after the view is updated. + * + * - If the attribute is not set, disable scrolling. + * - If the attribute is set without value, enable scrolling. + * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated + * as an expression yields a truthy value. * @example <example module="ngViewExample" deps="angular-route.js" animations="true"> <file name="index.html"> <div ng-controller="MainCntl as main"> Choose: @@ -783,20 +792,21 @@ this.name = "ChapterCntl"; this.params = $routeParams; } </file> - <file name="scenario.js"> + <file name="protractorTest.js"> it('should load and compile correct template', function() { - element('a:contains("Moby: Ch1")').click(); - var content = element('.doc-example-live [ng-view]').text(); + element(by.linkText('Moby: Ch1')).click(); + var content = element(by.css('.doc-example-live [ng-view]')).getText(); expect(content).toMatch(/controller\: ChapterCntl/); expect(content).toMatch(/Book Id\: Moby/); expect(content).toMatch(/Chapter Id\: 1/); - element('a:contains("Scarlet")').click(); - content = element('.doc-example-live [ng-view]').text(); + element(by.partialLinkText('Scarlet')).click(); + + content = element(by.css('.doc-example-live [ng-view]')).getText(); expect(content).toMatch(/controller\: BookCntl/); expect(content).toMatch(/Book Id\: Scarlet/); }); </file> </example> @@ -840,10 +850,10 @@ function update() { var locals = $route.current && $route.current.locals, template = locals && locals.$template; - if (template) { + if (angular.isDefined(template)) { var newScope = scope.$new(); var current = $route.current; // Note: This will also link all children of ng-view that were contained in the original // html. If that content contains controllers, ... they could pollute/change the scope.