Skip to content

Commit 7b0f718

Browse files
committed
add test for commit 86204a6 (ternary ax tickfont relayouts)
1 parent 17503cb commit 7b0f718

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/jasmine/tests/ternary_test.js

+33
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,39 @@ describe('ternary plots', function() {
338338
.then(done);
339339
});
340340

341+
it('should be able to relayout axis tickfont attributes', function(done) {
342+
var gd = createGraphDiv();
343+
var fig = Lib.extendDeep({}, require('@mocks/ternary_simple.json'));
344+
345+
function _assert(family, color, size) {
346+
var tick = d3.select('g.aaxis > g.ytick > text').node();
347+
348+
expect(tick.style['font-family']).toBe(family, 'font family');
349+
expect(parseFloat(tick.style['font-size'])).toBe(size, 'font size');
350+
expect(tick.style.fill).toBe(color, 'font color');
351+
}
352+
353+
Plotly.plot(gd, fig).then(function() {
354+
_assert('"Open Sans", verdana, arial, sans-serif', 'rgb(204, 204, 204)', 12);
355+
356+
return Plotly.relayout(gd, 'ternary.aaxis.tickfont.size', 5);
357+
})
358+
.then(function() {
359+
_assert('"Open Sans", verdana, arial, sans-serif', 'rgb(204, 204, 204)', 5);
360+
361+
return Plotly.relayout(gd, 'ternary.aaxis.tickfont', {
362+
family: 'Roboto',
363+
color: 'red',
364+
size: 20
365+
});
366+
})
367+
.then(function() {
368+
_assert('Roboto', 'rgb(255, 0, 0)', 20);
369+
})
370+
.catch(fail)
371+
.then(done);
372+
});
373+
341374
function countTernarySubplot() {
342375
return d3.selectAll('.ternary').size();
343376
}

0 commit comments

Comments
 (0)