"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
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 mdm_sdk_1 = require("@reltio/mdm-sdk");
var test_utils_1 = require("../test-utils");
var TableSkeleton_1 = require("./TableSkeleton");
describe('TableSkeleton tests', function () {
    var tableColumnsData = [
        {
            id: 'entity.label',
            label: 'Entity label',
            dataTypeDefinition: { type: mdm_sdk_1.DataTypes.TYPE_STRING }
        },
        {
            id: 'relation.label',
            label: 'Directional label',
            dataTypeDefinition: { type: mdm_sdk_1.DataTypes.TYPE_STRING }
        }
    ];
    var setUp = function (props) {
        if (props === void 0) { props = {}; }
        return (0, react_2.render)(react_1.default.createElement(TableSkeleton_1.TableSkeleton, __assign({ tableColumnsData: tableColumnsData }, props)));
    };
    it('should render table skeleton correctly', function () {
        setUp();
        tableColumnsData.forEach(function (column) {
            expect(react_2.screen.getByText(column.label)).toBeInTheDocument();
        });
    });
    it('should use passed custom rowRenderer', function () {
        var TestRowCellRenderer = function (props) {
            return react_1.default.createElement("div", { "data-reltio-id": "cell" }, "Cell-".concat(props.columnIndex));
        };
        var unmockTableSizing = (0, test_utils_1.mockBasicTableSizing)();
        setUp({ RowCellRenderer: TestRowCellRenderer });
        var cells = react_2.screen.getAllByTestId('cell');
        expect(cells).toHaveLength(tableColumnsData.length);
        cells.forEach(function (cell, index) {
            expect(cell).toHaveTextContent("Cell-".concat(index));
        });
        unmockTableSizing();
    });
    it('should use other passed props', function () {
        var container = setUp({ containerClassName: 'testClassname' }).container;
        expect(container.firstChild).toHaveClass('testClassname');
    });
});
