Skip to content

Commit 1af1c90

Browse files
committed
add react tests for line.color and unselected.line.color
1 parent 73fc079 commit 1af1c90

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

test/jasmine/tests/parcoords_test.js

+68
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,74 @@ describe('parcoords Lifecycle methods', function() {
978978
.catch(failTest)
979979
.then(done);
980980
});
981+
982+
it('@gl unselected.line.color `Plotly.react` should change line.color and unselected.line.color', function(done) {
983+
var unselectedLayer = '.gl-canvas-context';
984+
var selectedLayer = '.gl-canvas-focus';
985+
986+
var list1 = [];
987+
var list2 = [];
988+
for(var i = 0; i <= 100; i++) {
989+
list1[i] = i;
990+
list2[i] = 100 - i;
991+
}
992+
993+
var fig = {
994+
data: [{
995+
type: 'parcoords',
996+
dimensions: [{
997+
constraintrange: [1, 10],
998+
values: list1
999+
}, {
1000+
values: list2
1001+
}],
1002+
line: {color: '#0F0'},
1003+
unselected: {line: {color: '#F00'}}
1004+
}],
1005+
layout: {
1006+
margin: {
1007+
t: 0,
1008+
b: 0,
1009+
l: 0,
1010+
r: 0
1011+
},
1012+
width: 300,
1013+
height: 200
1014+
}
1015+
};
1016+
1017+
var rgb;
1018+
1019+
Plotly.newPlot(gd, fig)
1020+
.then(function() {
1021+
rgb = getAvgPixelByChannel(unselectedLayer);
1022+
expect(rgb[0]).not.toBe(0, 'red');
1023+
expect(rgb[1]).toBe(0, 'no green');
1024+
expect(rgb[2]).toBe(0, 'no blue');
1025+
1026+
rgb = getAvgPixelByChannel(selectedLayer);
1027+
expect(rgb[0]).toBe(0, 'no red');
1028+
expect(rgb[1]).not.toBe(0, 'green');
1029+
expect(rgb[2]).toBe(0, 'no blue');
1030+
1031+
fig.data[0].line.color = '#FF0';
1032+
fig.data[0].unselected.line.color = '#00F';
1033+
return Plotly.react(gd, fig);
1034+
})
1035+
.then(function() {
1036+
rgb = getAvgPixelByChannel(selectedLayer);
1037+
expect(rgb[0]).not.toBe(0, 'red');
1038+
expect(rgb[1]).not.toBe(0, 'green');
1039+
expect(rgb[2]).toBe(0, 'no blue');
1040+
1041+
rgb = getAvgPixelByChannel(unselectedLayer);
1042+
expect(rgb[0]).toBe(0, 'no red');
1043+
expect(rgb[1]).toBe(0, 'no green');
1044+
expect(rgb[2]).not.toBe(0, 'blue');
1045+
})
1046+
.catch(failTest)
1047+
.then(done);
1048+
});
9811049
});
9821050

9831051
describe('parcoords basic use', function() {

0 commit comments

Comments
 (0)