"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 TableHeadCell_1 = require("./TableHeadCell");
var react_2 = require("@testing-library/react");
var test_utils_1 = require("../../../test-utils");
var defaultProps = {
    rowData: {
        id: 'attributes.FirstName',
        label: 'FirstName'
    },
    columnsData: [
        {
            id: 'column1',
            isDraggable: true
        }
    ]
};
var setUp = function (props) {
    if (props === void 0) { props = defaultProps; }
    return (0, react_2.render)(react_1.default.createElement(TableHeadCell_1.TableHeadCell, __assign({}, props)));
};
describe('TableHeadCell tests', function () {
    it('should render drag indicator correctly if isDraggable prop is true', function () {
        setUp(__assign(__assign({}, defaultProps), { isDraggable: true }));
        expect((0, test_utils_1.getMuiIconByName)('DragIndicator')).toBeInTheDocument();
    });
    it('should not render dragIndicator if isDraggable prop is false', function () {
        setUp();
        expect((0, test_utils_1.getMuiIconByName)('DragIndicator')).not.toBeInTheDocument();
    });
    it('should render headCellRenderer from rowData correctly', function () {
        var HeadCellRenderer = function (_a) {
            var label = _a.label;
            return react_1.default.createElement("div", null,
                "headCell-",
                label);
        };
        var rowData = {
            id: 'attributes.FirstName',
            label: 'FirstName',
            headCellRenderer: HeadCellRenderer
        };
        setUp(__assign(__assign({}, defaultProps), { rowData: rowData }));
        expect(react_2.screen.getByText("headCell-".concat(rowData.label))).toBeInTheDocument();
    });
    it('should render DefaultHeadCellRenderer if headCellRenderer is missing in rowData', function () {
        setUp();
        expect(react_2.screen.getByText(defaultProps.rowData.label)).toBeInTheDocument();
    });
});
