"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var react_2 = require("@testing-library/react");
var CellRenderer_1 = require("./CellRenderer");
describe('CellRenderer tests', function () {
    var TestWrapper = function () { return react_1.default.createElement("div", { "data-reltio-id": 'test-value' }, "test value"); };
    var TestValue = react_1.default.createElement(TestWrapper, null);
    var testCollapseContext = {
        maxRowValuesCount: 3,
        toggleRowCollapse: jest.fn(),
        getIsRowCollapsible: jest.fn(),
        getIsRowCollapsed: jest.fn()
    };
    var testHeight = 40;
    var getRowHeight = function () { return testHeight; };
    var testHeightForSubRow = 30;
    var getHeightForSubRow = function () { return testHeightForSubRow; };
    var tableRowsData = [
        {
            data: {
                testColumnId: [
                    {
                        height: 45,
                        values: TestValue
                    }
                ]
            }
        }
    ];
    var columnsData = [
        {
            id: 'testColumnId',
            label: 'test column'
        }
    ];
    it('should render cell corectlry', function () {
        var _a;
        (0, react_2.render)(react_1.default.createElement(CellRenderer_1.CellRenderer, { columnId: 'testColumnId', rowIndex: 0, collapseContextValue: testCollapseContext, getRowHeight: getRowHeight, getHeightForSubRow: getHeightForSubRow, tableRowsData: tableRowsData, columnsData: columnsData }));
        var value = react_2.screen.getByTestId('test-value');
        expect(value).toHaveTextContent('test value');
        var subRowWrapper = value.parentElement;
        expect(subRowWrapper).toHaveStyle({ height: '30px' });
        var cellWrapper = (_a = subRowWrapper === null || subRowWrapper === void 0 ? void 0 : subRowWrapper.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
        expect(cellWrapper).toHaveStyle({ height: '40px' });
    });
    it('should return empty cell for empty tableRowsData', function () {
        (0, react_2.render)(react_1.default.createElement(CellRenderer_1.CellRenderer, { columnId: 'testColumnId', rowIndex: 0, collapseContextValue: testCollapseContext, getRowHeight: getRowHeight, getHeightForSubRow: getHeightForSubRow, tableRowsData: [], columnsData: columnsData, "data-reltio-id": "empty-cell" }));
        var value = react_2.screen.queryByTestId('test-value');
        expect(value).not.toBeInTheDocument();
        var cellWrapper = react_2.screen.getByTestId('empty-cell');
        expect(cellWrapper).toHaveStyle({ height: '40px' });
    });
});
