Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jnumainville committed Mar 5, 2025
1 parent d44370b commit 764c89f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/chart/src/FigureChartModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@ it('handles colors on bar charts properly', () => {
]);
});

it('updates the title correctly', () => {
const figure = chartTestUtils.makeFigure();
const model = new FigureChartModel(dh, figure);
const mockSubscribe = jest.fn();
model.subscribe(mockSubscribe);

model.setTitle('New Title');
expect(mockSubscribe).toHaveBeenCalledTimes(1);
expect(mockSubscribe).toHaveBeenCalledWith(
expect.objectContaining({
type: FigureChartModel.EVENT_LAYOUT_UPDATED,
})
);
});

describe('axis transform tests', () => {
it('handles log x-axis properly', () => {
const xAxis = chartTestUtils.makeAxis({
Expand Down
2 changes: 2 additions & 0 deletions packages/chart/src/FigureChartModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,8 @@ class FigureChartModel extends ChartModel {
ChartUtils.DEFAULT_TITLE_PADDING.t +
subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT * 0.5;
}

this.fireLayoutUpdated({ title: this.layout.title });
}

getPlotWidth(): number {
Expand Down

0 comments on commit 764c89f

Please sign in to comment.