}
const hasFunction = value => isObject(value)
- && Object.keys(value).reduce((acc, key) => acc || isFunction(value[key]), false);
+ && Object.getOwnPropertyNames(value).reduce((acc, key) => acc || isFunction(value[key]), false);
function needContext(proxy, names) {
const {isScriptable, isIndexable} = _descriptors(proxy);
}
});
});
+
+ it('should support nested scriptable defaults', function() {
+ Chart.defaults.datasets.line.fill = {
+ value: (ctx) => ctx.type === 'dataset' ? 75 : 0
+ };
+ const chart = acquireChart({
+ type: 'line',
+ data: {
+ datasets: [{
+ data: [100, 120, 130],
+ }]
+ },
+ });
+
+ const controller = chart.getDatasetMeta(0).controller;
+ const opts = controller.resolveDatasetElementOptions();
+ expect(opts).toEqualOptions({
+ fill: {
+ value: 75
+ }
+ });
+ delete Chart.defaults.datasets.line.fill;
+ });
+
});
describe('_resolveAnimations', function() {