Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 34b6531

Browse filesBrowse files
committed
sort categories by value: test that ordering is properly done
1 parent 677374d commit 34b6531
Copy full SHA for 34b6531

File tree

1 file changed

+16
-15
lines changed
Filter options

1 file changed

+16
-15
lines changed

‎test/jasmine/tests/calcdata_test.js

Copy file name to clipboardExpand all lines: test/jasmine/tests/calcdata_test.js
+16-15Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -882,36 +882,37 @@ describe('calculated data and points', function() {
882882
return t.categories.length && t.categories.indexOf('cartesian') !== -1;
883883
});
884884

885-
var cartesianTraceNames = cartesianTraces.map(function(t) {
886-
return t.type;
887-
});
888-
889-
for(i = 0; i < cartesianTraceNames.length; i++) {
890-
var type = cartesianTraceNames[i];
885+
for(i = 0; i < cartesianTraces.length; i++) {
886+
var type = cartesianTraces[i].type;
891887
if(type === 'scattergl') continue;
892888
if(type === 'carpet') continue;
893889
if(type === 'contourcarpet') continue;
894890

891+
var data = [7, 2, 3, 7];
892+
var cat = ['a', 'b', 'c', 'a'];
895893
Plotly.newPlot(gd, {
896894
data: [{
897895
type: type,
898-
x: ['a', 'b', 'c', 'a'],
899-
a: ['a', 'b', 'c', 'a'],
900-
b: [7, 3, 2, 7],
901-
y: [7, 3, 2, 7],
902-
z: [7, 3, 2, 7],
896+
x: cat,
897+
a: cat,
898+
b: data,
899+
y: data,
900+
z: data,
903901
// For OHLC
904-
open: [7, 3, 2, 7],
905-
close: [7, 3, 2, 7],
906-
high: [7, 3, 2, 7],
907-
low: [7, 3, 2, 7]
902+
open: data,
903+
close: data,
904+
high: data,
905+
low: data
908906
}],
909907
layout: {
910908
xaxis: {
911909
type: 'category',
912910
categoryorder: 'value ascending'
913911
}
914912
}
913+
})
914+
.then(function(gd) {
915+
expect(gd._fullLayout.xaxis._categories).toEqual(['b', 'c', 'a']);
915916
});
916917
}
917918
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.