Skip to content

Commit

Permalink
Remove scriptability from defaults.font types (#9794)
Browse files Browse the repository at this point in the history
* Remove scriptability from defaults.font types

* Remove failing test
  • Loading branch information
kurkle committed Oct 29, 2021
1 parent 10106e4 commit 1749e57
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion types/index.esm.d.ts
Expand Up @@ -1417,7 +1417,7 @@ export interface CoreChartOptions<TType extends ChartType> extends ParsingOption
* base font
* @see Defaults.font
*/
font: Scriptable<Partial<FontSpec>, ScriptableContext<TType>>;
font: Partial<FontSpec>;
/**
* Resizes the chart canvas when its container does (important note...).
* @default true
Expand Down
13 changes: 13 additions & 0 deletions types/tests/defaults.ts
Expand Up @@ -7,3 +7,16 @@ Chart.defaults.plugins.title.display = false;
Chart.defaults.datasets.bar.backgroundColor = 'red';

Chart.defaults.animation = { duration: 500 };

Chart.defaults.font.size = 8;

// @ts-expect-error should be number
Chart.defaults.font.size = '8';

// @ts-expect-error should be number
Chart.defaults.font.size = () => '10';

Chart.defaults.font = {
family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
size: 10
};
1 change: 0 additions & 1 deletion types/tests/scriptable_core_chart_options.ts
Expand Up @@ -8,7 +8,6 @@ const getConfig = (): ChartConfiguration<'bar'> => {
},
options: {
backgroundColor: (context) => context.active ? '#fff' : undefined,
font: (context) => context.datasetIndex === 1 ? { size: 10 } : { size: 12, family: 'arial' }
}
};
};
Expand Down

0 comments on commit 1749e57

Please sign in to comment.