-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
Description
Description
The arguments passed in the global hooks are forwarded always in the same count. No matter how many of them were passed on. This creates a mess in the tests where each toHaveBeenCalled-kind matcher has to be filled with the missing arguments (undefined values). It's not convenient.
Some example of that odd creatures:
expect(onAfterValidate).toHaveBeenCalledWith(true, 10, undefined, undefined, undefined, undefined);or
let hookArguments = new Array(6).fill(void 0);
hookArguments[0] = [[0, 'foo', 'bar', 'foo2']];
hookArguments[1] = 'caller-custom-source';
expect(afterSetSourceDataAtCellSpy).toHaveBeenCalledWith(...hookArguments);Guilty lines:
- https://github.com/handsontable/handsontable/blob/master/src/pluginHooks.js#L2371
- https://github.com/handsontable/handsontable/blob/master/src/pluginHooks.js#L2399
Steps to reproduce
Demo
https://jsfiddle.net/handsoncode/8ffpsqt6/
Your environment
- Handsontable version: any
- Browser Name and version: -
- Operating System: -