angularjs-rails 1.2.10 → 1.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.10
2
+ * @license AngularJS v1.2.12
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.10
2
+ * @license AngularJS v1.2.12
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -68,7 +68,7 @@ function minErr(module) {
68
68
  return match;
69
69
  });
70
70
 
71
- message = message + '\nhttp://errors.angularjs.org/1.2.10/' +
71
+ message = message + '\nhttp://errors.angularjs.org/1.2.12/' +
72
72
  (module ? module + '/' : '') + code;
73
73
  for (i = 2; i < arguments.length; i++) {
74
74
  message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
@@ -271,7 +271,7 @@ function isArrayLike(obj) {
271
271
  * is the value of an object property or an array element and `key` is the object property key or
272
272
  * array element index. Specifying a `context` for the function is optional.
273
273
  *
274
- * It is worth nothing that `.forEach` does not iterate over inherited properties because it filters
274
+ * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
275
275
  * using the `hasOwnProperty` method.
276
276
  *
277
277
  <pre>
@@ -280,7 +280,7 @@ function isArrayLike(obj) {
280
280
  angular.forEach(values, function(value, key){
281
281
  this.push(key + ': ' + value);
282
282
  }, log);
283
- expect(log).toEqual(['name: misko', 'gender:male']);
283
+ expect(log).toEqual(['name: misko', 'gender: male']);
284
284
  </pre>
285
285
  *
286
286
  * @param {Object|Array} obj Object to iterate over.
@@ -851,7 +851,7 @@ function shallowCopy(src, dst) {
851
851
  for(var key in src) {
852
852
  // shallowCopy is only ever called by $compile nodeLinkFn, which has control over src
853
853
  // so we don't need to worry about using our custom hasOwnProperty here
854
- if (src.hasOwnProperty(key) && key.charAt(0) !== '$' && key.charAt(1) !== '$') {
854
+ if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
855
855
  dst[key] = src[key];
856
856
  }
857
857
  }
@@ -1834,11 +1834,11 @@ function setupModuleLoader(window) {
1834
1834
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
1835
1835
  */
1836
1836
  var version = {
1837
- full: '1.2.10', // all of these placeholder strings will be replaced by grunt's
1837
+ full: '1.2.12', // all of these placeholder strings will be replaced by grunt's
1838
1838
  major: 1, // package task
1839
1839
  minor: 2,
1840
- dot: 10,
1841
- codeName: 'augmented-serendipity'
1840
+ dot: 12,
1841
+ codeName: 'cauliflower-eradication'
1842
1842
  };
1843
1843
 
1844
1844
 
@@ -2135,6 +2135,9 @@ function JQLite(element) {
2135
2135
  if (element instanceof JQLite) {
2136
2136
  return element;
2137
2137
  }
2138
+ if (isString(element)) {
2139
+ element = trim(element);
2140
+ }
2138
2141
  if (!(this instanceof JQLite)) {
2139
2142
  if (isString(element) && element.charAt(0) != '<') {
2140
2143
  throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
@@ -3408,17 +3411,16 @@ function annotate(fn) {
3408
3411
  * Here is an example of registering a service using
3409
3412
  * {@link AUTO.$provide#methods_service $provide.service(class)}.
3410
3413
  * <pre>
3411
- * $provide.service('ping', ['$http', function($http) {
3412
- * var Ping = function() {
3413
- * this.$http = $http;
3414
- * };
3415
- *
3416
- * Ping.prototype.send = function() {
3417
- * return this.$http.get('/ping');
3418
- * };
3414
+ * var Ping = function($http) {
3415
+ * this.$http = $http;
3416
+ * };
3417
+ *
3418
+ * Ping.$inject = ['$http'];
3419
3419
  *
3420
- * return Ping;
3421
- * }]);
3420
+ * Ping.prototype.send = function() {
3421
+ * return this.$http.get('/ping');
3422
+ * };
3423
+ * $provide.service('ping', Ping);
3422
3424
  * </pre>
3423
3425
  * You would then inject and use this service like this:
3424
3426
  * <pre>
@@ -3516,7 +3518,7 @@ function annotate(fn) {
3516
3518
  * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting
3517
3519
  * calls to {@link ng.$log#error $log.warn()}.
3518
3520
  * <pre>
3519
- * $provider.decorator('$log', ['$delegate', function($delegate) {
3521
+ * $provide.decorator('$log', ['$delegate', function($delegate) {
3520
3522
  * $delegate.warn = $delegate.error;
3521
3523
  * return $delegate;
3522
3524
  * }]);
@@ -5119,13 +5121,17 @@ function $TemplateCacheProvider() {
5119
5121
  <div compile="html"></div>
5120
5122
  </div>
5121
5123
  </doc:source>
5122
- <doc:scenario>
5124
+ <doc:protractor>
5123
5125
  it('should auto compile', function() {
5124
- expect(element('div[compile]').text()).toBe('Hello Angular');
5125
- input('html').enter('{{name}}!');
5126
- expect(element('div[compile]').text()).toBe('Angular!');
5126
+ var textarea = $('textarea');
5127
+ var output = $('div[compile]');
5128
+ // The initial state reads 'Hello Angular'.
5129
+ expect(output.getText()).toBe('Hello Angular');
5130
+ textarea.clear();
5131
+ textarea.sendKeys('{{name}}!');
5132
+ expect(output.getText()).toBe('Angular!');
5127
5133
  });
5128
- </doc:scenario>
5134
+ </doc:protractor>
5129
5135
  </doc:example>
5130
5136
 
5131
5137
  *
@@ -5887,7 +5893,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
5887
5893
  hasTranscludeDirective = true;
5888
5894
 
5889
5895
  // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
5890
- // This option should only be used by directives that know how to how to safely handle element transclusion,
5896
+ // This option should only be used by directives that know how to safely handle element transclusion,
5891
5897
  // where the transcluded nodes are added or replaced after linking.
5892
5898
  if (!directive.$$tlb) {
5893
5899
  assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
@@ -6402,9 +6408,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6402
6408
  linkNode = $compileNode[0];
6403
6409
 
6404
6410
  if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
6411
+ var oldClasses = beforeTemplateLinkNode.className;
6405
6412
  // it was cloned therefore we have to clone as well.
6406
6413
  linkNode = jqLiteClone(compileNode);
6407
6414
  replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
6415
+
6416
+ // Copy in CSS classes from original node
6417
+ safeAddClass(jqLite(linkNode), oldClasses);
6408
6418
  }
6409
6419
  if (afterTemplateNodeLinkFn.transclude) {
6410
6420
  childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude);
@@ -7425,14 +7435,14 @@ function $HttpProvider() {
7425
7435
  <option>JSONP</option>
7426
7436
  </select>
7427
7437
  <input type="text" ng-model="url" size="80"/>
7428
- <button ng-click="fetch()">fetch</button><br>
7429
- <button ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
7430
- <button
7438
+ <button id="fetchbtn" ng-click="fetch()">fetch</button><br>
7439
+ <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
7440
+ <button id="samplejsonpbtn"
7431
7441
  ng-click="updateModel('JSONP',
7432
7442
  'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">
7433
7443
  Sample JSONP
7434
7444
  </button>
7435
- <button
7445
+ <button id="invalidjsonpbtn"
7436
7446
  ng-click="updateModel('JSONP', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">
7437
7447
  Invalid JSONP
7438
7448
  </button>
@@ -7469,27 +7479,34 @@ function $HttpProvider() {
7469
7479
  <file name="http-hello.html">
7470
7480
  Hello, $http!
7471
7481
  </file>
7472
- <file name="scenario.js">
7482
+ <file name="protractorTest.js">
7483
+ var status = element(by.binding('status'));
7484
+ var data = element(by.binding('data'));
7485
+ var fetchBtn = element(by.id('fetchbtn'));
7486
+ var sampleGetBtn = element(by.id('samplegetbtn'));
7487
+ var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
7488
+ var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));
7489
+
7473
7490
  it('should make an xhr GET request', function() {
7474
- element(':button:contains("Sample GET")').click();
7475
- element(':button:contains("fetch")').click();
7476
- expect(binding('status')).toBe('200');
7477
- expect(binding('data')).toMatch(/Hello, \$http!/);
7491
+ sampleGetBtn.click();
7492
+ fetchBtn.click();
7493
+ expect(status.getText()).toMatch('200');
7494
+ expect(data.getText()).toMatch(/Hello, \$http!/)
7478
7495
  });
7479
7496
 
7480
7497
  it('should make a JSONP request to angularjs.org', function() {
7481
- element(':button:contains("Sample JSONP")').click();
7482
- element(':button:contains("fetch")').click();
7483
- expect(binding('status')).toBe('200');
7484
- expect(binding('data')).toMatch(/Super Hero!/);
7498
+ sampleJsonpBtn.click();
7499
+ fetchBtn.click();
7500
+ expect(status.getText()).toMatch('200');
7501
+ expect(data.getText()).toMatch(/Super Hero!/);
7485
7502
  });
7486
7503
 
7487
7504
  it('should make JSONP request to invalid URL and invoke the error handler',
7488
7505
  function() {
7489
- element(':button:contains("Invalid JSONP")').click();
7490
- element(':button:contains("fetch")').click();
7491
- expect(binding('status')).toBe('0');
7492
- expect(binding('data')).toBe('Request failed');
7506
+ invalidJsonpBtn.click();
7507
+ fetchBtn.click();
7508
+ expect(status.getText()).toMatch('0');
7509
+ expect(data.getText()).toMatch('Request failed');
7493
7510
  });
7494
7511
  </file>
7495
7512
  </example>
@@ -7871,13 +7888,18 @@ function $HttpProvider() {
7871
7888
  }
7872
7889
 
7873
7890
  function createXhr(method) {
7874
- // IE8 doesn't support PATCH method, but the ActiveX object does
7875
- /* global ActiveXObject */
7876
- return (msie <= 8 && lowercase(method) === 'patch')
7877
- ? new ActiveXObject('Microsoft.XMLHTTP')
7878
- : new window.XMLHttpRequest();
7879
- }
7891
+ //if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
7892
+ //is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
7893
+ //if it is available
7894
+ if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
7895
+ !window.XMLHttpRequest)) {
7896
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
7897
+ } else if (window.XMLHttpRequest) {
7898
+ return new window.XMLHttpRequest();
7899
+ }
7880
7900
 
7901
+ throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
7902
+ }
7881
7903
 
7882
7904
  /**
7883
7905
  * @ngdoc object
@@ -7972,7 +7994,20 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
7972
7994
  }
7973
7995
 
7974
7996
  if (responseType) {
7975
- xhr.responseType = responseType;
7997
+ try {
7998
+ xhr.responseType = responseType;
7999
+ } catch (e) {
8000
+ // WebKit added support for the json responseType value on 09/03/2013
8001
+ // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
8002
+ // known to throw when setting the value "json" as the response type. Other older
8003
+ // browsers implementing the responseType
8004
+ //
8005
+ // The json response type can be ignored if not supported, because JSON payloads are
8006
+ // parsed on the client-side regardless.
8007
+ if (responseType !== 'json') {
8008
+ throw e;
8009
+ }
8010
+ }
7976
8011
  }
7977
8012
 
7978
8013
  xhr.send(post || null);
@@ -8071,11 +8106,11 @@ var $interpolateMinErr = minErr('$interpolate');
8071
8106
  //demo.label//
8072
8107
  </div>
8073
8108
  </doc:source>
8074
- <doc:scenario>
8075
- it('should interpolate binding with custom symbols', function() {
8076
- expect(binding('demo.label')).toBe('This binding is brought you by // interpolation symbols.');
8077
- });
8078
- </doc:scenario>
8109
+ <doc:protractor>
8110
+ it('should interpolate binding with custom symbols', function() {
8111
+ expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');
8112
+ });
8113
+ </doc:protractor>
8079
8114
  </doc:example>
8080
8115
  */
8081
8116
  function $InterpolateProvider() {
@@ -9294,7 +9329,7 @@ function $LogProvider(){
9294
9329
  * @name ng.$logProvider#debugEnabled
9295
9330
  * @methodOf ng.$logProvider
9296
9331
  * @description
9297
- * @param {string=} flag enable or disable debug level messages
9332
+ * @param {boolean=} flag enable or disable debug level messages
9298
9333
  * @returns {*} current value if used as getter or itself (chaining) if used as setter
9299
9334
  */
9300
9335
  this.debugEnabled = function(flag) {
@@ -10750,7 +10785,7 @@ function $ParseProvider() {
10750
10785
  * constructed via `$q.reject`, the promise will be rejected instead.
10751
10786
  * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
10752
10787
  * resolving it with a rejection constructed via `$q.reject`.
10753
- * - `notify(value)` - provides updates on the status of the promises execution. This may be called
10788
+ * - `notify(value)` - provides updates on the status of the promise's execution. This may be called
10754
10789
  * multiple times before the promise is either resolved or rejected.
10755
10790
  *
10756
10791
  * **Properties**
@@ -10900,7 +10935,7 @@ function qFactory(nextTick, exceptionHandler) {
10900
10935
 
10901
10936
 
10902
10937
  reject: function(reason) {
10903
- deferred.resolve(reject(reason));
10938
+ deferred.resolve(createInternalRejectedPromise(reason));
10904
10939
  },
10905
10940
 
10906
10941
 
@@ -11057,6 +11092,12 @@ function qFactory(nextTick, exceptionHandler) {
11057
11092
  * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
11058
11093
  */
11059
11094
  var reject = function(reason) {
11095
+ var result = defer();
11096
+ result.reject(reason);
11097
+ return result.promise;
11098
+ };
11099
+
11100
+ var createInternalRejectedPromise = function(reason) {
11060
11101
  return {
11061
11102
  then: function(callback, errback) {
11062
11103
  var result = defer();
@@ -12117,7 +12158,7 @@ function $RootScopeProvider(){
12117
12158
  * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
12118
12159
  *
12119
12160
  * @param {string} name Event name to emit.
12120
- * @param {...*} args Optional set of arguments which will be passed onto the event listeners.
12161
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
12121
12162
  * @return {Object} Event object (see {@link ng.$rootScope.Scope#methods_$on}).
12122
12163
  */
12123
12164
  $emit: function(name, args) {
@@ -12185,7 +12226,7 @@ function $RootScopeProvider(){
12185
12226
  * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
12186
12227
  *
12187
12228
  * @param {string} name Event name to broadcast.
12188
- * @param {...*} args Optional set of arguments which will be passed onto the event listeners.
12229
+ * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
12189
12230
  * @return {Object} Event object, see {@link ng.$rootScope.Scope#methods_$on}
12190
12231
  */
12191
12232
  $broadcast: function(name, args) {
@@ -12977,13 +13018,15 @@ function $SceDelegateProvider() {
12977
13018
  ]
12978
13019
  </file>
12979
13020
 
12980
- <file name="scenario.js">
13021
+ <file name="protractorTest.js">
12981
13022
  describe('SCE doc demo', function() {
12982
13023
  it('should sanitize untrusted values', function() {
12983
- expect(element('.htmlComment').html()).toBe('<span>Is <i>anyone</i> reading this?</span>');
13024
+ expect(element(by.css('.htmlComment')).getInnerHtml())
13025
+ .toBe('<span>Is <i>anyone</i> reading this?</span>');
12984
13026
  });
13027
+
12985
13028
  it('should NOT sanitize explicitly trusted values', function() {
12986
- expect(element('#explicitlyTrustedHtml').html()).toBe(
13029
+ expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
12987
13030
  '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
12988
13031
  'sanitization.&quot;">Hover over this text.</span>');
12989
13032
  });
@@ -13742,13 +13785,13 @@ function urlIsSameOrigin(requestUrl) {
13742
13785
  <button ng-click="doGreeting(greeting)">ALERT</button>
13743
13786
  </div>
13744
13787
  </doc:source>
13745
- <doc:scenario>
13788
+ <doc:protractor>
13746
13789
  it('should display the greeting in the input box', function() {
13747
- input('greeting').enter('Hello, E2E Tests');
13790
+ element(by.model('greeting')).sendKeys('Hello, E2E Tests');
13748
13791
  // If we click the button it will block the test runner
13749
13792
  // element(':button').click();
13750
13793
  });
13751
- </doc:scenario>
13794
+ </doc:protractor>
13752
13795
  </doc:example>
13753
13796
  */
13754
13797
  function $WindowProvider(){
@@ -13957,35 +14000,47 @@ function $FilterProvider($provide) {
13957
14000
  Equality <input type="checkbox" ng-model="strict"><br>
13958
14001
  <table id="searchObjResults">
13959
14002
  <tr><th>Name</th><th>Phone</th></tr>
13960
- <tr ng-repeat="friend in friends | filter:search:strict">
13961
- <td>{{friend.name}}</td>
13962
- <td>{{friend.phone}}</td>
14003
+ <tr ng-repeat="friendObj in friends | filter:search:strict">
14004
+ <td>{{friendObj.name}}</td>
14005
+ <td>{{friendObj.phone}}</td>
13963
14006
  </tr>
13964
14007
  </table>
13965
14008
  </doc:source>
13966
- <doc:scenario>
13967
- it('should search across all fields when filtering with a string', function() {
13968
- input('searchText').enter('m');
13969
- expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')).
13970
- toEqual(['Mary', 'Mike', 'Adam']);
14009
+ <doc:protractor>
14010
+ var expectFriendNames = function(expectedNames, key) {
14011
+ element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {
14012
+ arr.forEach(function(wd, i) {
14013
+ expect(wd.getText()).toMatch(expectedNames[i]);
14014
+ });
14015
+ });
14016
+ };
13971
14017
 
13972
- input('searchText').enter('76');
13973
- expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')).
13974
- toEqual(['John', 'Julie']);
14018
+ it('should search across all fields when filtering with a string', function() {
14019
+ var searchText = element(by.model('searchText'));
14020
+ searchText.clear();
14021
+ searchText.sendKeys('m');
14022
+ expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');
14023
+
14024
+ searchText.clear();
14025
+ searchText.sendKeys('76');
14026
+ expectFriendNames(['John', 'Julie'], 'friend');
13975
14027
  });
13976
14028
 
13977
14029
  it('should search in specific fields when filtering with a predicate object', function() {
13978
- input('search.$').enter('i');
13979
- expect(repeater('#searchObjResults tr', 'friend in friends').column('friend.name')).
13980
- toEqual(['Mary', 'Mike', 'Julie', 'Juliette']);
14030
+ var searchAny = element(by.model('search.$'));
14031
+ searchAny.clear();
14032
+ searchAny.sendKeys('i');
14033
+ expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');
13981
14034
  });
13982
14035
  it('should use a equal comparison when comparator is true', function() {
13983
- input('search.name').enter('Julie');
13984
- input('strict').check();
13985
- expect(repeater('#searchObjResults tr', 'friend in friends').column('friend.name')).
13986
- toEqual(['Julie']);
14036
+ var searchName = element(by.model('search.name'));
14037
+ var strict = element(by.model('strict'));
14038
+ searchName.clear();
14039
+ searchName.sendKeys('Julie');
14040
+ strict.click();
14041
+ expectFriendNames(['Julie'], 'friendObj');
13987
14042
  });
13988
- </doc:scenario>
14043
+ </doc:protractor>
13989
14044
  </doc:example>
13990
14045
  */
13991
14046
  function filterFilter() {
@@ -14063,7 +14118,7 @@ function filterFilter() {
14063
14118
  (function(path) {
14064
14119
  if (typeof expression[path] == 'undefined') return;
14065
14120
  predicates.push(function(value) {
14066
- return search(path == '$' ? value : getter(value, path), expression[path]);
14121
+ return search(path == '$' ? value : (value && value[path]), expression[path]);
14067
14122
  });
14068
14123
  })(key);
14069
14124
  }
@@ -14109,21 +14164,26 @@ function filterFilter() {
14109
14164
  </script>
14110
14165
  <div ng-controller="Ctrl">
14111
14166
  <input type="number" ng-model="amount"> <br>
14112
- default currency symbol ($): {{amount | currency}}<br>
14113
- custom currency identifier (USD$): {{amount | currency:"USD$"}}
14167
+ default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
14168
+ custom currency identifier (USD$): <span>{{amount | currency:"USD$"}}</span>
14114
14169
  </div>
14115
14170
  </doc:source>
14116
- <doc:scenario>
14171
+ <doc:protractor>
14117
14172
  it('should init with 1234.56', function() {
14118
- expect(binding('amount | currency')).toBe('$1,234.56');
14119
- expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56');
14173
+ expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');
14174
+ expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('USD$1,234.56');
14120
14175
  });
14121
14176
  it('should update', function() {
14122
- input('amount').enter('-1234');
14123
- expect(binding('amount | currency')).toBe('($1,234.00)');
14124
- expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)');
14177
+ if (browser.params.browser == 'safari') {
14178
+ // Safari does not understand the minus key. See
14179
+ // https://github.com/angular/protractor/issues/481
14180
+ return;
14181
+ }
14182
+ element(by.model('amount')).clear();
14183
+ element(by.model('amount')).sendKeys('-1234'); expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)');
14184
+ expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('(USD$1,234.00)');
14125
14185
  });
14126
- </doc:scenario>
14186
+ </doc:protractor>
14127
14187
  </doc:example>
14128
14188
  */
14129
14189
  currencyFilter.$inject = ['$locale'];
@@ -14162,25 +14222,26 @@ function currencyFilter($locale) {
14162
14222
  </script>
14163
14223
  <div ng-controller="Ctrl">
14164
14224
  Enter number: <input ng-model='val'><br>
14165
- Default formatting: {{val | number}}<br>
14166
- No fractions: {{val | number:0}}<br>
14167
- Negative number: {{-val | number:4}}
14225
+ Default formatting: <span id='number-default'>{{val | number}}</span><br>
14226
+ No fractions: <span>{{val | number:0}}</span><br>
14227
+ Negative number: <span>{{-val | number:4}}</span>
14168
14228
  </div>
14169
14229
  </doc:source>
14170
- <doc:scenario>
14230
+ <doc:protractor>
14171
14231
  it('should format numbers', function() {
14172
- expect(binding('val | number')).toBe('1,234.568');
14173
- expect(binding('val | number:0')).toBe('1,235');
14174
- expect(binding('-val | number:4')).toBe('-1,234.5679');
14232
+ expect(element(by.id('number-default')).getText()).toBe('1,234.568');
14233
+ expect(element(by.binding('val | number:0')).getText()).toBe('1,235');
14234
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');
14175
14235
  });
14176
14236
 
14177
14237
  it('should update', function() {
14178
- input('val').enter('3374.333');
14179
- expect(binding('val | number')).toBe('3,374.333');
14180
- expect(binding('val | number:0')).toBe('3,374');
14181
- expect(binding('-val | number:4')).toBe('-3,374.3330');
14182
- });
14183
- </doc:scenario>
14238
+ element(by.model('val')).clear();
14239
+ element(by.model('val')).sendKeys('3374.333');
14240
+ expect(element(by.id('number-default')).getText()).toBe('3,374.333');
14241
+ expect(element(by.binding('val | number:0')).getText()).toBe('3,374');
14242
+ expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');
14243
+ });
14244
+ </doc:protractor>
14184
14245
  </doc:example>
14185
14246
  */
14186
14247
 
@@ -14410,22 +14471,22 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+
14410
14471
  <doc:example>
14411
14472
  <doc:source>
14412
14473
  <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
14413
- {{1288323623006 | date:'medium'}}<br>
14474
+ <span>{{1288323623006 | date:'medium'}}</span><br>
14414
14475
  <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
14415
- {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}<br>
14476
+ <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
14416
14477
  <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
14417
- {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}<br>
14478
+ <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>
14418
14479
  </doc:source>
14419
- <doc:scenario>
14480
+ <doc:protractor>
14420
14481
  it('should format date', function() {
14421
- expect(binding("1288323623006 | date:'medium'")).
14482
+ expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
14422
14483
  toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
14423
- expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).
14484
+ expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
14424
14485
  toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
14425
- expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).
14486
+ expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
14426
14487
  toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
14427
14488
  });
14428
- </doc:scenario>
14489
+ </doc:protractor>
14429
14490
  </doc:example>
14430
14491
  */
14431
14492
  dateFilter.$inject = ['$locale'];
@@ -14524,11 +14585,11 @@ function dateFilter($locale) {
14524
14585
  <doc:source>
14525
14586
  <pre>{{ {'name':'value'} | json }}</pre>
14526
14587
  </doc:source>
14527
- <doc:scenario>
14588
+ <doc:protractor>
14528
14589
  it('should jsonify filtered objects', function() {
14529
- expect(binding("{'name':'value'}")).toMatch(/\{\n "name": ?"value"\n}/);
14590
+ expect(element(by.binding("{'name':'value'}")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
14530
14591
  });
14531
- </doc:scenario>
14592
+ </doc:protractor>
14532
14593
  </doc:example>
14533
14594
  *
14534
14595
  */
@@ -14596,28 +14657,37 @@ var uppercaseFilter = valueFn(uppercase);
14596
14657
  <p>Output letters: {{ letters | limitTo:letterLimit }}</p>
14597
14658
  </div>
14598
14659
  </doc:source>
14599
- <doc:scenario>
14660
+ <doc:protractor>
14661
+ var numLimitInput = element(by.model('numLimit'));
14662
+ var letterLimitInput = element(by.model('letterLimit'));
14663
+ var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
14664
+ var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
14665
+
14600
14666
  it('should limit the number array to first three items', function() {
14601
- expect(element('.doc-example-live input[ng-model=numLimit]').val()).toBe('3');
14602
- expect(element('.doc-example-live input[ng-model=letterLimit]').val()).toBe('3');
14603
- expect(binding('numbers | limitTo:numLimit')).toEqual('[1,2,3]');
14604
- expect(binding('letters | limitTo:letterLimit')).toEqual('abc');
14667
+ expect(numLimitInput.getAttribute('value')).toBe('3');
14668
+ expect(letterLimitInput.getAttribute('value')).toBe('3');
14669
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
14670
+ expect(limitedLetters.getText()).toEqual('Output letters: abc');
14605
14671
  });
14606
14672
 
14607
14673
  it('should update the output when -3 is entered', function() {
14608
- input('numLimit').enter(-3);
14609
- input('letterLimit').enter(-3);
14610
- expect(binding('numbers | limitTo:numLimit')).toEqual('[7,8,9]');
14611
- expect(binding('letters | limitTo:letterLimit')).toEqual('ghi');
14674
+ numLimitInput.clear();
14675
+ numLimitInput.sendKeys('-3');
14676
+ letterLimitInput.clear();
14677
+ letterLimitInput.sendKeys('-3');
14678
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
14679
+ expect(limitedLetters.getText()).toEqual('Output letters: ghi');
14612
14680
  });
14613
14681
 
14614
14682
  it('should not exceed the maximum size of input array', function() {
14615
- input('numLimit').enter(100);
14616
- input('letterLimit').enter(100);
14617
- expect(binding('numbers | limitTo:numLimit')).toEqual('[1,2,3,4,5,6,7,8,9]');
14618
- expect(binding('letters | limitTo:letterLimit')).toEqual('abcdefghi');
14683
+ numLimitInput.clear();
14684
+ numLimitInput.sendKeys('100');
14685
+ letterLimitInput.clear();
14686
+ letterLimitInput.sendKeys('100');
14687
+ expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
14688
+ expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
14619
14689
  });
14620
- </doc:scenario>
14690
+ </doc:protractor>
14621
14691
  </doc:example>
14622
14692
  */
14623
14693
  function limitToFilter(){
@@ -14718,29 +14788,6 @@ function limitToFilter(){
14718
14788
  </table>
14719
14789
  </div>
14720
14790
  </doc:source>
14721
- <doc:scenario>
14722
- it('should be reverse ordered by aged', function() {
14723
- expect(binding('predicate')).toBe('-age');
14724
- expect(repeater('table.friend', 'friend in friends').column('friend.age')).
14725
- toEqual(['35', '29', '21', '19', '10']);
14726
- expect(repeater('table.friend', 'friend in friends').column('friend.name')).
14727
- toEqual(['Adam', 'Julie', 'Mike', 'Mary', 'John']);
14728
- });
14729
-
14730
- it('should reorder the table when user selects different predicate', function() {
14731
- element('.doc-example-live a:contains("Name")').click();
14732
- expect(repeater('table.friend', 'friend in friends').column('friend.name')).
14733
- toEqual(['Adam', 'John', 'Julie', 'Mary', 'Mike']);
14734
- expect(repeater('table.friend', 'friend in friends').column('friend.age')).
14735
- toEqual(['35', '10', '29', '19', '21']);
14736
-
14737
- element('.doc-example-live a:contains("Phone")').click();
14738
- expect(repeater('table.friend', 'friend in friends').column('friend.phone')).
14739
- toEqual(['555-9876', '555-8765', '555-5678', '555-4321', '555-1212']);
14740
- expect(repeater('table.friend', 'friend in friends').column('friend.name')).
14741
- toEqual(['Mary', 'Julie', 'Adam', 'Mike', 'John']);
14742
- });
14743
- </doc:scenario>
14744
14791
  </doc:example>
14745
14792
  */
14746
14793
  orderByFilter.$inject = ['$parse'];
@@ -14894,46 +14941,55 @@ var htmlAnchorDirective = valueFn({
14894
14941
  <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
14895
14942
  <a id="link-6" ng-href="{{value}}">link</a> (link, change location)
14896
14943
  </doc:source>
14897
- <doc:scenario>
14944
+ <doc:protractor>
14898
14945
  it('should execute ng-click but not reload when href without value', function() {
14899
- element('#link-1').click();
14900
- expect(input('value').val()).toEqual('1');
14901
- expect(element('#link-1').attr('href')).toBe("");
14946
+ element(by.id('link-1')).click();
14947
+ expect(element(by.model('value')).getAttribute('value')).toEqual('1');
14948
+ expect(element(by.id('link-1')).getAttribute('href')).toBe('');
14902
14949
  });
14903
14950
 
14904
14951
  it('should execute ng-click but not reload when href empty string', function() {
14905
- element('#link-2').click();
14906
- expect(input('value').val()).toEqual('2');
14907
- expect(element('#link-2').attr('href')).toBe("");
14952
+ element(by.id('link-2')).click();
14953
+ expect(element(by.model('value')).getAttribute('value')).toEqual('2');
14954
+ expect(element(by.id('link-2')).getAttribute('href')).toBe('');
14908
14955
  });
14909
14956
 
14910
14957
  it('should execute ng-click and change url when ng-href specified', function() {
14911
- expect(element('#link-3').attr('href')).toBe("/123");
14958
+ expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/);
14959
+
14960
+ element(by.id('link-3')).click();
14961
+
14962
+ // At this point, we navigate away from an Angular page, so we need
14963
+ // to use browser.driver to get the base webdriver.
14912
14964
 
14913
- element('#link-3').click();
14914
- expect(browser().window().path()).toEqual('/123');
14965
+ browser.wait(function() {
14966
+ return browser.driver.getCurrentUrl().then(function(url) {
14967
+ return url.match(/\/123$/);
14968
+ });
14969
+ }, 1000, 'page should navigate to /123');
14915
14970
  });
14916
14971
 
14917
14972
  it('should execute ng-click but not reload when href empty string and name specified', function() {
14918
- element('#link-4').click();
14919
- expect(input('value').val()).toEqual('4');
14920
- expect(element('#link-4').attr('href')).toBe('');
14973
+ element(by.id('link-4')).click();
14974
+ expect(element(by.model('value')).getAttribute('value')).toEqual('4');
14975
+ expect(element(by.id('link-4')).getAttribute('href')).toBe('');
14921
14976
  });
14922
14977
 
14923
14978
  it('should execute ng-click but not reload when no href but name specified', function() {
14924
- element('#link-5').click();
14925
- expect(input('value').val()).toEqual('5');
14926
- expect(element('#link-5').attr('href')).toBe(undefined);
14979
+ element(by.id('link-5')).click();
14980
+ expect(element(by.model('value')).getAttribute('value')).toEqual('5');
14981
+ expect(element(by.id('link-5')).getAttribute('href')).toBe(null);
14927
14982
  });
14928
14983
 
14929
14984
  it('should only change url when only ng-href', function() {
14930
- input('value').enter('6');
14931
- expect(element('#link-6').attr('href')).toBe('6');
14985
+ element(by.model('value')).clear();
14986
+ element(by.model('value')).sendKeys('6');
14987
+ expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/);
14932
14988
 
14933
- element('#link-6').click();
14934
- expect(browser().location().url()).toEqual('/6');
14989
+ element(by.id('link-6')).click();
14990
+ expect(browser.getCurrentUrl()).toMatch(/\/6$/);
14935
14991
  });
14936
- </doc:scenario>
14992
+ </doc:protractor>
14937
14993
  </doc:example>
14938
14994
  */
14939
14995
 
@@ -15018,13 +15074,13 @@ var htmlAnchorDirective = valueFn({
15018
15074
  Click me to toggle: <input type="checkbox" ng-model="checked"><br/>
15019
15075
  <button ng-model="button" ng-disabled="checked">Button</button>
15020
15076
  </doc:source>
15021
- <doc:scenario>
15077
+ <doc:protractor>
15022
15078
  it('should toggle button', function() {
15023
- expect(element('.doc-example-live :button').prop('disabled')).toBeFalsy();
15024
- input('checked').check();
15025
- expect(element('.doc-example-live :button').prop('disabled')).toBeTruthy();
15079
+ expect(element(by.css('.doc-example-live button')).getAttribute('disabled')).toBeFalsy();
15080
+ element(by.model('checked')).click();
15081
+ expect(element(by.css('.doc-example-live button')).getAttribute('disabled')).toBeTruthy();
15026
15082
  });
15027
- </doc:scenario>
15083
+ </doc:protractor>
15028
15084
  </doc:example>
15029
15085
  *
15030
15086
  * @element INPUT
@@ -15053,13 +15109,13 @@ var htmlAnchorDirective = valueFn({
15053
15109
  Check me to check both: <input type="checkbox" ng-model="master"><br/>
15054
15110
  <input id="checkSlave" type="checkbox" ng-checked="master">
15055
15111
  </doc:source>
15056
- <doc:scenario>
15112
+ <doc:protractor>
15057
15113
  it('should check both checkBoxes', function() {
15058
- expect(element('.doc-example-live #checkSlave').prop('checked')).toBeFalsy();
15059
- input('master').check();
15060
- expect(element('.doc-example-live #checkSlave').prop('checked')).toBeTruthy();
15114
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();
15115
+ element(by.model('master')).click();
15116
+ expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();
15061
15117
  });
15062
- </doc:scenario>
15118
+ </doc:protractor>
15063
15119
  </doc:example>
15064
15120
  *
15065
15121
  * @element INPUT
@@ -15088,13 +15144,13 @@ var htmlAnchorDirective = valueFn({
15088
15144
  Check me to make text readonly: <input type="checkbox" ng-model="checked"><br/>
15089
15145
  <input type="text" ng-readonly="checked" value="I'm Angular"/>
15090
15146
  </doc:source>
15091
- <doc:scenario>
15147
+ <doc:protractor>
15092
15148
  it('should toggle readonly attr', function() {
15093
- expect(element('.doc-example-live :text').prop('readonly')).toBeFalsy();
15094
- input('checked').check();
15095
- expect(element('.doc-example-live :text').prop('readonly')).toBeTruthy();
15149
+ expect(element(by.css('.doc-example-live [type="text"]')).getAttribute('readonly')).toBeFalsy();
15150
+ element(by.model('checked')).click();
15151
+ expect(element(by.css('.doc-example-live [type="text"]')).getAttribute('readonly')).toBeTruthy();
15096
15152
  });
15097
- </doc:scenario>
15153
+ </doc:protractor>
15098
15154
  </doc:example>
15099
15155
  *
15100
15156
  * @element INPUT
@@ -15127,13 +15183,13 @@ var htmlAnchorDirective = valueFn({
15127
15183
  <option id="greet" ng-selected="selected">Greetings!</option>
15128
15184
  </select>
15129
15185
  </doc:source>
15130
- <doc:scenario>
15186
+ <doc:protractor>
15131
15187
  it('should select Greetings!', function() {
15132
- expect(element('.doc-example-live #greet').prop('selected')).toBeFalsy();
15133
- input('selected').check();
15134
- expect(element('.doc-example-live #greet').prop('selected')).toBeTruthy();
15188
+ expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();
15189
+ element(by.model('selected')).click();
15190
+ expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();
15135
15191
  });
15136
- </doc:scenario>
15192
+ </doc:protractor>
15137
15193
  </doc:example>
15138
15194
  *
15139
15195
  * @element OPTION
@@ -15163,13 +15219,13 @@ var htmlAnchorDirective = valueFn({
15163
15219
  <summary>Show/Hide me</summary>
15164
15220
  </details>
15165
15221
  </doc:source>
15166
- <doc:scenario>
15222
+ <doc:protractor>
15167
15223
  it('should toggle open', function() {
15168
- expect(element('#details').prop('open')).toBeFalsy();
15169
- input('open').check();
15170
- expect(element('#details').prop('open')).toBeTruthy();
15224
+ expect(element(by.id('details')).getAttribute('open')).toBeFalsy();
15225
+ element(by.model('open')).click();
15226
+ expect(element(by.id('details')).getAttribute('open')).toBeTruthy();
15171
15227
  });
15172
- </doc:scenario>
15228
+ </doc:protractor>
15173
15229
  </doc:example>
15174
15230
  *
15175
15231
  * @element DETAILS
@@ -15528,18 +15584,27 @@ function FormController(element, attrs) {
15528
15584
  <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
15529
15585
  </form>
15530
15586
  </doc:source>
15531
- <doc:scenario>
15587
+ <doc:protractor>
15532
15588
  it('should initialize to model', function() {
15533
- expect(binding('userType')).toEqual('guest');
15534
- expect(binding('myForm.input.$valid')).toEqual('true');
15589
+ var userType = element(by.binding('userType'));
15590
+ var valid = element(by.binding('myForm.input.$valid'));
15591
+
15592
+ expect(userType.getText()).toContain('guest');
15593
+ expect(valid.getText()).toContain('true');
15535
15594
  });
15536
15595
 
15537
15596
  it('should be invalid if empty', function() {
15538
- input('userType').enter('');
15539
- expect(binding('userType')).toEqual('');
15540
- expect(binding('myForm.input.$valid')).toEqual('false');
15597
+ var userType = element(by.binding('userType'));
15598
+ var valid = element(by.binding('myForm.input.$valid'));
15599
+ var userInput = element(by.model('userType'));
15600
+
15601
+ userInput.clear();
15602
+ userInput.sendKeys('');
15603
+
15604
+ expect(userType.getText()).toEqual('userType =');
15605
+ expect(valid.getText()).toContain('false');
15541
15606
  });
15542
- </doc:scenario>
15607
+ </doc:protractor>
15543
15608
  </doc:example>
15544
15609
  */
15545
15610
  var formDirectiveFactory = function(isNgForm) {
@@ -15664,29 +15729,31 @@ var inputType = {
15664
15729
  <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
15665
15730
  </form>
15666
15731
  </doc:source>
15667
- <doc:scenario>
15732
+ <doc:protractor>
15733
+ var text = element(by.binding('text'));
15734
+ var valid = element(by.binding('myForm.input.$valid'));
15735
+ var input = element(by.model('text'));
15736
+
15668
15737
  it('should initialize to model', function() {
15669
- expect(binding('text')).toEqual('guest');
15670
- expect(binding('myForm.input.$valid')).toEqual('true');
15738
+ expect(text.getText()).toContain('guest');
15739
+ expect(valid.getText()).toContain('true');
15671
15740
  });
15672
15741
 
15673
15742
  it('should be invalid if empty', function() {
15674
- input('text').enter('');
15675
- expect(binding('text')).toEqual('');
15676
- expect(binding('myForm.input.$valid')).toEqual('false');
15743
+ input.clear();
15744
+ input.sendKeys('');
15745
+
15746
+ expect(text.getText()).toEqual('text =');
15747
+ expect(valid.getText()).toContain('false');
15677
15748
  });
15678
15749
 
15679
15750
  it('should be invalid if multi word', function() {
15680
- input('text').enter('hello world');
15681
- expect(binding('myForm.input.$valid')).toEqual('false');
15682
- });
15751
+ input.clear();
15752
+ input.sendKeys('hello world');
15683
15753
 
15684
- it('should not be trimmed', function() {
15685
- input('text').enter('untrimmed ');
15686
- expect(binding('text')).toEqual('untrimmed ');
15687
- expect(binding('myForm.input.$valid')).toEqual('true');
15754
+ expect(valid.getText()).toContain('false');
15688
15755
  });
15689
- </doc:scenario>
15756
+ </doc:protractor>
15690
15757
  </doc:example>
15691
15758
  */
15692
15759
  'text': textInputType,
@@ -15740,24 +15807,30 @@ var inputType = {
15740
15807
  <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
15741
15808
  </form>
15742
15809
  </doc:source>
15743
- <doc:scenario>
15810
+ <doc:protractor>
15811
+ var value = element(by.binding('value'));
15812
+ var valid = element(by.binding('myForm.input.$valid'));
15813
+ var input = element(by.model('value'));
15814
+
15744
15815
  it('should initialize to model', function() {
15745
- expect(binding('value')).toEqual('12');
15746
- expect(binding('myForm.input.$valid')).toEqual('true');
15816
+ expect(value.getText()).toContain('12');
15817
+ expect(valid.getText()).toContain('true');
15747
15818
  });
15748
15819
 
15749
15820
  it('should be invalid if empty', function() {
15750
- input('value').enter('');
15751
- expect(binding('value')).toEqual('');
15752
- expect(binding('myForm.input.$valid')).toEqual('false');
15821
+ input.clear();
15822
+ input.sendKeys('');
15823
+ expect(value.getText()).toEqual('value =');
15824
+ expect(valid.getText()).toContain('false');
15753
15825
  });
15754
15826
 
15755
15827
  it('should be invalid if over max', function() {
15756
- input('value').enter('123');
15757
- expect(binding('value')).toEqual('');
15758
- expect(binding('myForm.input.$valid')).toEqual('false');
15828
+ input.clear();
15829
+ input.sendKeys('123');
15830
+ expect(value.getText()).toEqual('value =');
15831
+ expect(valid.getText()).toContain('false');
15759
15832
  });
15760
- </doc:scenario>
15833
+ </doc:protractor>
15761
15834
  </doc:example>
15762
15835
  */
15763
15836
  'number': numberInputType,
@@ -15809,23 +15882,31 @@ var inputType = {
15809
15882
  <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
15810
15883
  </form>
15811
15884
  </doc:source>
15812
- <doc:scenario>
15885
+ <doc:protractor>
15886
+ var text = element(by.binding('text'));
15887
+ var valid = element(by.binding('myForm.input.$valid'));
15888
+ var input = element(by.model('text'));
15889
+
15813
15890
  it('should initialize to model', function() {
15814
- expect(binding('text')).toEqual('http://google.com');
15815
- expect(binding('myForm.input.$valid')).toEqual('true');
15891
+ expect(text.getText()).toContain('http://google.com');
15892
+ expect(valid.getText()).toContain('true');
15816
15893
  });
15817
15894
 
15818
15895
  it('should be invalid if empty', function() {
15819
- input('text').enter('');
15820
- expect(binding('text')).toEqual('');
15821
- expect(binding('myForm.input.$valid')).toEqual('false');
15896
+ input.clear();
15897
+ input.sendKeys('');
15898
+
15899
+ expect(text.getText()).toEqual('text =');
15900
+ expect(valid.getText()).toContain('false');
15822
15901
  });
15823
15902
 
15824
15903
  it('should be invalid if not url', function() {
15825
- input('text').enter('xxx');
15826
- expect(binding('myForm.input.$valid')).toEqual('false');
15904
+ input.clear();
15905
+ input.sendKeys('box');
15906
+
15907
+ expect(valid.getText()).toContain('false');
15827
15908
  });
15828
- </doc:scenario>
15909
+ </doc:protractor>
15829
15910
  </doc:example>
15830
15911
  */
15831
15912
  'url': urlInputType,
@@ -15877,23 +15958,30 @@ var inputType = {
15877
15958
  <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
15878
15959
  </form>
15879
15960
  </doc:source>
15880
- <doc:scenario>
15961
+ <doc:protractor>
15962
+ var text = element(by.binding('text'));
15963
+ var valid = element(by.binding('myForm.input.$valid'));
15964
+ var input = element(by.model('text'));
15965
+
15881
15966
  it('should initialize to model', function() {
15882
- expect(binding('text')).toEqual('me@example.com');
15883
- expect(binding('myForm.input.$valid')).toEqual('true');
15967
+ expect(text.getText()).toContain('me@example.com');
15968
+ expect(valid.getText()).toContain('true');
15884
15969
  });
15885
15970
 
15886
15971
  it('should be invalid if empty', function() {
15887
- input('text').enter('');
15888
- expect(binding('text')).toEqual('');
15889
- expect(binding('myForm.input.$valid')).toEqual('false');
15972
+ input.clear();
15973
+ input.sendKeys('');
15974
+ expect(text.getText()).toEqual('text =');
15975
+ expect(valid.getText()).toContain('false');
15890
15976
  });
15891
15977
 
15892
15978
  it('should be invalid if not email', function() {
15893
- input('text').enter('xxx');
15894
- expect(binding('myForm.input.$valid')).toEqual('false');
15979
+ input.clear();
15980
+ input.sendKeys('xxx');
15981
+
15982
+ expect(valid.getText()).toContain('false');
15895
15983
  });
15896
- </doc:scenario>
15984
+ </doc:protractor>
15897
15985
  </doc:example>
15898
15986
  */
15899
15987
  'email': emailInputType,
@@ -15934,14 +16022,17 @@ var inputType = {
15934
16022
  </form>
15935
16023
  Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
15936
16024
  </doc:source>
15937
- <doc:scenario>
16025
+ <doc:protractor>
15938
16026
  it('should change state', function() {
15939
- expect(binding('color')).toEqual('"blue"');
16027
+ var color = element(by.binding('color'));
16028
+
16029
+ expect(color.getText()).toContain('blue');
15940
16030
 
15941
- input('color').select('red');
15942
- expect(binding('color')).toEqual('"red"');
16031
+ element.all(by.model('color')).get(0).click();
16032
+
16033
+ expect(color.getText()).toContain('red');
15943
16034
  });
15944
- </doc:scenario>
16035
+ </doc:protractor>
15945
16036
  </doc:example>
15946
16037
  */
15947
16038
  'radio': radioInputType,
@@ -15978,17 +16069,21 @@ var inputType = {
15978
16069
  <tt>value2 = {{value2}}</tt><br/>
15979
16070
  </form>
15980
16071
  </doc:source>
15981
- <doc:scenario>
16072
+ <doc:protractor>
15982
16073
  it('should change state', function() {
15983
- expect(binding('value1')).toEqual('true');
15984
- expect(binding('value2')).toEqual('YES');
16074
+ var value1 = element(by.binding('value1'));
16075
+ var value2 = element(by.binding('value2'));
16076
+
16077
+ expect(value1.getText()).toContain('true');
16078
+ expect(value2.getText()).toContain('YES');
16079
+
16080
+ element(by.model('value1')).click();
16081
+ element(by.model('value2')).click();
15985
16082
 
15986
- input('value1').check();
15987
- input('value2').check();
15988
- expect(binding('value1')).toEqual('false');
15989
- expect(binding('value2')).toEqual('NO');
16083
+ expect(value1.getText()).toContain('false');
16084
+ expect(value2.getText()).toContain('NO');
15990
16085
  });
15991
- </doc:scenario>
16086
+ </doc:protractor>
15992
16087
  </doc:example>
15993
16088
  */
15994
16089
  'checkbox': checkboxInputType,
@@ -16341,44 +16436,59 @@ function checkboxInputType(scope, element, attr, ctrl) {
16341
16436
  <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br>
16342
16437
  </div>
16343
16438
  </doc:source>
16344
- <doc:scenario>
16439
+ <doc:protractor>
16440
+ var user = element(by.binding('{{user}}'));
16441
+ var userNameValid = element(by.binding('myForm.userName.$valid'));
16442
+ var lastNameValid = element(by.binding('myForm.lastName.$valid'));
16443
+ var lastNameError = element(by.binding('myForm.lastName.$error'));
16444
+ var formValid = element(by.binding('myForm.$valid'));
16445
+ var userNameInput = element(by.model('user.name'));
16446
+ var userLastInput = element(by.model('user.last'));
16447
+
16345
16448
  it('should initialize to model', function() {
16346
- expect(binding('user')).toEqual('{"name":"guest","last":"visitor"}');
16347
- expect(binding('myForm.userName.$valid')).toEqual('true');
16348
- expect(binding('myForm.$valid')).toEqual('true');
16449
+ expect(user.getText()).toContain('{"name":"guest","last":"visitor"}');
16450
+ expect(userNameValid.getText()).toContain('true');
16451
+ expect(formValid.getText()).toContain('true');
16349
16452
  });
16350
16453
 
16351
16454
  it('should be invalid if empty when required', function() {
16352
- input('user.name').enter('');
16353
- expect(binding('user')).toEqual('{"last":"visitor"}');
16354
- expect(binding('myForm.userName.$valid')).toEqual('false');
16355
- expect(binding('myForm.$valid')).toEqual('false');
16455
+ userNameInput.clear();
16456
+ userNameInput.sendKeys('');
16457
+
16458
+ expect(user.getText()).toContain('{"last":"visitor"}');
16459
+ expect(userNameValid.getText()).toContain('false');
16460
+ expect(formValid.getText()).toContain('false');
16356
16461
  });
16357
16462
 
16358
16463
  it('should be valid if empty when min length is set', function() {
16359
- input('user.last').enter('');
16360
- expect(binding('user')).toEqual('{"name":"guest","last":""}');
16361
- expect(binding('myForm.lastName.$valid')).toEqual('true');
16362
- expect(binding('myForm.$valid')).toEqual('true');
16464
+ userLastInput.clear();
16465
+ userLastInput.sendKeys('');
16466
+
16467
+ expect(user.getText()).toContain('{"name":"guest","last":""}');
16468
+ expect(lastNameValid.getText()).toContain('true');
16469
+ expect(formValid.getText()).toContain('true');
16363
16470
  });
16364
16471
 
16365
16472
  it('should be invalid if less than required min length', function() {
16366
- input('user.last').enter('xx');
16367
- expect(binding('user')).toEqual('{"name":"guest"}');
16368
- expect(binding('myForm.lastName.$valid')).toEqual('false');
16369
- expect(binding('myForm.lastName.$error')).toMatch(/minlength/);
16370
- expect(binding('myForm.$valid')).toEqual('false');
16473
+ userLastInput.clear();
16474
+ userLastInput.sendKeys('xx');
16475
+
16476
+ expect(user.getText()).toContain('{"name":"guest"}');
16477
+ expect(lastNameValid.getText()).toContain('false');
16478
+ expect(lastNameError.getText()).toContain('minlength');
16479
+ expect(formValid.getText()).toContain('false');
16371
16480
  });
16372
16481
 
16373
16482
  it('should be invalid if longer than max length', function() {
16374
- input('user.last').enter('some ridiculously long name');
16375
- expect(binding('user'))
16376
- .toEqual('{"name":"guest"}');
16377
- expect(binding('myForm.lastName.$valid')).toEqual('false');
16378
- expect(binding('myForm.lastName.$error')).toMatch(/maxlength/);
16379
- expect(binding('myForm.$valid')).toEqual('false');
16483
+ userLastInput.clear();
16484
+ userLastInput.sendKeys('some ridiculously long name');
16485
+
16486
+ expect(user.getText()).toContain('{"name":"guest"}');
16487
+ expect(lastNameValid.getText()).toContain('false');
16488
+ expect(lastNameError.getText()).toContain('maxlength');
16489
+ expect(formValid.getText()).toContain('false');
16380
16490
  });
16381
- </doc:scenario>
16491
+ </doc:protractor>
16382
16492
  </doc:example>
16383
16493
  */
16384
16494
  var inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) {
@@ -16510,14 +16620,23 @@ var VALID_CLASS = 'ng-valid',
16510
16620
  <textarea ng-model="userContent"></textarea>
16511
16621
  </form>
16512
16622
  </file>
16513
- <file name="scenario.js">
16623
+ <file name="protractorTest.js">
16514
16624
  it('should data-bind and become invalid', function() {
16515
- var contentEditable = element('[contenteditable]');
16625
+ if (browser.params.browser = 'safari') {
16626
+ // SafariDriver can't handle contenteditable.
16627
+ return;
16628
+ };
16629
+ var contentEditable = element(by.css('.doc-example-live [contenteditable]'));
16516
16630
 
16517
- expect(contentEditable.text()).toEqual('Change me!');
16518
- input('userContent').enter('');
16519
- expect(contentEditable.text()).toEqual('');
16520
- expect(contentEditable.prop('className')).toMatch(/ng-invalid-required/);
16631
+ expect(contentEditable.getText()).toEqual('Change me!');
16632
+
16633
+ // Firefox driver doesn't trigger the proper events on 'clear', so do this hack
16634
+ contentEditable.click();
16635
+ contentEditable.sendKeys(protractor.Key.chord(protractor.Key.COMMAND, "a"));
16636
+ contentEditable.sendKeys(protractor.Key.BACK_SPACE);
16637
+
16638
+ expect(contentEditable.getText()).toEqual('');
16639
+ expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);
16521
16640
  });
16522
16641
  </file>
16523
16642
  * </example>
@@ -16824,24 +16943,30 @@ var ngModelDirective = function() {
16824
16943
  * <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
16825
16944
  * <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
16826
16945
  * <label for="ng-change-example2">Confirmed</label><br />
16827
- * debug = {{confirmed}}<br />
16828
- * counter = {{counter}}
16946
+ * <tt>debug = {{confirmed}}</tt><br/>
16947
+ * <tt>counter = {{counter}}</tt><br/>
16829
16948
  * </div>
16830
16949
  * </doc:source>
16831
- * <doc:scenario>
16950
+ * <doc:protractor>
16951
+ * var counter = element(by.binding('counter'));
16952
+ * var debug = element(by.binding('confirmed'));
16953
+ *
16832
16954
  * it('should evaluate the expression if changing from view', function() {
16833
- * expect(binding('counter')).toEqual('0');
16834
- * element('#ng-change-example1').click();
16835
- * expect(binding('counter')).toEqual('1');
16836
- * expect(binding('confirmed')).toEqual('true');
16955
+ * expect(counter.getText()).toContain('0');
16956
+ *
16957
+ * element(by.id('ng-change-example1')).click();
16958
+ *
16959
+ * expect(counter.getText()).toContain('1');
16960
+ * expect(debug.getText()).toContain('true');
16837
16961
  * });
16838
16962
  *
16839
16963
  * it('should not evaluate the expression if changing from model', function() {
16840
- * element('#ng-change-example2').click();
16841
- * expect(binding('counter')).toEqual('0');
16842
- * expect(binding('confirmed')).toEqual('true');
16964
+ * element(by.id('ng-change-example2')).click();
16965
+
16966
+ * expect(counter.getText()).toContain('0');
16967
+ * expect(debug.getText()).toContain('true');
16843
16968
  * });
16844
- * </doc:scenario>
16969
+ * </doc:protractor>
16845
16970
  * </doc:example>
16846
16971
  */
16847
16972
  var ngChangeDirective = valueFn({
@@ -16914,20 +17039,26 @@ var requiredDirective = function() {
16914
17039
  <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
16915
17040
  </form>
16916
17041
  </doc:source>
16917
- <doc:scenario>
17042
+ <doc:protractor>
17043
+ var listInput = element(by.model('names'));
17044
+ var names = element(by.binding('{{names}}'));
17045
+ var valid = element(by.binding('myForm.namesInput.$valid'));
17046
+ var error = element(by.css('span.error'));
17047
+
16918
17048
  it('should initialize to model', function() {
16919
- expect(binding('names')).toEqual('["igor","misko","vojta"]');
16920
- expect(binding('myForm.namesInput.$valid')).toEqual('true');
16921
- expect(element('span.error').css('display')).toBe('none');
17049
+ expect(names.getText()).toContain('["igor","misko","vojta"]');
17050
+ expect(valid.getText()).toContain('true');
17051
+ expect(error.getCssValue('display')).toBe('none');
16922
17052
  });
16923
17053
 
16924
17054
  it('should be invalid if empty', function() {
16925
- input('names').enter('');
16926
- expect(binding('names')).toEqual('');
16927
- expect(binding('myForm.namesInput.$valid')).toEqual('false');
16928
- expect(element('span.error').css('display')).not().toBe('none');
16929
- });
16930
- </doc:scenario>
17055
+ listInput.clear();
17056
+ listInput.sendKeys('');
17057
+
17058
+ expect(names.getText()).toContain('');
17059
+ expect(valid.getText()).toContain('false');
17060
+ expect(error.getCssValue('display')).not.toBe('none'); });
17061
+ </doc:protractor>
16931
17062
  </doc:example>
16932
17063
  */
16933
17064
  var ngListDirective = function() {
@@ -17009,15 +17140,17 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
17009
17140
  <div>You chose {{my.favorite}}</div>
17010
17141
  </form>
17011
17142
  </doc:source>
17012
- <doc:scenario>
17143
+ <doc:protractor>
17144
+ var favorite = element(by.binding('my.favorite'));
17145
+
17013
17146
  it('should initialize to model', function() {
17014
- expect(binding('my.favorite')).toEqual('unicorns');
17147
+ expect(favorite.getText()).toContain('unicorns');
17015
17148
  });
17016
17149
  it('should bind the values to the inputs', function() {
17017
- input('my.favorite').select('pizza');
17018
- expect(binding('my.favorite')).toEqual('pizza');
17150
+ element.all(by.model('my.favorite')).get(0).click();
17151
+ expect(favorite.getText()).toContain('pizza');
17019
17152
  });
17020
- </doc:scenario>
17153
+ </doc:protractor>
17021
17154
  </doc:example>
17022
17155
  */
17023
17156
  var ngValueDirective = function() {
@@ -17077,13 +17210,17 @@ var ngValueDirective = function() {
17077
17210
  Hello <span ng-bind="name"></span>!
17078
17211
  </div>
17079
17212
  </doc:source>
17080
- <doc:scenario>
17213
+ <doc:protractor>
17081
17214
  it('should check ng-bind', function() {
17082
- expect(using('.doc-example-live').binding('name')).toBe('Whirled');
17083
- using('.doc-example-live').input('name').enter('world');
17084
- expect(using('.doc-example-live').binding('name')).toBe('world');
17215
+ var exampleContainer = $('.doc-example-live');
17216
+ var nameInput = element(by.model('name'));
17217
+
17218
+ expect(exampleContainer.findElement(by.binding('name')).getText()).toBe('Whirled');
17219
+ nameInput.clear();
17220
+ nameInput.sendKeys('world');
17221
+ expect(exampleContainer.findElement(by.binding('name')).getText()).toBe('world');
17085
17222
  });
17086
- </doc:scenario>
17223
+ </doc:protractor>
17087
17224
  </doc:example>
17088
17225
  */
17089
17226
  var ngBindDirective = ngDirective(function(scope, element, attr) {
@@ -17129,20 +17266,22 @@ var ngBindDirective = ngDirective(function(scope, element, attr) {
17129
17266
  <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
17130
17267
  </div>
17131
17268
  </doc:source>
17132
- <doc:scenario>
17269
+ <doc:protractor>
17133
17270
  it('should check ng-bind', function() {
17134
- expect(using('.doc-example-live').binding('salutation')).
17135
- toBe('Hello');
17136
- expect(using('.doc-example-live').binding('name')).
17137
- toBe('World');
17138
- using('.doc-example-live').input('salutation').enter('Greetings');
17139
- using('.doc-example-live').input('name').enter('user');
17140
- expect(using('.doc-example-live').binding('salutation')).
17141
- toBe('Greetings');
17142
- expect(using('.doc-example-live').binding('name')).
17143
- toBe('user');
17271
+ var salutationElem = element(by.binding('salutation'));
17272
+ var salutationInput = element(by.model('salutation'));
17273
+ var nameInput = element(by.model('name'));
17274
+
17275
+ expect(salutationElem.getText()).toBe('Hello World!');
17276
+
17277
+ salutationInput.clear();
17278
+ salutationInput.sendKeys('Greetings');
17279
+ nameInput.clear();
17280
+ nameInput.sendKeys('user');
17281
+
17282
+ expect(salutationElem.getText()).toBe('Greetings user!');
17144
17283
  });
17145
- </doc:scenario>
17284
+ </doc:protractor>
17146
17285
  </doc:example>
17147
17286
  */
17148
17287
  var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
@@ -17195,12 +17334,10 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
17195
17334
  }]);
17196
17335
  </file>
17197
17336
 
17198
- <file name="scenario.js">
17337
+ <file name="protractorTest.js">
17199
17338
  it('should check ng-bind-html', function() {
17200
- expect(using('.doc-example-live').binding('myHTML')).
17201
- toBe(
17202
- 'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>'
17203
- );
17339
+ expect(element(by.binding('myHTML')).getText()).toBe(
17340
+ 'I am an HTMLstring with links! and other stuff');
17204
17341
  });
17205
17342
  </file>
17206
17343
  </example>
@@ -17332,31 +17469,34 @@ function classDirective(name, selector) {
17332
17469
  color: red;
17333
17470
  }
17334
17471
  </file>
17335
- <file name="scenario.js">
17472
+ <file name="protractorTest.js">
17473
+ var ps = element.all(by.css('.doc-example-live p'));
17474
+
17336
17475
  it('should let you toggle the class', function() {
17337
17476
 
17338
- expect(element('.doc-example-live p:first').prop('className')).not().toMatch(/bold/);
17339
- expect(element('.doc-example-live p:first').prop('className')).not().toMatch(/red/);
17477
+ expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
17478
+ expect(ps.first().getAttribute('class')).not.toMatch(/red/);
17340
17479
 
17341
- input('important').check();
17342
- expect(element('.doc-example-live p:first').prop('className')).toMatch(/bold/);
17480
+ element(by.model('important')).click();
17481
+ expect(ps.first().getAttribute('class')).toMatch(/bold/);
17343
17482
 
17344
- input('error').check();
17345
- expect(element('.doc-example-live p:first').prop('className')).toMatch(/red/);
17483
+ element(by.model('error')).click();
17484
+ expect(ps.first().getAttribute('class')).toMatch(/red/);
17346
17485
  });
17347
17486
 
17348
17487
  it('should let you toggle string example', function() {
17349
- expect(element('.doc-example-live p:nth-of-type(2)').prop('className')).toBe('');
17350
- input('style').enter('red');
17351
- expect(element('.doc-example-live p:nth-of-type(2)').prop('className')).toBe('red');
17488
+ expect(ps.get(1).getAttribute('class')).toBe('');
17489
+ element(by.model('style')).clear();
17490
+ element(by.model('style')).sendKeys('red');
17491
+ expect(ps.get(1).getAttribute('class')).toBe('red');
17352
17492
  });
17353
17493
 
17354
17494
  it('array example should have 3 classes', function() {
17355
- expect(element('.doc-example-live p:last').prop('className')).toBe('');
17356
- input('style1').enter('bold');
17357
- input('style2').enter('strike');
17358
- input('style3').enter('red');
17359
- expect(element('.doc-example-live p:last').prop('className')).toBe('bold strike red');
17495
+ expect(ps.last().getAttribute('class')).toBe('');
17496
+ element(by.model('style1')).sendKeys('bold');
17497
+ element(by.model('style2')).sendKeys('strike');
17498
+ element(by.model('style3')).sendKeys('red');
17499
+ expect(ps.last().getAttribute('class')).toBe('bold strike red');
17360
17500
  });
17361
17501
  </file>
17362
17502
  </example>
@@ -17367,8 +17507,8 @@ function classDirective(name, selector) {
17367
17507
 
17368
17508
  <example animations="true">
17369
17509
  <file name="index.html">
17370
- <input type="button" value="set" ng-click="myVar='my-class'">
17371
- <input type="button" value="clear" ng-click="myVar=''">
17510
+ <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'">
17511
+ <input id="clearbtn" type="button" value="clear" ng-click="myVar=''">
17372
17512
  <br>
17373
17513
  <span class="base-class" ng-class="myVar">Sample Text</span>
17374
17514
  </file>
@@ -17383,19 +17523,19 @@ function classDirective(name, selector) {
17383
17523
  font-size:3em;
17384
17524
  }
17385
17525
  </file>
17386
- <file name="scenario.js">
17526
+ <file name="protractorTest.js">
17387
17527
  it('should check ng-class', function() {
17388
- expect(element('.doc-example-live span').prop('className')).not().
17528
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
17389
17529
  toMatch(/my-class/);
17390
17530
 
17391
- using('.doc-example-live').element(':button:first').click();
17531
+ element(by.id('setbtn')).click();
17392
17532
 
17393
- expect(element('.doc-example-live span').prop('className')).
17533
+ expect(element(by.css('.base-class')).getAttribute('class')).
17394
17534
  toMatch(/my-class/);
17395
17535
 
17396
- using('.doc-example-live').element(':button:last').click();
17536
+ element(by.id('clearbtn')).click();
17397
17537
 
17398
- expect(element('.doc-example-live span').prop('className')).not().
17538
+ expect(element(by.css('.base-class')).getAttribute('class')).not.
17399
17539
  toMatch(/my-class/);
17400
17540
  });
17401
17541
  </file>
@@ -17447,11 +17587,11 @@ var ngClassDirective = classDirective('', true);
17447
17587
  color: blue;
17448
17588
  }
17449
17589
  </file>
17450
- <file name="scenario.js">
17590
+ <file name="protractorTest.js">
17451
17591
  it('should check ng-class-odd and ng-class-even', function() {
17452
- expect(element('.doc-example-live li:first span').prop('className')).
17592
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
17453
17593
  toMatch(/odd/);
17454
- expect(element('.doc-example-live li:last span').prop('className')).
17594
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
17455
17595
  toMatch(/even/);
17456
17596
  });
17457
17597
  </file>
@@ -17495,11 +17635,11 @@ var ngClassOddDirective = classDirective('Odd', 0);
17495
17635
  color: blue;
17496
17636
  }
17497
17637
  </file>
17498
- <file name="scenario.js">
17638
+ <file name="protractorTest.js">
17499
17639
  it('should check ng-class-odd and ng-class-even', function() {
17500
- expect(element('.doc-example-live li:first span').prop('className')).
17640
+ expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
17501
17641
  toMatch(/odd/);
17502
- expect(element('.doc-example-live li:last span').prop('className')).
17642
+ expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
17503
17643
  toMatch(/even/);
17504
17644
  });
17505
17645
  </file>
@@ -17552,14 +17692,14 @@ var ngClassEvenDirective = classDirective('Even', 1);
17552
17692
  <div id="template1" ng-cloak>{{ 'hello' }}</div>
17553
17693
  <div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>
17554
17694
  </doc:source>
17555
- <doc:scenario>
17695
+ <doc:protractor>
17556
17696
  it('should remove the template directive and css class', function() {
17557
- expect(element('.doc-example-live #template1').attr('ng-cloak')).
17558
- not().toBeDefined();
17559
- expect(element('.doc-example-live #template2').attr('ng-cloak')).
17560
- not().toBeDefined();
17697
+ expect($('.doc-example-live #template1').getAttribute('ng-cloak')).
17698
+ toBeNull();
17699
+ expect($('.doc-example-live #template2').getAttribute('ng-cloak')).
17700
+ toBeNull();
17561
17701
  });
17562
- </doc:scenario>
17702
+ </doc:protractor>
17563
17703
  </doc:example>
17564
17704
  *
17565
17705
  */
@@ -17652,22 +17792,36 @@ var ngCloakDirective = ngDirective({
17652
17792
  </ul>
17653
17793
  </div>
17654
17794
  </doc:source>
17655
- <doc:scenario>
17795
+ <doc:protractor>
17656
17796
  it('should check controller as', function() {
17657
- expect(element('#ctrl-as-exmpl>:input').val()).toBe('John Smith');
17658
- expect(element('#ctrl-as-exmpl li:nth-child(1) input').val())
17659
- .toBe('408 555 1212');
17660
- expect(element('#ctrl-as-exmpl li:nth-child(2) input').val())
17661
- .toBe('john.smith@example.org');
17662
-
17663
- element('#ctrl-as-exmpl li:first a:contains("clear")').click();
17664
- expect(element('#ctrl-as-exmpl li:first input').val()).toBe('');
17665
-
17666
- element('#ctrl-as-exmpl li:last a:contains("add")').click();
17667
- expect(element('#ctrl-as-exmpl li:nth-child(3) input').val())
17668
- .toBe('yourname@example.org');
17797
+ var container = element(by.id('ctrl-as-exmpl'));
17798
+
17799
+ expect(container.findElement(by.model('settings.name'))
17800
+ .getAttribute('value')).toBe('John Smith');
17801
+
17802
+ var firstRepeat =
17803
+ container.findElement(by.repeater('contact in settings.contacts').row(0));
17804
+ var secondRepeat =
17805
+ container.findElement(by.repeater('contact in settings.contacts').row(1));
17806
+
17807
+ expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
17808
+ .toBe('408 555 1212');
17809
+ expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
17810
+ .toBe('john.smith@example.org');
17811
+
17812
+ firstRepeat.findElement(by.linkText('clear')).click()
17813
+
17814
+ expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
17815
+ .toBe('');
17816
+
17817
+ container.findElement(by.linkText('add')).click();
17818
+
17819
+ expect(container.findElement(by.repeater('contact in settings.contacts').row(2))
17820
+ .findElement(by.model('contact.value'))
17821
+ .getAttribute('value'))
17822
+ .toBe('yourname@example.org');
17669
17823
  });
17670
- </doc:scenario>
17824
+ </doc:protractor>
17671
17825
  </doc:example>
17672
17826
  <doc:example>
17673
17827
  <doc:source>
@@ -17715,22 +17869,36 @@ var ngCloakDirective = ngDirective({
17715
17869
  </ul>
17716
17870
  </div>
17717
17871
  </doc:source>
17718
- <doc:scenario>
17872
+ <doc:protractor>
17719
17873
  it('should check controller', function() {
17720
- expect(element('#ctrl-exmpl>:input').val()).toBe('John Smith');
17721
- expect(element('#ctrl-exmpl li:nth-child(1) input').val())
17722
- .toBe('408 555 1212');
17723
- expect(element('#ctrl-exmpl li:nth-child(2) input').val())
17724
- .toBe('john.smith@example.org');
17725
-
17726
- element('#ctrl-exmpl li:first a:contains("clear")').click();
17727
- expect(element('#ctrl-exmpl li:first input').val()).toBe('');
17728
-
17729
- element('#ctrl-exmpl li:last a:contains("add")').click();
17730
- expect(element('#ctrl-exmpl li:nth-child(3) input').val())
17731
- .toBe('yourname@example.org');
17874
+ var container = element(by.id('ctrl-exmpl'));
17875
+
17876
+ expect(container.findElement(by.model('name'))
17877
+ .getAttribute('value')).toBe('John Smith');
17878
+
17879
+ var firstRepeat =
17880
+ container.findElement(by.repeater('contact in contacts').row(0));
17881
+ var secondRepeat =
17882
+ container.findElement(by.repeater('contact in contacts').row(1));
17883
+
17884
+ expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
17885
+ .toBe('408 555 1212');
17886
+ expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
17887
+ .toBe('john.smith@example.org');
17888
+
17889
+ firstRepeat.findElement(by.linkText('clear')).click()
17890
+
17891
+ expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
17892
+ .toBe('');
17893
+
17894
+ container.findElement(by.linkText('add')).click();
17895
+
17896
+ expect(container.findElement(by.repeater('contact in contacts').row(2))
17897
+ .findElement(by.model('contact.value'))
17898
+ .getAttribute('value'))
17899
+ .toBe('yourname@example.org');
17732
17900
  });
17733
- </doc:scenario>
17901
+ </doc:protractor>
17734
17902
  </doc:example>
17735
17903
 
17736
17904
  */
@@ -18111,20 +18279,20 @@ forEach(
18111
18279
  <pre>list={{list}}</pre>
18112
18280
  </form>
18113
18281
  </doc:source>
18114
- <doc:scenario>
18282
+ <doc:protractor>
18115
18283
  it('should check ng-submit', function() {
18116
- expect(binding('list')).toBe('[]');
18117
- element('.doc-example-live #submit').click();
18118
- expect(binding('list')).toBe('["hello"]');
18119
- expect(input('text').val()).toBe('');
18284
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
18285
+ element(by.css('.doc-example-live #submit')).click();
18286
+ expect(element(by.binding('list')).getText()).toContain('hello');
18287
+ expect(element(by.input('text')).getAttribute('value')).toBe('');
18120
18288
  });
18121
18289
  it('should ignore empty strings', function() {
18122
- expect(binding('list')).toBe('[]');
18123
- element('.doc-example-live #submit').click();
18124
- element('.doc-example-live #submit').click();
18125
- expect(binding('list')).toBe('["hello"]');
18126
- });
18127
- </doc:scenario>
18290
+ expect(element(by.binding('list')).getText()).toBe('list=[]');
18291
+ element(by.css('.doc-example-live #submit')).click();
18292
+ element(by.css('.doc-example-live #submit')).click();
18293
+ expect(element(by.binding('list')).getText()).toContain('hello');
18294
+ });
18295
+ </doc:protractor>
18128
18296
  </doc:example>
18129
18297
  */
18130
18298
 
@@ -18451,19 +18619,33 @@ var ngIfDirective = ['$animate', function($animate) {
18451
18619
  top:50px;
18452
18620
  }
18453
18621
  </file>
18454
- <file name="scenario.js">
18622
+ <file name="protractorTest.js">
18623
+ var templateSelect = element(by.model('template'));
18624
+ var includeElem = element(by.css('.doc-example-live [ng-include]'));
18625
+
18455
18626
  it('should load template1.html', function() {
18456
- expect(element('.doc-example-live [ng-include]').text()).
18457
- toMatch(/Content of template1.html/);
18627
+ expect(includeElem.getText()).toMatch(/Content of template1.html/);
18458
18628
  });
18629
+
18459
18630
  it('should load template2.html', function() {
18460
- select('template').option('1');
18461
- expect(element('.doc-example-live [ng-include]').text()).
18462
- toMatch(/Content of template2.html/);
18631
+ if (browser.params.browser == 'firefox') {
18632
+ // Firefox can't handle using selects
18633
+ // See https://github.com/angular/protractor/issues/480
18634
+ return;
18635
+ }
18636
+ templateSelect.click();
18637
+ templateSelect.element.all(by.css('option')).get(2).click();
18638
+ expect(includeElem.getText()).toMatch(/Content of template2.html/);
18463
18639
  });
18640
+
18464
18641
  it('should change to blank', function() {
18465
- select('template').option('');
18466
- expect(element('.doc-example-live [ng-include]')).toBe(undefined);
18642
+ if (browser.params.browser == 'firefox') {
18643
+ // Firefox can't handle using selects
18644
+ return;
18645
+ }
18646
+ templateSelect.click();
18647
+ templateSelect.element.all(by.css('option')).get(0).click();
18648
+ expect(includeElem.isPresent()).toBe(false);
18467
18649
  });
18468
18650
  </file>
18469
18651
  </example>
@@ -18623,15 +18805,15 @@ var ngIncludeFillContentDirective = ['$compile',
18623
18805
  </div>
18624
18806
  </div>
18625
18807
  </doc:source>
18626
- <doc:scenario>
18808
+ <doc:protractor>
18627
18809
  it('should alias index positions', function() {
18628
- expect(element('.example-init').text())
18629
- .toBe('list[ 0 ][ 0 ] = a;' +
18630
- 'list[ 0 ][ 1 ] = b;' +
18631
- 'list[ 1 ][ 0 ] = c;' +
18632
- 'list[ 1 ][ 1 ] = d;');
18810
+ var elements = element.all(by.css('.example-init'));
18811
+ expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');
18812
+ expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');
18813
+ expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');
18814
+ expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');
18633
18815
  });
18634
- </doc:scenario>
18816
+ </doc:protractor>
18635
18817
  </doc:example>
18636
18818
  */
18637
18819
  var ngInitDirective = ngDirective({
@@ -18669,13 +18851,12 @@ var ngInitDirective = ngDirective({
18669
18851
  <div>Normal: {{1 + 2}}</div>
18670
18852
  <div ng-non-bindable>Ignored: {{1 + 2}}</div>
18671
18853
  </doc:source>
18672
- <doc:scenario>
18854
+ <doc:protractor>
18673
18855
  it('should check ng-non-bindable', function() {
18674
- expect(using('.doc-example-live').binding('1 + 2')).toBe('3');
18675
- expect(using('.doc-example-live').element('div:last').text()).
18676
- toMatch(/1 \+ 2/);
18856
+ expect(element(by.binding('1 + 2')).getText()).toContain('3');
18857
+ expect(element.all(by.css('.doc-example-live div')).last().getText()).toMatch(/1 \+ 2/);
18677
18858
  });
18678
- </doc:scenario>
18859
+ </doc:protractor>
18679
18860
  </doc:example>
18680
18861
  */
18681
18862
  var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
@@ -18803,49 +18984,53 @@ var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
18803
18984
  </ng-pluralize>
18804
18985
  </div>
18805
18986
  </doc:source>
18806
- <doc:scenario>
18987
+ <doc:protractor>
18807
18988
  it('should show correct pluralized string', function() {
18808
- expect(element('.doc-example-live ng-pluralize:first').text()).
18809
- toBe('1 person is viewing.');
18810
- expect(element('.doc-example-live ng-pluralize:last').text()).
18811
- toBe('Igor is viewing.');
18812
-
18813
- using('.doc-example-live').input('personCount').enter('0');
18814
- expect(element('.doc-example-live ng-pluralize:first').text()).
18815
- toBe('Nobody is viewing.');
18816
- expect(element('.doc-example-live ng-pluralize:last').text()).
18817
- toBe('Nobody is viewing.');
18818
-
18819
- using('.doc-example-live').input('personCount').enter('2');
18820
- expect(element('.doc-example-live ng-pluralize:first').text()).
18821
- toBe('2 people are viewing.');
18822
- expect(element('.doc-example-live ng-pluralize:last').text()).
18823
- toBe('Igor and Misko are viewing.');
18824
-
18825
- using('.doc-example-live').input('personCount').enter('3');
18826
- expect(element('.doc-example-live ng-pluralize:first').text()).
18827
- toBe('3 people are viewing.');
18828
- expect(element('.doc-example-live ng-pluralize:last').text()).
18829
- toBe('Igor, Misko and one other person are viewing.');
18830
-
18831
- using('.doc-example-live').input('personCount').enter('4');
18832
- expect(element('.doc-example-live ng-pluralize:first').text()).
18833
- toBe('4 people are viewing.');
18834
- expect(element('.doc-example-live ng-pluralize:last').text()).
18835
- toBe('Igor, Misko and 2 other people are viewing.');
18836
- });
18989
+ var withoutOffset = element.all(by.css('ng-pluralize')).get(0);
18990
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
18991
+ var countInput = element(by.model('personCount'));
18992
+
18993
+ expect(withoutOffset.getText()).toEqual('1 person is viewing.');
18994
+ expect(withOffset.getText()).toEqual('Igor is viewing.');
18995
+
18996
+ countInput.clear();
18997
+ countInput.sendKeys('0');
18837
18998
 
18838
- it('should show data-binded names', function() {
18839
- using('.doc-example-live').input('personCount').enter('4');
18840
- expect(element('.doc-example-live ng-pluralize:last').text()).
18841
- toBe('Igor, Misko and 2 other people are viewing.');
18999
+ expect(withoutOffset.getText()).toEqual('Nobody is viewing.');
19000
+ expect(withOffset.getText()).toEqual('Nobody is viewing.');
18842
19001
 
18843
- using('.doc-example-live').input('person1').enter('Di');
18844
- using('.doc-example-live').input('person2').enter('Vojta');
18845
- expect(element('.doc-example-live ng-pluralize:last').text()).
18846
- toBe('Di, Vojta and 2 other people are viewing.');
19002
+ countInput.clear();
19003
+ countInput.sendKeys('2');
19004
+
19005
+ expect(withoutOffset.getText()).toEqual('2 people are viewing.');
19006
+ expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');
19007
+
19008
+ countInput.clear();
19009
+ countInput.sendKeys('3');
19010
+
19011
+ expect(withoutOffset.getText()).toEqual('3 people are viewing.');
19012
+ expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');
19013
+
19014
+ countInput.clear();
19015
+ countInput.sendKeys('4');
19016
+
19017
+ expect(withoutOffset.getText()).toEqual('4 people are viewing.');
19018
+ expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');
18847
19019
  });
18848
- </doc:scenario>
19020
+ it('should show data-bound names', function() {
19021
+ var withOffset = element.all(by.css('ng-pluralize')).get(1);
19022
+ var personCount = element(by.model('personCount'));
19023
+ var person1 = element(by.model('person1'));
19024
+ var person2 = element(by.model('person2'));
19025
+ personCount.clear();
19026
+ personCount.sendKeys('4');
19027
+ person1.clear();
19028
+ person1.sendKeys('Di');
19029
+ person2.clear();
19030
+ person2.sendKeys('Vojta');
19031
+ expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');
19032
+ });
19033
+ </doc:protractor>
18849
19034
  </doc:example>
18850
19035
  */
18851
19036
  var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) {
@@ -19064,25 +19249,27 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp
19064
19249
  max-height:40px;
19065
19250
  }
19066
19251
  </file>
19067
- <file name="scenario.js">
19068
- it('should render initial data set', function() {
19069
- var r = using('.doc-example-live').repeater('ul li');
19070
- expect(r.count()).toBe(10);
19071
- expect(r.row(0)).toEqual(["1","John","25"]);
19072
- expect(r.row(1)).toEqual(["2","Jessie","30"]);
19073
- expect(r.row(9)).toEqual(["10","Samantha","60"]);
19074
- expect(binding('friends.length')).toBe("10");
19075
- });
19252
+ <file name="protractorTest.js">
19253
+ var friends = element(by.css('.doc-example-live'))
19254
+ .element.all(by.repeater('friend in friends'));
19255
+
19256
+ it('should render initial data set', function() {
19257
+ expect(friends.count()).toBe(10);
19258
+ expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');
19259
+ expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');
19260
+ expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');
19261
+ expect(element(by.binding('friends.length')).getText())
19262
+ .toMatch("I have 10 friends. They are:");
19263
+ });
19076
19264
 
19077
19265
  it('should update repeater when filter predicate changes', function() {
19078
- var r = using('.doc-example-live').repeater('ul li');
19079
- expect(r.count()).toBe(10);
19266
+ expect(friends.count()).toBe(10);
19080
19267
 
19081
- input('q').enter('ma');
19268
+ element(by.css('.doc-example-live')).element(by.model('q')).sendKeys('ma');
19082
19269
 
19083
- expect(r.count()).toBe(2);
19084
- expect(r.row(0)).toEqual(["1","Mary","28"]);
19085
- expect(r.row(1)).toEqual(["2","Samantha","60"]);
19270
+ expect(friends.count()).toBe(2);
19271
+ expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');
19272
+ expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');
19086
19273
  });
19087
19274
  </file>
19088
19275
  </example>
@@ -19416,16 +19603,19 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
19416
19603
  background:white;
19417
19604
  }
19418
19605
  </file>
19419
- <file name="scenario.js">
19420
- it('should check ng-show / ng-hide', function() {
19421
- expect(element('.doc-example-live span:first:hidden').count()).toEqual(1);
19422
- expect(element('.doc-example-live span:last:visible').count()).toEqual(1);
19606
+ <file name="protractorTest.js">
19607
+ var thumbsUp = element(by.css('.doc-example-live span.icon-thumbs-up'));
19608
+ var thumbsDown = element(by.css('.doc-example-live span.icon-thumbs-down'));
19423
19609
 
19424
- input('checked').check();
19610
+ it('should check ng-show / ng-hide', function() {
19611
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
19612
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
19425
19613
 
19426
- expect(element('.doc-example-live span:first:visible').count()).toEqual(1);
19427
- expect(element('.doc-example-live span:last:hidden').count()).toEqual(1);
19428
- });
19614
+ element(by.model('checked')).click();
19615
+
19616
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
19617
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
19618
+ });
19429
19619
  </file>
19430
19620
  </example>
19431
19621
  */
@@ -19570,16 +19760,19 @@ var ngShowDirective = ['$animate', function($animate) {
19570
19760
  background:white;
19571
19761
  }
19572
19762
  </file>
19573
- <file name="scenario.js">
19574
- it('should check ng-show / ng-hide', function() {
19575
- expect(element('.doc-example-live .check-element:first:hidden').count()).toEqual(1);
19576
- expect(element('.doc-example-live .check-element:last:visible').count()).toEqual(1);
19763
+ <file name="protractorTest.js">
19764
+ var thumbsUp = element(by.css('.doc-example-live span.icon-thumbs-up'));
19765
+ var thumbsDown = element(by.css('.doc-example-live span.icon-thumbs-down'));
19577
19766
 
19578
- input('checked').check();
19767
+ it('should check ng-show / ng-hide', function() {
19768
+ expect(thumbsUp.isDisplayed()).toBeFalsy();
19769
+ expect(thumbsDown.isDisplayed()).toBeTruthy();
19579
19770
 
19580
- expect(element('.doc-example-live .check-element:first:visible').count()).toEqual(1);
19581
- expect(element('.doc-example-live .check-element:last:hidden').count()).toEqual(1);
19582
- });
19771
+ element(by.model('checked')).click();
19772
+
19773
+ expect(thumbsUp.isDisplayed()).toBeTruthy();
19774
+ expect(thumbsDown.isDisplayed()).toBeFalsy();
19775
+ });
19583
19776
  </file>
19584
19777
  </example>
19585
19778
  */
@@ -19618,13 +19811,15 @@ var ngHideDirective = ['$animate', function($animate) {
19618
19811
  color: black;
19619
19812
  }
19620
19813
  </file>
19621
- <file name="scenario.js">
19814
+ <file name="protractorTest.js">
19815
+ var colorSpan = element(by.css('.doc-example-live span'));
19816
+
19622
19817
  it('should check ng-style', function() {
19623
- expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)');
19624
- element('.doc-example-live :button[value=set]').click();
19625
- expect(element('.doc-example-live span').css('color')).toBe('rgb(255, 0, 0)');
19626
- element('.doc-example-live :button[value=clear]').click();
19627
- expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)');
19818
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
19819
+ element(by.css('.doc-example-live input[value=set]')).click();
19820
+ expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
19821
+ element(by.css('.doc-example-live input[value=clear]')).click();
19822
+ expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
19628
19823
  });
19629
19824
  </file>
19630
19825
  </example>
@@ -19649,7 +19844,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
19649
19844
  * as specified in the template.
19650
19845
  *
19651
19846
  * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
19652
- * from the template cache), `ngSwitch` simply choses one of the nested elements and makes it visible based on which element
19847
+ * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
19653
19848
  * matches the value obtained from the evaluated expression. In other words, you define a container element
19654
19849
  * (where you place the directive), place an expression on the **`on="..."` attribute**
19655
19850
  * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
@@ -19745,17 +19940,20 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
19745
19940
  top:0;
19746
19941
  }
19747
19942
  </file>
19748
- <file name="scenario.js">
19943
+ <file name="protractorTest.js">
19944
+ var switchElem = element(by.css('.doc-example-live [ng-switch]'));
19945
+ var select = element(by.model('selection'));
19946
+
19749
19947
  it('should start in settings', function() {
19750
- expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Settings Div/);
19948
+ expect(switchElem.getText()).toMatch(/Settings Div/);
19751
19949
  });
19752
19950
  it('should change to home', function() {
19753
- select('selection').option('home');
19754
- expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Home Span/);
19951
+ select.element.all(by.css('option')).get(1).click();
19952
+ expect(switchElem.getText()).toMatch(/Home Span/);
19755
19953
  });
19756
19954
  it('should select default', function() {
19757
- select('selection').option('other');
19758
- expect(element('.doc-example-live [ng-switch]').text()).toMatch(/default/);
19955
+ select.element.all(by.css('option')).get(2).click();
19956
+ expect(switchElem.getText()).toMatch(/default/);
19759
19957
  });
19760
19958
  </file>
19761
19959
  </example>
@@ -19862,14 +20060,18 @@ var ngSwitchDefaultDirective = ngDirective({
19862
20060
  <pane title="{{title}}">{{text}}</pane>
19863
20061
  </div>
19864
20062
  </doc:source>
19865
- <doc:scenario>
20063
+ <doc:protractor>
19866
20064
  it('should have transcluded', function() {
19867
- input('title').enter('TITLE');
19868
- input('text').enter('TEXT');
19869
- expect(binding('title')).toEqual('TITLE');
19870
- expect(binding('text')).toEqual('TEXT');
20065
+ var titleElement = element(by.model('title'));
20066
+ titleElement.clear();
20067
+ titleElement.sendKeys('TITLE');
20068
+ var textElement = element(by.model('text'));
20069
+ textElement.clear();
20070
+ textElement.sendKeys('TEXT');
20071
+ expect(element(by.binding('title')).getText()).toEqual('TITLE');
20072
+ expect(element(by.binding('text')).getText()).toEqual('TEXT');
19871
20073
  });
19872
- </doc:scenario>
20074
+ </doc:protractor>
19873
20075
  </doc:example>
19874
20076
  *
19875
20077
  */
@@ -19922,12 +20124,12 @@ var ngTranscludeDirective = ngDirective({
19922
20124
  <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
19923
20125
  <div id="tpl-content" ng-include src="currentTpl"></div>
19924
20126
  </doc:source>
19925
- <doc:scenario>
20127
+ <doc:protractor>
19926
20128
  it('should load template defined inside script tag', function() {
19927
- element('#tpl-link').click();
19928
- expect(element('#tpl-content').text()).toMatch(/Content of the template/);
20129
+ element(by.css('#tpl-link')).click();
20130
+ expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
19929
20131
  });
19930
- </doc:scenario>
20132
+ </doc:protractor>
19931
20133
  </doc:example>
19932
20134
  */
19933
20135
  var scriptDirective = ['$templateCache', function($templateCache) {
@@ -19975,7 +20177,7 @@ var ngOptionsMinErr = minErr('ngOptions');
19975
20177
  * option. See example below for demonstration.
19976
20178
  *
19977
20179
  * <div class="alert alert-warning">
19978
- * **Note:** `ngOptions` provides iterator facility for `<option>` element which should be used instead
20180
+ * **Note:** `ngOptions` provides an iterator facility for the `<option>` element which should be used instead
19979
20181
  * of {@link ng.directive:ngRepeat ngRepeat} when you want the
19980
20182
  * `select` model to be bound to a non-string value. This is because an option element can only
19981
20183
  * be bound to string values at present.
@@ -20066,15 +20268,17 @@ var ngOptionsMinErr = minErr('ngOptions');
20066
20268
  </div>
20067
20269
  </div>
20068
20270
  </doc:source>
20069
- <doc:scenario>
20271
+ <doc:protractor>
20070
20272
  it('should check ng-options', function() {
20071
- expect(binding('{selected_color:color}')).toMatch('red');
20072
- select('color').option('0');
20073
- expect(binding('{selected_color:color}')).toMatch('black');
20074
- using('.nullable').select('color').option('');
20075
- expect(binding('{selected_color:color}')).toMatch('null');
20273
+ expect(element(by.binding('{selected_color:color}')).getText()).toMatch('red');
20274
+ element.all(by.select('color')).first().click();
20275
+ element.all(by.css('select[ng-model="color"] option')).first().click();
20276
+ expect(element(by.binding('{selected_color:color}')).getText()).toMatch('black');
20277
+ element(by.css('.nullable select[ng-model="color"]')).click();
20278
+ element.all(by.css('.nullable select[ng-model="color"] option')).first().click();
20279
+ expect(element(by.binding('{selected_color:color}')).getText()).toMatch('null');
20076
20280
  });
20077
- </doc:scenario>
20281
+ </doc:protractor>
20078
20282
  </doc:example>
20079
20283
  */
20080
20284