import React from 'react';
import { render, screen } from '@testing-library/react';
import { CellRenderer } from './CellRenderer';
describe('CellRenderer tests', function () {
    var TestWrapper = function () { return React.createElement("div", { "data-reltio-id": 'test-value' }, "test value"); };
    var TestValue = React.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;
        render(React.createElement(CellRenderer, { columnId: 'testColumnId', rowIndex: 0, collapseContextValue: testCollapseContext, getRowHeight: getRowHeight, getHeightForSubRow: getHeightForSubRow, tableRowsData: tableRowsData, columnsData: columnsData }));
        var value = 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 () {
        render(React.createElement(CellRenderer, { columnId: 'testColumnId', rowIndex: 0, collapseContextValue: testCollapseContext, getRowHeight: getRowHeight, getHeightForSubRow: getHeightForSubRow, tableRowsData: [], columnsData: columnsData, "data-reltio-id": "empty-cell" }));
        var value = screen.queryByTestId('test-value');
        expect(value).not.toBeInTheDocument();
        var cellWrapper = screen.getByTestId('empty-cell');
        expect(cellWrapper).toHaveStyle({ height: '40px' });
    });
});
