Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Drop support for passing a string to the title attribute, and drop support for deprecated attributes titlefont, titleposition, titleside, and titleoffset #7212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 9, 2024
Prev Previous commit
Next Next commit
update jasmine tests
  • Loading branch information
emilykl committed Oct 4, 2024
commit d1a5f09052d95a98bbb7c1f026db60adc350df10
4 changes: 2 additions & 2 deletions 4 test/jasmine/bundle_tests/mathjax_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ describe('Test MathJax v' + mathjaxVersion + ':', function() {

return Plotly.newPlot(gd, fig)
.then(function() { assertNoIntersect('base'); })
.then(function() { return Plotly.relayout(gd, 'xaxis.titlefont.size', 40); })
.then(function() { return Plotly.relayout(gd, 'xaxis.title.font.size', 40); })
.then(function() { assertNoIntersect('large title font size'); })
.then(function() { return Plotly.relayout(gd, 'xaxis.titlefont.size', null); })
.then(function() { return Plotly.relayout(gd, 'xaxis.title.font.size', null); })
.then(function() { assertNoIntersect('back to base'); })
.then(function() { return Plotly.relayout(gd, 'xaxis.tickfont.size', 40); })
.then(function() { assertNoIntersect('large title font size'); })
Expand Down
39 changes: 9 additions & 30 deletions 39 test/jasmine/tests/funnelarea_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,10 @@ describe('Funnelarea traces', function() {
};
}

it('shows title top center if titleposition is undefined', function(done) {
it('shows title top center if title.position is undefined', function(done) {
Plotly.newPlot(gd, [{
values: [2, 2, 2, 2],
title: { text: 'Test<BR>Title' },
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', font: { size: 12 } },
type: 'funnelarea',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -315,11 +312,7 @@ describe('Funnelarea traces', function() {
it('shows title top center', function(done) {
Plotly.newPlot(gd, [{
values: [1, 1, 1, 1, 2],
title: { text: 'Test<BR>Title' },
titleposition: 'top center',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'top center', font: { size: 12 } },
type: 'funnelarea',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -330,11 +323,7 @@ describe('Funnelarea traces', function() {
it('shows title top left', function(done) {
Plotly.newPlot(gd, [{
values: [3, 2, 1],
title: { text: 'Test<BR>Title' },
titleposition: 'top left',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'top center', font: { size: 12 } },
type: 'funnelarea',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -345,11 +334,7 @@ describe('Funnelarea traces', function() {
it('shows title top right', function(done) {
Plotly.newPlot(gd, [{
values: [4, 5, 6, 5],
title: { text: 'Test<BR>Title' },
titleposition: 'top right',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'top right', font: { size: 12 } },
type: 'funnelarea',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -360,11 +345,7 @@ describe('Funnelarea traces', function() {
it('correctly positions large title', function(done) {
Plotly.newPlot(gd, [{
values: [1, 3, 4, 1, 2],
title: { text: 'Test<BR>Title' },
titleposition: 'top center',
titlefont: {
size: 60
},
title: { text: 'Test<BR>Title', position: 'top center', size: 60 },
type: 'funnelarea',
textinfo: 'none'
}], {height: 300, width: 300})
Expand Down Expand Up @@ -591,18 +572,16 @@ describe('Funnelarea traces', function() {
Plotly.newPlot(gd, [{
type: 'funnelarea',
values: [1, 2, 3],
title: { text: 'yo' },
titlefont: {color: 'blue'},
titleposition: 'top left'
title: { text: 'yo', position: 'top left', font: { color: 'blue' } },
}])
.then(function() {
_assertTitle('base', 'yo', 'rgb(0, 0, 255)');
_verifyTitle(true, false, true, false, false);

return Plotly.restyle(gd, {
title: { text: 'oy' },
'titlefont.color': 'red',
titleposition: 'top right'
'title.font.color': 'red',
'title.position': 'top right'
});
})
.then(function() {
Expand Down
95 changes: 23 additions & 72 deletions 95 test/jasmine/tests/pie_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var customAssertions = require('../assets/custom_assertions');
var assertHoverLabelStyle = customAssertions.assertHoverLabelStyle;
var assertHoverLabelContent = customAssertions.assertHoverLabelContent;
var checkTextTemplate = require('../assets/check_texttemplate');
const { position } = require('../../../src/plots/cartesian/layout_attributes');
const { font } = require('../../../src/plots/layout_attributes');

var SLICES_SELECTOR = '.slice path';
var SLICES_TEXT_SELECTOR = '.pielayer text.slicetext';
Expand Down Expand Up @@ -329,11 +331,7 @@ describe('Pie traces', function() {
it('scales multiline title to fit in hole', function(done) {
Plotly.newPlot(gd, [{
values: [2, 2, 2, 2],
title: { text: 'Test<BR>Title' },
titleposition: 'middle center',
titlefont: {
size: 60
},
title: { text: 'Test<BR>Title', position: 'middle center', font: { size: 60 } },
hole: 0.1,
type: 'pie',
textinfo: 'none'
Expand Down Expand Up @@ -379,11 +377,7 @@ describe('Pie traces', function() {
it('shows title top center if hole is zero', function(done) {
Plotly.newPlot(gd, [{
values: [2, 2, 2, 2],
title: { text: 'Test<BR>Title' },
titleposition: 'middle center',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'middle center', font: { size: 12 } },
hole: 0,
type: 'pie',
textinfo: 'none'
Expand All @@ -392,13 +386,10 @@ describe('Pie traces', function() {
.then(done, done.fail);
});

it('shows title top center if titleposition is undefined and no hole', function(done) {
it('shows title top center if title.position is undefined and no hole', function(done) {
Plotly.newPlot(gd, [{
values: [2, 2, 2, 2],
title: { text: 'Test<BR>Title' },
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', font: { size: 12 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -409,11 +400,7 @@ describe('Pie traces', function() {
it('shows title top center', function(done) {
Plotly.newPlot(gd, [{
values: [1, 1, 1, 1, 2],
title: { text: 'Test<BR>Title' },
titleposition: 'top center',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'top center', font: { size: 12 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -424,11 +411,7 @@ describe('Pie traces', function() {
it('shows title top left', function(done) {
Plotly.newPlot(gd, [{
values: [3, 2, 1],
title: { text: 'Test<BR>Title' },
titleposition: 'top left',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'top left', font: { size: 12 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -439,11 +422,7 @@ describe('Pie traces', function() {
it('shows title top right', function(done) {
Plotly.newPlot(gd, [{
values: [4, 5, 6, 5],
title: { text: 'Test<BR>Title' },
titleposition: 'top right',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'top right', font: { size: 12 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -454,11 +433,7 @@ describe('Pie traces', function() {
it('shows title bottom left', function(done) {
Plotly.newPlot(gd, [{
values: [4, 5, 6, 5],
title: { text: 'Test<BR>Title' },
titleposition: 'bottom left',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'bottom left', font: { size: 12 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -469,11 +444,7 @@ describe('Pie traces', function() {
it('shows title bottom center', function(done) {
Plotly.newPlot(gd, [{
values: [4, 5, 6, 5],
title: { text: 'Test<BR>Title' },
titleposition: 'bottom center',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'bottom center', font: { size: 12 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -484,11 +455,7 @@ describe('Pie traces', function() {
it('shows title bottom right', function(done) {
Plotly.newPlot(gd, [{
values: [4, 5, 6, 5],
title: { text: 'Test<BR>Title' },
titleposition: 'bottom right',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'bottom right', font: { size: 12 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
Expand All @@ -499,34 +466,26 @@ describe('Pie traces', function() {
it('should be able to restyle title position', function(done) {
Plotly.newPlot(gd, [{
values: [3, 2, 1],
title: { text: 'Test<BR>Title' },
titleposition: 'top left',
titlefont: {
size: 12
},
title: { text: 'Test<BR>Title', position: 'top left', font: { size: 12 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
.then(_verifyTitle(true, false, true, false, false))
.then(function() { return Plotly.restyle(gd, 'titleposition', 'top right'); })
.then(function() { return Plotly.restyle(gd, 'title.position', 'top right'); })
.then(_verifyTitle(false, true, true, false, false))
.then(function() { return Plotly.restyle(gd, 'titleposition', 'bottom left'); })
.then(function() { return Plotly.restyle(gd, 'title.position', 'bottom left'); })
.then(_verifyTitle(true, false, false, true, false))
.then(function() { return Plotly.restyle(gd, 'titleposition', 'bottom center'); })
.then(function() { return Plotly.restyle(gd, 'title.position', 'bottom center'); })
.then(_verifyTitle(false, false, false, true, true))
.then(function() { return Plotly.restyle(gd, 'titleposition', 'bottom right'); })
.then(function() { return Plotly.restyle(gd, 'title.position', 'bottom right'); })
.then(_verifyTitle(false, true, false, true, false))
.then(done, done.fail);
});

it('does not intersect pulled slices', function(done) {
Plotly.newPlot(gd, [{
values: [2, 2, 2, 2],
title: { text: 'Test<BR>Title' },
titleposition: 'top center',
titlefont: {
size: 14
},
title: { text: 'Test<BR>Title', position: 'top center', font: { size: 14 } },
pull: [0.9, 0.9, 0.9, 0.9],
type: 'pie',
textinfo: 'none'
Expand All @@ -548,11 +507,7 @@ describe('Pie traces', function() {
it('correctly positions large title', function(done) {
Plotly.newPlot(gd, [{
values: [1, 3, 4, 1, 2],
title: { text: 'Test<BR>Title' },
titleposition: 'top center',
titlefont: {
size: 60
},
title: { text: 'Test<BR>Title', position: 'top center', font: { size: 60 } },
type: 'pie',
textinfo: 'none'
}], {height: 300, width: 300})
Expand Down Expand Up @@ -795,9 +750,7 @@ describe('Pie traces', function() {
Plotly.newPlot(gd, [{
type: 'pie',
values: [1, 2, 3],
title: { text: 'yo' },
titlefont: {color: 'blue'},
titleposition: 'top left'
title: { text: 'yo', font: {color: 'blue'}, position: 'top left' }
}])
.then(function() {
_assertTitle('base', 'yo', 'rgb(0, 0, 255)');
Expand Down Expand Up @@ -837,18 +790,16 @@ describe('Pie traces', function() {
Plotly.newPlot(gd, [{
type: 'pie',
values: [1, 2, 3],
title: { text: 'yo' },
titlefont: {color: 'blue'},
titleposition: 'top left'
title: { text: 'yo', font: { color: 'blue' }, position: 'top left' }
}])
.then(function() {
_assertTitle('base', 'yo', 'rgb(0, 0, 255)');
_verifyTitle(true, false, true, false, false);

return Plotly.restyle(gd, {
title: { text: 'oy' },
'titlefont.color': 'red',
titleposition: 'bottom right'
'title.font.color': 'red',
'title.position': 'bottom right'
});
})
.then(function() {
Expand Down
4 changes: 2 additions & 2 deletions 4 test/jasmine/tests/plot_api_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ describe('Test plot api', function() {
expect(eventData).toEqual({
title: { text: 'Plotly chart' },
'xaxis.title': 'X',
'xaxis.titlefont': {color: 'green'},
'xaxis.title.font': {color: 'green'},
'yaxis.title': 'Y',
'polar.radialaxis.title': 'Radial'
});
Expand All @@ -545,7 +545,7 @@ describe('Test plot api', function() {
return Plotly.relayout(gd, {
title: { text: 'Plotly chart' },
'xaxis.title': 'X',
'xaxis.titlefont': {color: 'green'},
'xaxis.title.font': {color: 'green'},
'yaxis.title': 'Y',
'polar.radialaxis.title': 'Radial'
});
Expand Down
2 changes: 1 addition & 1 deletion 2 test/jasmine/tests/polar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ describe('Test relayout on polar subplots:', function() {
})
.then(function() {
assertTitle('yo2', true);
return Plotly.relayout(gd, 'polar.radialaxis.titlefont.color', 'red');
return Plotly.relayout(gd, 'polar.radialaxis.title.font.color', 'red');
})
.then(function() {
assertTitle('yo2', false);
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.