Skip to content

Commit f698f6b

Browse files
committed
Add test to check for shape legend marker dashes
1 parent 2edd723 commit f698f6b

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

test/jasmine/tests/legend_test.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,4 +3159,56 @@ describe('legend with custom legendwidth', function () {
31593159
})
31603160
.then(done, done.fail);
31613161
});
3162+
3163+
// TODO: Update this test when releasing next major version which will remove the exception for shape traces
3164+
it('should apply marker.line.dash to scatter traces but use solid for shape traces', (done) => {
3165+
const data = [
3166+
{
3167+
type: 'scatter',
3168+
mode: 'markers',
3169+
x: [1, 2, 3],
3170+
y: [1, 2, 3],
3171+
marker: {
3172+
size: 10,
3173+
line: {
3174+
width: 2,
3175+
dash: 'dot',
3176+
color: 'blue'
3177+
}
3178+
}
3179+
}
3180+
];
3181+
3182+
const layout = {
3183+
showlegend: true,
3184+
shapes: [
3185+
{
3186+
showlegend: true,
3187+
type: 'circle',
3188+
xref: 'paper',
3189+
yref: 'paper',
3190+
x0: 0.1,
3191+
y0: 0.1,
3192+
x1: 0.2,
3193+
y1: 0.2,
3194+
line: {
3195+
width: 2,
3196+
dash: 'dot',
3197+
color: 'red'
3198+
},
3199+
fillcolor: 'rgba(255, 0, 0, 0.3)'
3200+
}
3201+
]
3202+
};
3203+
3204+
Plotly.newPlot(gd, data, layout)
3205+
.then(function () {
3206+
const legendItems = gd.querySelectorAll('.legendpoints path.scatterpts');
3207+
3208+
expect(legendItems.length).toBe(2);
3209+
expect(legendItems[0].style.strokeDasharray).not.toBe('');
3210+
expect(legendItems[1].style.strokeDasharray).toBe('');
3211+
})
3212+
.then(done, done.fail);
3213+
});
31623214
});

0 commit comments

Comments
 (0)