From: Jukka Kurkela Date: Fri, 29 Oct 2021 11:32:12 +0000 (+0300) Subject: Remove scriptability from defaults.font types (#9794) X-Git-Tag: v3.6.1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1749e5791874eec524500dddfbb5db5bcc592c58;p=thirdparty%2FChart.js.git Remove scriptability from defaults.font types (#9794) * Remove scriptability from defaults.font types * Remove failing test --- diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 6e36c9ab4..550842f32 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -1417,7 +1417,7 @@ export interface CoreChartOptions extends ParsingOption * base font * @see Defaults.font */ - font: Scriptable, ScriptableContext>; + font: Partial; /** * Resizes the chart canvas when its container does (important note...). * @default true diff --git a/types/tests/defaults.ts b/types/tests/defaults.ts index d6dba5ad6..850eb059a 100644 --- a/types/tests/defaults.ts +++ b/types/tests/defaults.ts @@ -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 +}; diff --git a/types/tests/scriptable_core_chart_options.ts b/types/tests/scriptable_core_chart_options.ts index 8039f3c0d..2c81f592e 100644 --- a/types/tests/scriptable_core_chart_options.ts +++ b/types/tests/scriptable_core_chart_options.ts @@ -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' } } }; };