UNPKG

@integec/grid-tools

Version:
66 lines (64 loc) 1.82 kB
"use strict"; var _clipboardUtils = require("./clipboard-utils"); /* eslint-env jest */ 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); }); 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 2', 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