Skip to content

Commit 172e3e9

Browse files
committed
Test that bar opacity is considered for contrasting text color [2951]
- Test ensures a bar's color opacity is taken into account when calculating a contrasting inside text color.
1 parent e26bc50 commit 172e3e9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/jasmine/tests/bar_test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,24 @@ describe('A bar plot', function() {
10851085
.then(done);
10861086
});
10871087

1088+
it('should take bar fill opacities into account when calculating contrasting inside text colors', function(done) {
1089+
var trace = {
1090+
x: [5, 10],
1091+
y: [5, 15],
1092+
text: ['Giraffes', 'Zebras'],
1093+
type: 'bar',
1094+
textposition: 'inside',
1095+
marker: {
1096+
color: ['rgba(0, 0, 0, 0.2)', 'rgba(0, 0, 0, 0.8)']
1097+
}
1098+
};
1099+
1100+
Plotly.plot(gd, [trace])
1101+
.then(assertTextFontColors([DARK, LIGHT]))
1102+
.catch(failTest)
1103+
.then(done);
1104+
});
1105+
10881106
it('should use defined textfont.color for inside text instead of the contrasting default', function(done) {
10891107
var data = Lib.extendFlat({}, insideTextTestsTraceDef, { textfont: { color: '#09f' } });
10901108

0 commit comments

Comments
 (0)