Skip to content

Commit ec0771a

Browse files
committed
use new Date() to def specs instead of ms:
- so that it works in all time zones - and to make things more readable
1 parent beb239b commit ec0771a

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

test/jasmine/tests/range_selector_test.js

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ describe('range selector', function() {
4848
describe('getUpdateObject', function() {
4949
var axisLayout = {
5050
range: [
51-
-694292400000, // Thu Jan 01 1948 00:00:00
52-
1448859600000 // Mon Nov 30 2015 00:00:00
51+
(new Date(1948, 0, 1)).getTime(),
52+
(new Date(2015, 10, 30)).getTime()
5353
]
5454
};
5555

5656
function assertRanges(update, range0, range1) {
57-
expect(update['xaxis.range[0]']).toEqual(range0);
58-
expect(update['xaxis.range[1]']).toEqual(range1);
57+
expect(update['xaxis.range[0]']).toEqual(range0.getTime());
58+
expect(update['xaxis.range[1]']).toEqual(range1.getTime());
5959
}
6060

6161
it('should return update object (1 month backward case)', function() {
@@ -67,7 +67,7 @@ describe('range selector', function() {
6767

6868
var update = getUpdateObject(axisLayout, buttonLayout);
6969

70-
assertRanges(update, 1446177600000, 1448859600000);
70+
assertRanges(update, new Date(2015, 9, 30), new Date(2015, 10, 30));
7171
});
7272

7373
it('should return update object (3 months backward case)', function() {
@@ -79,7 +79,7 @@ describe('range selector', function() {
7979

8080
var update = getUpdateObject(axisLayout, buttonLayout);
8181

82-
assertRanges(update, 1440907200000, 1448859600000);
82+
assertRanges(update, new Date(2015, 7, 30), new Date(2015, 10, 30));
8383
});
8484

8585
it('should return update object (6 months backward case)', function() {
@@ -91,19 +91,7 @@ describe('range selector', function() {
9191

9292
var update = getUpdateObject(axisLayout, buttonLayout);
9393

94-
assertRanges(update, 1432958400000, 1448859600000);
95-
});
96-
97-
it('should return update object (3 months backward case)', function() {
98-
var buttonLayout = {
99-
step: 'month',
100-
stepmode: 'backward',
101-
count: 3
102-
};
103-
104-
var update = getUpdateObject(axisLayout, buttonLayout);
105-
106-
assertRanges(update, 1440907200000, 1448859600000);
94+
assertRanges(update, new Date(2015, 4, 30), new Date(2015, 10, 30));
10795
});
10896

10997
it('should return update object (year-to-date case)', function() {
@@ -115,7 +103,7 @@ describe('range selector', function() {
115103

116104
var update = getUpdateObject(axisLayout, buttonLayout);
117105

118-
assertRanges(update, 1420088400000, 1448859600000);
106+
assertRanges(update, new Date(2015, 0, 1), new Date(2015, 10, 30));
119107
});
120108

121109
it('should return update object (1 year backward case)', function() {
@@ -127,7 +115,7 @@ describe('range selector', function() {
127115

128116
var update = getUpdateObject(axisLayout, buttonLayout);
129117

130-
assertRanges(update, 1417323600000, 1448859600000);
118+
assertRanges(update, new Date(2014, 10, 30), new Date(2015, 10, 30));
131119
});
132120

133121
it('should return update object (reset case)', function() {

0 commit comments

Comments
 (0)