Skip to content

Commit

Permalink
Expose zoomFunctions and panFunctions (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagix authored Apr 30, 2021
1 parent ca62548 commit b746091
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Hammer from 'hammerjs';
import {addListeners, computeDragRect, removeListeners} from './handlers';
import {startHammer, stopHammer} from './hammer';
import {doPan, doZoom, resetZoom} from './core';
import {panFunctions, zoomFunctions} from './scale.types';
import {getState, removeState} from './state';
import {version} from '../package.json';

Expand Down Expand Up @@ -83,5 +84,9 @@ export default {
stopHammer(chart);
}
removeState(chart);
}
},

panFunctions,

zoomFunctions
};
5 changes: 5 additions & 0 deletions test/specs/module.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ describe('module', function() {
expect(window.ChartZoom.id).toBe('zoom');
});

it ('should expose zoomFunctions and panFunctions', function() {
expect(window.ChartZoom.zoomFunctions instanceof Object).toBe(true);
expect(window.ChartZoom.panFunctions instanceof Object).toBe(true);
});

it ('should be globally registered', function() {
const plugin = Chart.registry.getPlugin('zoom');
expect(plugin).toBe(window.ChartZoom);
Expand Down

0 comments on commit b746091

Please sign in to comment.