"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var helpers_1 = require("./helpers");
describe('helpers tests', function () {
    var reltioLayout = [{ id: 'testId_1', autosizing: true }, { id: 'testId_2', autosizing: false }, { id: 'testId_3' }];
    var reactLayout = [{ i: 'testId_1' }, { i: 'testId_2' }, { i: 'testId_3' }];
    it('copyPropsFromPreviousLayout tests', function () {
        var layout = (0, helpers_1.reactGridLayoutToReltioLayout)(reactLayout);
        expect((0, helpers_1.copyPropsFromPreviousLayout)(['autosizing'], layout, reltioLayout)).toEqual([
            { id: 'testId_1', autosizing: true },
            { id: 'testId_2', autosizing: false },
            { id: 'testId_3' }
        ]);
    });
    it('getReltioLayoutItemById', function () {
        expect((0, helpers_1.getReltioLayoutItemById)(reltioLayout, 'testId_1')).toEqual(reltioLayout[0]);
        expect((0, helpers_1.getReltioLayoutItemById)(reltioLayout, 'wrongId')).toBeUndefined();
    });
    it('calcHeight tests', function () {
        var options = {
            margin: [10, 10],
            rowHeight: 20
        };
        expect((0, helpers_1.calcHeight)(500, options)).toBe(17);
        expect((0, helpers_1.calcHeight)(0, options)).toBe(1);
    });
    it('calcLayoutItemsHeight', function () {
        var layout = [
            { id: 'testId_1', autosizing: true, height: 200 },
            { id: 'testId_2', autosizing: false, height: 200 },
            { id: 'testId_3', height: 200 },
            { id: 'testId_4', autosizing: true, height: 200 }
        ];
        var heightsMap = {
            testId_1: 100,
            testId_3: 500,
            testId_4: 500
        };
        expect((0, helpers_1.calcLayoutItemsHeight)(heightsMap, layout)).toEqual([
            { id: 'testId_1', autosizing: true, minHeight: 100, maxHeight: 100, height: 100 },
            { id: 'testId_2', autosizing: false, height: 200 },
            { id: 'testId_3', height: 200 },
            { id: 'testId_4', autosizing: true, minHeight: 500, maxHeight: 500, height: 500 }
        ]);
    });
});
