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

Unified Diff: third_party/pkg/angular/test/filter/date_spec.dart

Issue 256553002: Revert "Update all Angular libs (run update_all.sh)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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/filter/date_spec.dart
diff --git a/third_party/pkg/angular/test/filter/date_spec.dart b/third_party/pkg/angular/test/filter/date_spec.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2cb48e19d04648d5772c22679367ff0e3053f855
--- /dev/null
+++ b/third_party/pkg/angular/test/filter/date_spec.dart
@@ -0,0 +1,66 @@
+library date_spec;
+
+import '../_specs.dart';
+
+main() => describe('date', () {
+ var morning = DateTime.parse('2010-09-03T07:05:08.008Z'); //7am
+ var noon = DateTime.parse('2010-09-03T12:05:08.012Z'); //12pm
+ var midnight = DateTime.parse('2010-09-03T12:05:08.123Z'); //12am
+ var earlyDate = DateTime.parse('0001-09-03T05:05:08.000Z');
+
+ var date;
+
+ beforeEach(inject((FilterMap map, Injector injector) {
+ date = injector.get(map[new NgFilter(name: 'date')]);
+ }));
+
+ it('should ignore falsy inputs', () {
+ expect(date(null)).toBeNull();
+ expect(date('')).toEqual('');
+ });
+
+ it('should do basic filter', () {
+ expect(date(noon)).toEqual(date(noon, 'mediumDate'));
+ });
+
+ it('should accept various format strings', () {
+ expect(date(morning, "yy-MM-dd HH:mm:ss")).
+ toEqual('10-09-03 07:05:08');
+
+ expect(date(morning, "yy-MM-dd HH:mm:ss.sss")).
+ toEqual('10-09-03 07:05:08.008');
+ });
+
+ it('should accept default formats', () {
+
+ expect(date(noon, "medium")).
+ toEqual('Sep 3, 2010 12:05:08 PM');
+
+ expect(date(noon, "short")).
+ toEqual('9/3/10 12:05 PM');
+
+ expect(date(noon, "fullDate")).
+ toEqual('Friday, September 3, 2010');
+
+ expect(date(noon, "longDate")).
+ toEqual('September 3, 2010');
+
+ expect(date(noon, "mediumDate")).
+ toEqual('Sep 3, 2010');
+
+ expect(date(noon, "shortDate")).
+ toEqual('9/3/10');
+
+ expect(date(noon, "mediumTime")).
+ toEqual('12:05:08 PM');
+
+ expect(date(noon, "shortTime")).
+ toEqual('12:05 PM');
+ });
+
+ it('should use cache without any error', () {
+
+ date(noon, "shortTime");
+ date(noon, "shortTime");
+ });
+});
« no previous file with comments | « third_party/pkg/angular/test/filter/currency_spec.dart ('k') | third_party/pkg/angular/test/filter/filter_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698