Skip to content

Commit 73fc079

Browse files
committed
add test for parcoords unselected.line.color and increase margins in similar tests
1 parent 9b4711b commit 73fc079

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
@@ -856,6 +856,12 @@ describe('parcoords Lifecycle methods', function() {
856856
}],
857857
line: {color: 'blue'}
858858
}], {
859+
margin: {
860+
t: 0,
861+
b: 0,
862+
l: 0,
863+
r: 0
864+
},
859865
width: 300,
860866
height: 200
861867
})
@@ -888,6 +894,12 @@ describe('parcoords Lifecycle methods', function() {
888894
}],
889895
line: {color: 'blue'}
890896
}], {
897+
margin: {
898+
t: 0,
899+
b: 0,
900+
l: 0,
901+
r: 0
902+
},
891903
width: 300,
892904
height: 200
893905
})
@@ -910,6 +922,62 @@ describe('parcoords Lifecycle methods', function() {
910922
.catch(failTest)
911923
.then(done);
912924
});
925+
926+
it('@gl unselected.line.color `Plotly.restyle` should change context layer line.color', function(done) {
927+
var testLayer = '.gl-canvas-context';
928+
929+
var list1 = [];
930+
var list2 = [];
931+
for(var i = 0; i <= 100; i++) {
932+
list1[i] = i;
933+
list2[i] = 100 - i;
934+
}
935+
936+
Plotly.plot(gd, [{
937+
type: 'parcoords',
938+
dimensions: [{
939+
constraintrange: [1, 10],
940+
values: list1
941+
}, {
942+
values: list2
943+
}],
944+
line: {color: '#0F0'},
945+
unselected: {line: {color: '#F00'}}
946+
}], {
947+
margin: {
948+
t: 0,
949+
b: 0,
950+
l: 0,
951+
r: 0
952+
},
953+
width: 300,
954+
height: 200
955+
})
956+
.then(function() {
957+
var rgb = getAvgPixelByChannel(testLayer);
958+
expect(rgb[0]).not.toBe(0, 'red');
959+
expect(rgb[1]).toBe(0, 'no green');
960+
expect(rgb[2]).toBe(0, 'no blue');
961+
962+
return Plotly.restyle(gd, 'unselected.line.color', '#00F');
963+
})
964+
.then(function() {
965+
var rgb = getAvgPixelByChannel(testLayer);
966+
expect(rgb[0]).toBe(0, 'no red');
967+
expect(rgb[1]).toBe(0, 'no green');
968+
expect(rgb[2]).not.toBe(0, 'blue');
969+
970+
return Plotly.restyle(gd, 'unselected.line.color', 'rgba(0,0,0,0)');
971+
})
972+
.then(function() {
973+
var rgb = getAvgPixelByChannel(testLayer);
974+
expect(rgb[0]).toBe(0, 'no red');
975+
expect(rgb[1]).toBe(0, 'no green');
976+
expect(rgb[2]).toBe(0, 'no blue');
977+
})
978+
.catch(failTest)
979+
.then(done);
980+
});
913981
});
914982

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

0 commit comments

Comments
 (0)