From: Evert Timberg Date: Thu, 1 Apr 2021 07:16:03 +0000 (-0400) Subject: Scriptable title plugin options (#8764) X-Git-Tag: v3.0.0-rc.7~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2c8402445148fc667f1d772d96384e0fb217625;p=thirdparty%2FChart.js.git Scriptable title plugin options (#8764) --- diff --git a/src/plugins/plugin.title.js b/src/plugins/plugin.title.js index 3872a12d7..ba1f4ff67 100644 --- a/src/plugins/plugin.title.js +++ b/src/plugins/plugin.title.js @@ -160,4 +160,9 @@ export default { defaultRoutes: { color: 'color' }, + + descriptors: { + _scriptable: true, + _indexable: false, + }, }; diff --git a/test/fixtures/plugin.title/scriptable-options.js b/test/fixtures/plugin.title/scriptable-options.js new file mode 100644 index 000000000..f961fe2af --- /dev/null +++ b/test/fixtures/plugin.title/scriptable-options.js @@ -0,0 +1,43 @@ +const data = []; +for (let x = 0; x < 3; x++) { + for (let y = 0; y < 3; y++) { + data.push({x, y}); + } +} + +module.exports = { + config: { + type: 'scatter', + data: { + datasets: [{ + data, + backgroundColor: 'red', + radius: 1, + hoverRadius: 0 + }], + }, + options: { + scales: { + x: {display: false}, + y: {display: false} + }, + plugins: { + legend: false, + title: { + display: true, + text: () => 'Title Text', + }, + filler: false, + tooltip: false + }, + }, + + }, + options: { + spriteText: true, + canvas: { + height: 400, + width: 400 + } + } +}; diff --git a/test/fixtures/plugin.title/scriptable-options.png b/test/fixtures/plugin.title/scriptable-options.png new file mode 100644 index 000000000..cf3ec7c65 Binary files /dev/null and b/test/fixtures/plugin.title/scriptable-options.png differ diff --git a/test/specs/plugin.title.tests.js b/test/specs/plugin.title.tests.js index fb9572380..7c1c25849 100644 --- a/test/specs/plugin.title.tests.js +++ b/test/specs/plugin.title.tests.js @@ -2,7 +2,9 @@ var Title = Chart.registry.getPlugin('title')._element; -describe('Title block tests', function() { +describe('Plugin.title', function() { + describe('auto', jasmine.fixture.specs('plugin.title')); + it('Should have the correct default config', function() { expect(Chart.defaults.plugins.title).toEqual({ align: 'center',