aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ng/filter/filtersSpec.js15
-rw-r--r--test/ngMock/angular-mocksSpec.js8
2 files changed, 20 insertions, 3 deletions
diff --git a/test/ng/filter/filtersSpec.js b/test/ng/filter/filtersSpec.js
index 2bc709ee..766df989 100644
--- a/test/ng/filter/filtersSpec.js
+++ b/test/ng/filter/filtersSpec.js
@@ -162,9 +162,9 @@ describe('filters', function() {
describe('date', function() {
- var morning = new angular.mock.TzDate(+5, '2010-09-03T12:05:08.000Z'); //7am
- var noon = new angular.mock.TzDate(+5, '2010-09-03T17:05:08.000Z'); //12pm
- var midnight = new angular.mock.TzDate(+5, '2010-09-03T05:05:08.000Z'); //12am
+ var morning = new angular.mock.TzDate(+5, '2010-09-03T12:05:08.001Z'); //7am
+ var noon = new angular.mock.TzDate(+5, '2010-09-03T17:05:08.012Z'); //12pm
+ var midnight = new angular.mock.TzDate(+5, '2010-09-03T05:05:08.123Z'); //12am
var earlyDate = new angular.mock.TzDate(+5, '0001-09-03T05:05:08.000Z');
var date;
@@ -192,15 +192,24 @@ describe('filters', function() {
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.001');
+
expect(date(midnight, "yyyy-M-d h=H:m:saZ")).
toEqual('2010-9-3 12=0:5:8AM-0500');
expect(date(midnight, "yyyy-MM-dd hh=HH:mm:ssaZ")).
toEqual('2010-09-03 12=00:05:08AM-0500');
+ expect(date(midnight, "yyyy-MM-dd hh=HH:mm:ss.sssaZ")).
+ toEqual('2010-09-03 12=00:05:08.123AM-0500');
+
expect(date(noon, "yyyy-MM-dd hh=HH:mm:ssaZ")).
toEqual('2010-09-03 12=12:05:08PM-0500');
+ expect(date(noon, "yyyy-MM-dd hh=HH:mm:ss.sssaZ")).
+ toEqual('2010-09-03 12=12:05:08.012PM-0500');
+
expect(date(noon, "EEE, MMM d, yyyy")).
toEqual('Fri, Sep 3, 2010');
diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js
index d95f3003..176c5c92 100644
--- a/test/ngMock/angular-mocksSpec.js
+++ b/test/ngMock/angular-mocksSpec.js
@@ -109,6 +109,13 @@ describe('ngMock', function() {
});
+ it('should fake getMilliseconds method', function() {
+ expect(new angular.mock.TzDate(0, '2010-09-03T23:05:08.003Z').getMilliseconds()).toBe(3);
+ expect(new angular.mock.TzDate(0, '2010-09-03T23:05:08.023Z').getMilliseconds()).toBe(23);
+ expect(new angular.mock.TzDate(0, '2010-09-03T23:05:08.123Z').getMilliseconds()).toBe(123);
+ });
+
+
it('should create a date representing new year in Bratislava', function() {
var newYearInBratislava = new angular.mock.TzDate(-1, '2009-12-31T23:00:00.000Z');
expect(newYearInBratislava.getTimezoneOffset()).toBe(-60);
@@ -117,6 +124,7 @@ describe('ngMock', function() {
expect(newYearInBratislava.getDate()).toBe(1);
expect(newYearInBratislava.getHours()).toBe(0);
expect(newYearInBratislava.getMinutes()).toBe(0);
+ expect(newYearInBratislava.getSeconds()).toBe(0);
});