Skip to content

Commit dc7e99f

Browse files
committed
Add test case for ensuring clearance of the parcoords line layer once there's no renderable panel
1 parent 45baa74 commit dc7e99f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/jasmine/tests/parcoords_test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,36 @@ describe('parcoords', function() {
792792
});
793793
});
794794

795+
it('Calling `Plotly.restyle` with zero panels left should erase lines', function(done) {
796+
797+
var mockCopy = Lib.extendDeep({}, mock2);
798+
var gd = createGraphDiv();
799+
Plotly.plot(gd, mockCopy.data, mockCopy.layout);
800+
801+
function restyleDimension(key, dimIndex, setterValue) {
802+
var value = Lib.isArray(setterValue) ? setterValue[0] : setterValue;
803+
return function() {
804+
return Plotly.restyle(gd, 'dimensions[' + dimIndex + '].' + key, setterValue).then(function() {
805+
expect(gd.data[0].dimensions[dimIndex][key]).toEqual(value, 'for dimension attribute \'' + key + '\'');
806+
});
807+
};
808+
}
809+
810+
restyleDimension('values', 1, [[]])()
811+
.then(function() {
812+
d3.selectAll('.parcoords-lines').each(function(d) {
813+
var imageArray = d.lineLayer.readPixels(0, 0, d.model.canvasWidth, d.model.canvasHeight);
814+
var foundPixel = false;
815+
var i = 0;
816+
do {
817+
foundPixel = foundPixel || imageArray[i++] !== 0;
818+
} while(!foundPixel && i < imageArray.length);
819+
expect(foundPixel).toEqual(false);
820+
});
821+
done();
822+
});
823+
});
824+
795825
describe('Having two datasets', function() {
796826

797827
it('Two subsequent calls to Plotly.plot should create two parcoords rows', function(done) {

0 commit comments

Comments
 (0)