Skip to content

Commit aa8152b

Browse files
committed
remove operations option from (day of week) and adapt tests
1 parent 791d529 commit aa8152b

6 files changed

+25
-94
lines changed

test/image/mocks/axes_breaks-finance.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@
364364
"rangebreaks": [
365365
{
366366
"pattern": "day of week",
367-
"operation": "[]",
368-
"bounds": [ 6, 0 ]
367+
"bounds": [ 6, 1 ]
369368
},
370369
{
371370
"values": ["2017-01-16"],
@@ -378,8 +377,7 @@
378377
"rangebreaks": [
379378
{
380379
"pattern": "day of week",
381-
"operation": "[]",
382-
"bounds": [ 6, 0 ]
380+
"bounds": [ 6, 1 ]
383381
},
384382
{
385383
"values": ["2017-01-16"],

test/image/mocks/axes_breaks-night_autorange-reversed.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@
196196
"bounds": [
197197
18,
198198
6
199-
],
200-
"operation": "[)"
199+
]
201200
}
202201
],
203202
"domain": [
@@ -212,8 +211,7 @@
212211
"bounds": [
213212
18,
214213
6
215-
],
216-
"operation": "[)"
214+
]
217215
}
218216
],
219217
"autorange": "reversed",
@@ -257,8 +255,7 @@
257255
"bounds": [
258256
18,
259257
6
260-
],
261-
"operation": "[)"
258+
]
262259
}
263260
],
264261
"anchor": "x3",
@@ -274,8 +271,7 @@
274271
"bounds": [
275272
18,
276273
6
277-
],
278-
"operation": "[)"
274+
]
279275
}
280276
],
281277
"autorange": "reversed",

test/image/mocks/axes_breaks-rangeslider.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,8 +2655,7 @@
26552655
"rangebreaks": [
26562656
{
26572657
"pattern": "day of week",
2658-
"bounds": [6, 0],
2659-
"operation": "[]"
2658+
"bounds": [6, 1]
26602659
},
26612660
{
26622661
"pattern": "hour",

test/image/mocks/axes_breaks-weekends-weeknights.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"rangebreaks": [
1717
{
1818
"pattern": "day of week",
19-
"bounds": [ 6, 0 ],
20-
"operation": "[]"
19+
"bounds": [ 6, 1 ]
2120
},
2221
{
2322
"pattern": "hour",

test/image/mocks/axes_breaks-weekends_autorange-reversed.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@
9191
"pattern": "day of week",
9292
"bounds": [
9393
6,
94-
0
95-
],
96-
"operation": "[]"
94+
1
95+
]
9796
}
9897
],
9998
"domain": [
@@ -107,9 +106,8 @@
107106
"pattern": "day of week",
108107
"bounds": [
109108
6,
110-
0
111-
],
112-
"operation": "[]"
109+
1
110+
]
113111
}
114112
],
115113
"autorange": "reversed",
@@ -152,9 +150,8 @@
152150
"pattern": "day of week",
153151
"bounds": [
154152
6,
155-
0
156-
],
157-
"operation": "[]"
153+
1
154+
]
158155
}
159156
],
160157
"anchor": "x3",
@@ -169,9 +166,8 @@
169166
"pattern": "day of week",
170167
"bounds": [
171168
6,
172-
0
173-
],
174-
"operation": "[]"
169+
1
170+
]
175171
}
176172
],
177173
"autorange": "reversed",

test/jasmine/tests/axes_test.js

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ describe('Test axes', function() {
11251125
it('should only coerce rangebreaks *pattern* with *bounds*', function() {
11261126
layoutIn = {
11271127
xaxis: {type: 'date', rangebreaks: [{bounds: ['2020-01-04', '2020-01-05']}]},
1128-
xaxis2: {type: 'date', rangebreaks: [{bounds: [6, 0], pattern: 'day of week'}]},
1128+
xaxis2: {type: 'date', rangebreaks: [{bounds: [6, 1], pattern: 'day of week'}]},
11291129
xaxis3: {type: 'date', rangebreaks: [{values: ['2020-01-04', '2020-01-05'], pattern: 'NOP'}]},
11301130
};
11311131
layoutOut._subplots.xaxis.push('x2', 'x3');
@@ -4132,38 +4132,11 @@ describe('Test axes', function() {
41324132
_calc({x: x}, {
41334133
xaxis: {
41344134
rangebreaks: [
4135-
{pattern: 'day of week', bounds: [6, 0], operation: '[]'}
4135+
{pattern: 'day of week', bounds: [6, 1]}
41364136
]
41374137
}
41384138
});
4139-
_assert('[6,0]', noWeekend);
4140-
4141-
_calc({x: x}, {
4142-
xaxis: {
4143-
rangebreaks: [
4144-
{pattern: 'day of week', bounds: [5, 1], operation: '()'}
4145-
]
4146-
}
4147-
});
4148-
_assert('(5,1)', noWeekend);
4149-
4150-
_calc({x: x}, {
4151-
xaxis: {
4152-
rangebreaks: [
4153-
{pattern: 'day of week', bounds: [6, 1], operation: '[)'}
4154-
]
4155-
}
4156-
});
4157-
_assert('[6,1)', noWeekend);
4158-
4159-
_calc({x: x}, {
4160-
xaxis: {
4161-
rangebreaks: [
4162-
{pattern: 'day of week', bounds: [5, 0], operation: '(]'}
4163-
]
4164-
}
4165-
});
4166-
_assert('(5,0]', noWeekend);
4139+
_assert('[6,1]', noWeekend);
41674140
});
41684141

41694142
it('should discard coords within break bounds - date hour case', function() {
@@ -4767,7 +4740,7 @@ describe('Test axes', function() {
47674740
})
47684741
.then(function() {
47694742
gd.layout.xaxis.rangebreaks = [
4770-
{pattern: 'day of week', bounds: [5, 1], operation: '()'}
4743+
{pattern: 'day of week', bounds: [6, 1]}
47714744
];
47724745
return Plotly.react(gd, gd.data, gd.layout);
47734746
})
@@ -4782,22 +4755,7 @@ describe('Test axes', function() {
47824755
})
47834756
.then(function() {
47844757
gd.layout.xaxis.rangebreaks = [
4785-
{pattern: 'day of week', bounds: [6, 0], operation: '[]'}
4786-
];
4787-
return Plotly.react(gd, gd.data, gd.layout);
4788-
})
4789-
.then(function() {
4790-
_assert('break over the weekend days (with operation:[])', 'x', {
4791-
rangebreaks: [
4792-
['2020-01-04', '2020-01-06'].map(Lib.dateTime2ms)
4793-
],
4794-
m2: 0.000001640946501588664,
4795-
B: [-2589304.064, -2589587.619]
4796-
});
4797-
})
4798-
.then(function() {
4799-
gd.layout.xaxis.rangebreaks = [
4800-
{pattern: 'day of week', bounds: [4, 6], operation: '()'}
4758+
{pattern: 'day of week', bounds: [5, 6]}
48014759
];
48024760
return Plotly.react(gd, gd.data, gd.layout);
48034761
})
@@ -4812,22 +4770,7 @@ describe('Test axes', function() {
48124770
})
48134771
.then(function() {
48144772
gd.layout.xaxis.rangebreaks = [
4815-
{pattern: 'day of week', bounds: [5, 5], operation: '[]'}
4816-
];
4817-
return Plotly.react(gd, gd.data, gd.layout);
4818-
})
4819-
.then(function() {
4820-
_assert('skip Friday (operation:[] version)', 'x', {
4821-
rangebreaks: [
4822-
['2020-01-03', '2020-01-04'].map(Lib.dateTime2ms)
4823-
],
4824-
m2: 0.0000012658730158736563,
4825-
B: [-1997456.107, -1997565.478]
4826-
});
4827-
})
4828-
.then(function() {
4829-
gd.layout.xaxis.rangebreaks = [
4830-
{pattern: 'day of week', bounds: [5, 5], operation: '()'}
4773+
{pattern: 'day of week', bounds: [5, 5]}
48314774
];
48324775
return Plotly.react(gd, gd.data, gd.layout);
48334776
})
@@ -4861,7 +4804,7 @@ describe('Test axes', function() {
48614804
})
48624805
.then(function() {
48634806
gd.layout.xaxis.rangebreaks = [
4864-
{pattern: 'day of week', bounds: [5, 1], operation: '()'},
4807+
{pattern: 'day of week', bounds: [6, 1]},
48654808
{pattern: 'hour', bounds: [17, 8], operation: '()'}
48664809
];
48674810
return Plotly.react(gd, gd.data, gd.layout);
@@ -4885,7 +4828,7 @@ describe('Test axes', function() {
48854828
.then(function() {
48864829
gd.layout.xaxis.rangebreaks = [
48874830
{pattern: 'hour', bounds: [17, 8], operation: '()'},
4888-
{pattern: 'day of week', bounds: [5, 1], operation: '()'}
4831+
{pattern: 'day of week', bounds: [6, 1]}
48894832
];
48904833
return Plotly.react(gd, gd.data, gd.layout);
48914834
})
@@ -4928,7 +4871,7 @@ describe('Test axes', function() {
49284871
})
49294872
.then(function() {
49304873
gd.layout.xaxis.rangebreaks = [
4931-
{pattern: 'day of week', bounds: [1, 4], operation: '()'}
4874+
{pattern: 'day of week', bounds: [2, 4]}
49324875
];
49334876
// N.B. xaxis.range[0] falls within a break
49344877
gd.layout.xaxis.autorange = false;

0 commit comments

Comments
 (0)