Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1392)

Unified Diff: third_party/pkg/angular/test/directive/ng_pluralize_spec.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/test/directive/ng_pluralize_spec.dart
===================================================================
--- third_party/pkg/angular/test/directive/ng_pluralize_spec.dart (revision 33054)
+++ third_party/pkg/angular/test/directive/ng_pluralize_spec.dart (working copy)
@@ -34,95 +34,95 @@
}));
it('should show single/plural strings', () {
- _.rootScope.context['email'] = '0';
- _.rootScope.apply();
+ _.rootScope.email = '0';
+ _.rootScope.$digest();
expect(element.text).toEqual('You have no new email');
expect(elementAlt.text).toEqual('You have no new email');
- _.rootScope.context['email'] = '0';
- _.rootScope.apply();
+ _.rootScope.email = '0';
+ _.rootScope.$digest();
expect(element.text).toEqual('You have no new email');
expect(elementAlt.text).toEqual('You have no new email');
- _.rootScope.context['email'] = 1;
- _.rootScope.apply();
+ _.rootScope.email = 1;
+ _.rootScope.$digest();
expect(element.text).toEqual('You have one new email');
expect(elementAlt.text).toEqual('You have one new email');
- _.rootScope.context['email'] = 0.01;
- _.rootScope.apply();
+ _.rootScope.email = 0.01;
+ _.rootScope.$digest();
expect(element.text).toEqual('You have 0.01 new emails');
expect(elementAlt.text).toEqual('You have 0.01 new emails');
- _.rootScope.context['email'] = '0.1';
- _.rootScope.apply();
+ _.rootScope.email = '0.1';
+ _.rootScope.$digest();
expect(element.text).toEqual('You have 0.1 new emails');
expect(elementAlt.text).toEqual('You have 0.1 new emails');
- _.rootScope.context['email'] = 2;
- _.rootScope.apply();
+ _.rootScope.email = 2;
+ _.rootScope.$digest();
expect(element.text).toEqual('You have 2 new emails');
expect(elementAlt.text).toEqual('You have 2 new emails');
- _.rootScope.context['email'] = -0.1;
- _.rootScope.apply();
+ _.rootScope.email = -0.1;
+ _.rootScope.$digest();
expect(element.text).toEqual('You have -0.1 new emails');
expect(elementAlt.text).toEqual('You have -0.1 new emails');
- _.rootScope.context['email'] = '-0.01';
- _.rootScope.apply();
+ _.rootScope.email = '-0.01';
+ _.rootScope.$digest();
expect(element.text).toEqual('You have -0.01 new emails');
expect(elementAlt.text).toEqual('You have -0.01 new emails');
- _.rootScope.context['email'] = -2;
- _.rootScope.apply();
+ _.rootScope.email = -2;
+ _.rootScope.$digest();
expect(element.text).toEqual('You have -2 new emails');
expect(elementAlt.text).toEqual('You have -2 new emails');
- _.rootScope.context['email'] = -1;
- _.rootScope.apply();
+ _.rootScope.email = -1;
+ _.rootScope.$digest();
expect(element.text).toEqual('You have negative email. Whohoo!');
expect(elementAlt.text).toEqual('You have negative email. Whohoo!');
});
it('should show single/plural strings with mal-formed inputs', () {
- _.rootScope.context['email'] = '';
- _.rootScope.apply();
+ _.rootScope.email = '';
+ _.rootScope.$digest();
expect(element.text).toEqual('');
expect(elementAlt.text).toEqual('');
- _.rootScope.context['email'] = null;
- _.rootScope.apply();
+ _.rootScope.email = null;
+ _.rootScope.$digest();
expect(element.text).toEqual('');
expect(elementAlt.text).toEqual('');
- _.rootScope.context['email'] = 'a3';
- _.rootScope.apply();
+ _.rootScope.email = 'a3';
+ _.rootScope.$digest();
expect(element.text).toEqual('');
expect(elementAlt.text).toEqual('');
- _.rootScope.context['email'] = '011';
- _.rootScope.apply();
+ _.rootScope.email = '011';
+ _.rootScope.$digest();
expect(element.text).toEqual('You have 11 new emails');
expect(elementAlt.text).toEqual('You have 11 new emails');
- _.rootScope.context['email'] = '-011';
- _.rootScope.apply();
+ _.rootScope.email = '-011';
+ _.rootScope.$digest();
expect(element.text).toEqual('You have -11 new emails');
expect(elementAlt.text).toEqual('You have -11 new emails');
- _.rootScope.context['email'] = '1fff';
- _.rootScope.apply();
+ _.rootScope.email = '1fff';
+ _.rootScope.$digest();
expect(element.text).toEqual('');
expect(elementAlt.text).toEqual('');
- _.rootScope.context['email'] = '0aa22';
- _.rootScope.apply();
+ _.rootScope.email = '0aa22';
+ _.rootScope.$digest();
expect(element.text).toEqual('');
expect(elementAlt.text).toEqual('');
- _.rootScope.context['email'] = '000001';
- _.rootScope.apply();
+ _.rootScope.email = '000001';
+ _.rootScope.$digest();
expect(element.text).toEqual('You have one new email');
expect(elementAlt.text).toEqual('You have one new email');
});
@@ -136,8 +136,8 @@
"'one': 'Some text'," +
"'other': 'Some text'}\">" +
'</ng-pluralize>');
- _.rootScope.context['email'] = '0';
- _.rootScope.apply();
+ _.rootScope.email = '0';
+ _.rootScope.$digest();
expect(element.text).toEqual('');
})));
});
@@ -147,44 +147,44 @@
var element = _.compile(
"<ng-pluralize count='viewCount' offset='2' " +
"when=\"{'0': 'Nobody is viewing.'," +
- "'1': '\${p1} is viewing.'," +
- "'2': '\${p1} and \${p2} are viewing.'," +
- "'one': '\${p1}, \${p2} and one other person are viewing.'," +
- "'other': '\${p1}, \${p2} and {} other people are viewing.'}\">" +
+ "'1': '{{p1}} is viewing.'," +
+ "'2': '{{p1}} and {{p2}} are viewing.'," +
+ "'one': '{{p1}}, {{p2}} and one other person are viewing.'," +
+ "'other': '{{p1}}, {{p2}} and {} other people are viewing.'}\">" +
"</ng-pluralize>");
var elementAlt = _.compile(
"<ng-pluralize count='viewCount' offset='2' " +
"when-0='Nobody is viewing.'" +
- "when-1='\${p1} is viewing.'" +
- "when-2='\${p1} and \${p2} are viewing.'" +
- "when-one='\${p1}, \${p2} and one other person are viewing.'" +
- "when-other='\${p1}, \${p2} and {} other people are viewing.'>" +
+ "when-1='{{p1}} is viewing.'" +
+ "when-2='{{p1}} and {{p2}} are viewing.'" +
+ "when-one='{{p1}}, {{p2}} and one other person are viewing.'" +
+ "when-other='{{p1}}, {{p2}} and {} other people are viewing.'>" +
"</ng-pluralize>");
- _.rootScope.context['p1'] = 'Igor';
- _.rootScope.context['p2'] = 'Misko';
+ _.rootScope.p1 = 'Igor';
+ _.rootScope.p2 = 'Misko';
- _.rootScope.context['viewCount'] = 0;
- _.rootScope.apply();
+ _.rootScope.viewCount = 0;
+ _.rootScope.$digest();
expect(element.text).toEqual('Nobody is viewing.');
expect(elementAlt.text).toEqual('Nobody is viewing.');
- _.rootScope.context['viewCount'] = 1;
- _.rootScope.apply();
+ _.rootScope.viewCount = 1;
+ _.rootScope.$digest();
expect(element.text).toEqual('Igor is viewing.');
expect(elementAlt.text).toEqual('Igor is viewing.');
- _.rootScope.context['viewCount'] = 2;
- _.rootScope.apply();
+ _.rootScope.viewCount = 2;
+ _.rootScope.$digest();
expect(element.text).toEqual('Igor and Misko are viewing.');
expect(elementAlt.text).toEqual('Igor and Misko are viewing.');
- _.rootScope.context['viewCount'] = 3;
- _.rootScope.apply();
+ _.rootScope.viewCount = 3;
+ _.rootScope.$digest();
expect(element.text).toEqual('Igor, Misko and one other person are viewing.');
expect(elementAlt.text).toEqual('Igor, Misko and one other person are viewing.');
- _.rootScope.context['viewCount'] = 4;
- _.rootScope.apply();
+ _.rootScope.viewCount = 4;
+ _.rootScope.$digest();
expect(element.text).toEqual('Igor, Misko and 2 other people are viewing.');
expect(elementAlt.text).toEqual('Igor, Misko and 2 other people are viewing.');
})));

Powered by Google App Engine
This is Rietveld 408576698