Skip to content

Commit 0cd2bf2

Browse files
committed
apply operation [) in tests
1 parent b845632 commit 0cd2bf2

File tree

1 file changed

+45
-85
lines changed

1 file changed

+45
-85
lines changed

test/jasmine/tests/axes_test.js

Lines changed: 45 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -4054,54 +4054,18 @@ describe('Test axes', function() {
40544054
}, {
40554055
xaxis: {
40564056
rangebreaks: [
4057-
{'operation': '()', bounds: [
4058-
'1970-01-01 00:00:00.010',
4059-
'1970-01-01 00:00:00.090'
4060-
]},
4061-
{'operation': '()', bounds: [
4062-
'1970-01-01 00:00:00.100',
4063-
'1970-01-01 00:00:00.190'
4064-
]}
4065-
]
4066-
}
4067-
});
4068-
_assert('with operation:()', [0, 10, BADNUM, 90, 100, BADNUM, 190, 200]);
4069-
4070-
_calc({
4071-
x: x
4072-
}, {
4073-
xaxis: {
4074-
rangebreaks: [
4075-
{'operation': '[]', bounds: [
4076-
'1970-01-01 00:00:00.010',
4077-
'1970-01-01 00:00:00.090'
4078-
]},
4079-
{'operation': '[]', bounds: [
4080-
'1970-01-01 00:00:00.100',
4081-
'1970-01-01 00:00:00.190'
4082-
]}
4083-
]
4084-
}
4085-
});
4086-
_assert('with operation:[]', [0, BADNUM, BADNUM, BADNUM, BADNUM, BADNUM, BADNUM, 200]);
4087-
4088-
_calc({
4089-
x: x
4090-
}, {
4091-
xaxis: {
4092-
rangebreaks: [
4093-
{'operation': '[)', bounds: [
4057+
{bounds: [
40944058
'1970-01-01 00:00:00.010',
40954059
'1970-01-01 00:00:00.090'
40964060
]},
4097-
{'operation': '(]', bounds: [
4061+
{bounds: [
40984062
'1970-01-01 00:00:00.100',
40994063
'1970-01-01 00:00:00.190'
41004064
]}
41014065
]
41024066
}
41034067
});
4104-
_assert('with mixed operation values', [0, BADNUM, BADNUM, 90, 100, BADNUM, BADNUM, 200]);
4068+
_assert('', [0, BADNUM, BADNUM, 90, BADNUM, BADNUM, 190, 200]);
41054069
});
41064070

41074071
it('should discard coords within break bounds - date day of week case', function() {
@@ -4152,11 +4116,11 @@ describe('Test axes', function() {
41524116
}, {
41534117
xaxis: {
41544118
rangebreaks: [
4155-
{pattern: 'hour', bounds: [17, 8], operation: '()'}
4119+
{pattern: 'hour', bounds: [17, 8]}
41564120
]
41574121
}
41584122
});
4159-
_assert('with () operation', [
4123+
_assert('', [
41604124
1577952000000, BADNUM,
41614125
1578038400000, BADNUM,
41624126
1578124800000, BADNUM,
@@ -4169,6 +4133,7 @@ describe('Test axes', function() {
41694133
it('should discard coords within break bounds - date hour / high precision case', function() {
41704134
_calc({
41714135
x: [
4136+
'2020-01-03 16:45',
41724137
'2020-01-03 17:00',
41734138
'2020-01-03 17:15',
41744139
'2020-01-03 17:30',
@@ -4180,12 +4145,13 @@ describe('Test axes', function() {
41804145
}, {
41814146
xaxis: {
41824147
rangebreaks: [
4183-
{pattern: 'hour', bounds: [17, 8], operation: '()'}
4148+
{pattern: 'hour', bounds: [17, 8]}
41844149
]
41854150
}
41864151
});
4187-
_assert('with dflt operation', [
4188-
Lib.dateTime2ms('2020-01-03 17:00'),
4152+
_assert('', [
4153+
Lib.dateTime2ms('2020-01-03 16:45'),
4154+
BADNUM,
41894155
BADNUM,
41904156
BADNUM,
41914157
BADNUM,
@@ -4214,13 +4180,13 @@ describe('Test axes', function() {
42144180
}, {
42154181
xaxis: {
42164182
rangebreaks: [
4217-
{pattern: 'hour', bounds: [23, 1], operation: '()'}
4183+
{pattern: 'hour', bounds: [23, 1]}
42184184
]
42194185
}
42204186
});
4221-
_assert('with dflt operation', [
4187+
_assert('', [
42224188
Lib.dateTime2ms('2020-01-01 22'),
4223-
Lib.dateTime2ms('2020-01-01 23'),
4189+
BADNUM,
42244190
BADNUM,
42254191
BADNUM,
42264192
BADNUM,
@@ -4253,13 +4219,13 @@ describe('Test axes', function() {
42534219
}, {
42544220
xaxis: {
42554221
rangebreaks: [
4256-
{pattern: 'hour', bounds: [23, 0], operation: '()'}
4222+
{pattern: 'hour', bounds: [23, 0]}
42574223
]
42584224
}
42594225
});
4260-
_assert('with dflt operation', [
4226+
_assert('', [
42614227
Lib.dateTime2ms('2020-01-01 22'),
4262-
Lib.dateTime2ms('2020-01-01 23'),
4228+
BADNUM,
42634229
BADNUM,
42644230
BADNUM,
42654231
BADNUM,
@@ -4292,13 +4258,13 @@ describe('Test axes', function() {
42924258
}, {
42934259
xaxis: {
42944260
rangebreaks: [
4295-
{pattern: 'hour', bounds: [23, 24], operation: '()'}
4261+
{pattern: 'hour', bounds: [23, 24]}
42964262
]
42974263
}
42984264
});
4299-
_assert('with dflt operation', [
4265+
_assert('', [
43004266
Lib.dateTime2ms('2020-01-01 22'),
4301-
Lib.dateTime2ms('2020-01-01 23'),
4267+
BADNUM,
43024268
BADNUM,
43034269
BADNUM,
43044270
BADNUM,
@@ -4335,7 +4301,7 @@ describe('Test axes', function() {
43354301
]
43364302
}
43374303
});
4338-
_assert('with dflt operation', [
4304+
_assert('', [
43394305
Lib.dateTime2ms('2020-01-01 22'),
43404306
Lib.dateTime2ms('2020-01-01 23'),
43414307
Lib.dateTime2ms('2020-01-01 23:30'),
@@ -4396,10 +4362,10 @@ describe('Test axes', function() {
43964362
rangebreaks: [{ values: [
43974363
'1970-01-01 00:00:00.002',
43984364
'1970-01-01 00:00:00.003'
4399-
], dvalue: 1, operation: '()' }]
4365+
], dvalue: 1 }]
44004366
}
44014367
});
4402-
_assert('', [1, 2, BADNUM, 4, 5]);
4368+
_assert('', [1, BADNUM, BADNUM, 4, 5]);
44034369
});
44044370

44054371
it('should adapt coords generated from x0/dx about rangebreaks', function() {
@@ -4413,11 +4379,11 @@ describe('Test axes', function() {
44134379
{bounds: [
44144380
'1970-01-01 00:00:00.002',
44154381
'1970-01-01 00:00:00.003'
4416-
], operation: '()'}
4382+
]}
44174383
]
44184384
}
44194385
});
4420-
_assert('generated x=2.5 gets masked', [1, 1.5, 2, BADNUM, 3]);
4386+
_assert('generated x=2.5 gets masked', [1, 1.5, BADNUM, BADNUM, 3]);
44214387
});
44224388
});
44234389

@@ -4595,11 +4561,11 @@ describe('Test axes', function() {
45954561
{bounds: [
45964562
'1969-12-31 23:59:59.990',
45974563
'1970-01-01 00:00:00.089'
4598-
], operation: '()'},
4564+
]},
45994565
{bounds: [
46004566
'1970-01-01 00:00:00.101',
46014567
'1970-01-01 00:00:00.189'
4602-
], operation: '()'}
4568+
]}
46034569
];
46044570
return Plotly.react(gd, gd.data, gd.layout);
46054571
})
@@ -4635,11 +4601,11 @@ describe('Test axes', function() {
46354601
{bounds: [
46364602
'1969-12-31 23:59:59.989',
46374603
'1970-01-01 00:00:00.090'
4638-
], operation: '()'},
4604+
]},
46394605
{bounds: [
46404606
'1970-01-01 00:00:00.101',
46414607
'1970-01-01 00:00:00.300'
4642-
], operation: '()'}
4608+
]}
46434609
];
46444610
return Plotly.react(gd, gd.data, gd.layout);
46454611
})
@@ -4779,7 +4745,7 @@ describe('Test axes', function() {
47794745
})
47804746
.then(function() {
47814747
gd.layout.xaxis.rangebreaks = [
4782-
{pattern: 'hour', bounds: [17, 8], operation: '()'}
4748+
{pattern: 'hour', bounds: [17, 8]}
47834749
];
47844750
return Plotly.react(gd, gd.data, gd.layout);
47854751
})
@@ -4790,22 +4756,20 @@ describe('Test axes', function() {
47904756
['2020-01-03 17:00:00', '2020-01-04 08:00:00'].map(Lib.dateTime2ms),
47914757
['2020-01-04 17:00:00', '2020-01-05 08:00:00'].map(Lib.dateTime2ms),
47924758
['2020-01-05 17:00:00', '2020-01-06 08:00:00'].map(Lib.dateTime2ms),
4793-
['2020-01-06 17:00:00', '2020-01-07 08:00:00'].map(Lib.dateTime2ms),
4794-
[Lib.dateTime2ms('2020-01-07 17:00:00'), 1578428892790]
4759+
['2020-01-06 17:00:00', '2020-01-07 08:00:00'].map(Lib.dateTime2ms)
47954760
],
4796-
m2: 0.0000026100474550128112,
4761+
m2: 0.0000029537037039351,
47974762
B: [
4798-
-4118496.99495763, -4118637.937520201,
4799-
-4118778.8800827716, -4118919.8226453424,
4800-
-4119060.7652079132, -4119201.707770484,
4801-
-4119234.3145452295
4763+
-4660771.917031818, -4660931.41703183,
4764+
-4661090.917031842, -4661250.417031854,
4765+
-4661409.9170318665, -4661569.417031879
48024766
]
48034767
});
48044768
})
48054769
.then(function() {
48064770
gd.layout.xaxis.rangebreaks = [
48074771
{pattern: 'day of week', bounds: [6, 1]},
4808-
{pattern: 'hour', bounds: [17, 8], operation: '()'}
4772+
{pattern: 'hour', bounds: [17, 8]}
48094773
];
48104774
return Plotly.react(gd, gd.data, gd.layout);
48114775
})
@@ -4814,20 +4778,18 @@ describe('Test axes', function() {
48144778
rangebreaks: [
48154779
['2020-01-02 17:00:00', '2020-01-03 08:00:00'].map(Lib.dateTime2ms),
48164780
['2020-01-03 17:00:00', '2020-01-06 08:00:00'].map(Lib.dateTime2ms),
4817-
['2020-01-06 17:00:00', '2020-01-07 08:00:00'].map(Lib.dateTime2ms),
4818-
[Lib.dateTime2ms('2020-01-07 17:00:00'), 1578424728526.6]
4781+
['2020-01-06 17:00:00', '2020-01-07 08:00:00'].map(Lib.dateTime2ms)
48194782
],
4820-
m2: 0.000003915071184408763,
4783+
m2: 0.000004922839504765992,
48214784
B: [
4822-
-6177761.798805676, -6177973.212649634,
4823-
-6178861.150794258, -6179072.564638216,
4824-
-6179105.171412717
4785+
-7767973.692224438, -7768239.525557696,
4786+
-7769356.025557376, -7769621.858890634
48254787
]
48264788
});
48274789
})
48284790
.then(function() {
48294791
gd.layout.xaxis.rangebreaks = [
4830-
{pattern: 'hour', bounds: [17, 8], operation: '()'},
4792+
{pattern: 'hour', bounds: [17, 8]},
48314793
{pattern: 'day of week', bounds: [6, 1]}
48324794
];
48334795
return Plotly.react(gd, gd.data, gd.layout);
@@ -4837,20 +4799,18 @@ describe('Test axes', function() {
48374799
rangebreaks: [
48384800
['2020-01-02 17:00:00', '2020-01-03 08:00:00'].map(Lib.dateTime2ms),
48394801
['2020-01-03 17:00:00', '2020-01-06 08:00:00'].map(Lib.dateTime2ms),
4840-
['2020-01-06 17:00:00', '2020-01-07 08:00:00'].map(Lib.dateTime2ms),
4841-
[Lib.dateTime2ms('2020-01-07 17:00:00'), 1578424728526.6]
4802+
['2020-01-06 17:00:00', '2020-01-07 08:00:00'].map(Lib.dateTime2ms)
48424803
],
4843-
m2: 0.000003915071184408763,
4804+
m2: 0.000004922839504765992,
48444805
B: [
4845-
-6177761.798805676, -6177973.212649634,
4846-
-6178861.150794258, -6179072.564638216,
4847-
-6179105.171412717
4806+
-7767973.692224438, -7768239.525557696,
4807+
-7769356.025557376, -7769621.858890634
48484808
]
48494809
});
48504810
})
48514811
.then(function() {
48524812
gd.layout.xaxis.rangebreaks = [
4853-
{pattern: 'hour', bounds: [17, 8], operation: '()'}
4813+
{pattern: 'hour', bounds: [17, 8]}
48544814
];
48554815
// N.B. xaxis.range[0] falls within a break
48564816
gd.layout.xaxis.autorange = false;

0 commit comments

Comments
 (0)