UNPKG

@vtex/styleguide

Version:

> VTEX Styleguide React components ([Docs](https://vtex.github.io/styleguide))

40 lines (34 loc) 960 B
"use strict"; var _reactHooks = require("@testing-library/react-hooks"); var _useTableProportion = require("../useTableProportion"); var _useTableProportion2 = _interopRequireDefault(_useTableProportion); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } describe('Table V2 @ hooks/useTableProportion spec', function () { var columns = [{ id: 'name' }, { id: 'location' }, { id: 'company' }]; var ratio = [2, 1, 1]; it('calculates widths correctly', function () { var _renderHook = (0, _reactHooks.renderHook)(function () { return (0, _useTableProportion2.default)({ columns: columns, ratio: ratio }); }), result = _renderHook.result; expect(result.current.sizedColumns).toEqual([{ id: 'name', width: '50%' }, { id: 'location', width: '25%' }, { id: 'company', width: '25%' }]); }); });