@integec/grid-tools
Version:
Integ Grid Tools
41 lines (33 loc) • 1.72 kB
JavaScript
;
var _clipboardUtils = require('./clipboard-utils');
it('should not fit if selection size matches data', function () {
var selection = { x1: 1, x2: 1, y1: 1, y2: 2 };
var data = [['a'], ['b']];
expect((0, _clipboardUtils.expandDataToSelection)(selection)(data)).toBe(data);
}); /* eslint-env jest */
it('should not fit selection size is 1:1', function () {
var selection = { x1: 1, x2: 1, y1: 1, y2: 1 };
var data = [['a'], ['b']];
expect((0, _clipboardUtils.expandDataToSelection)(selection)(data)).toBe(data);
});
it('should fit data to selection size', function () {
var selection = { x1: 1, x2: 1, y1: 1, y2: 2 };
var data = [['a'], ['b'], ['c']];
expect((0, _clipboardUtils.expandDataToSelection)(selection)(data)).toBe(data);
});
it('should fit repeat data to selection size when there are extra selected rows', function () {
var selection = { x1: 1, x2: 1, y1: 1, y2: 2 };
var data = [['a', 'b']];
expect((0, _clipboardUtils.expandDataToSelection)(selection)(data)).toEqual([['a', 'b'], ['a', 'b']]);
});
it('should fit repeat data to selection size when there are extra selected cols and rows', function () {
var selection = { x1: 1, x2: 3, y1: 1, y2: 2 };
var data = [['a', 'b']];
expect((0, _clipboardUtils.expandDataToSelection)(selection)(data)).toEqual([['a', 'b', 'a'], ['a', 'b', 'a']]);
});
it('should fit repeat data to selection size when there are extra selected cols and rows', function () {
var selection = { x1: 1, x2: 3, y1: 1, y2: 1 };
var data = [['a', 'b'], ['c', 'd']];
expect((0, _clipboardUtils.expandDataToSelection)(selection)(data)).toEqual([['a', 'b', 'a'], ['c', 'd', 'c']]);
});
//# sourceMappingURL=clipboard-utils.test.js.map