"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 mdm_sdk_1 = require("@reltio/mdm-sdk");
var BooleanRadioEditor_1 = require("../BooleanRadioEditor");
var DateEditor_1 = require("../DateEditor");
var EditorsFactory_1 = require("./EditorsFactory");
var LookupEditor_1 = require("../LookupEditor");
var NumberEditor_1 = require("../NumberEditor");
var TextEditor_1 = require("../TextEditor");
var TimestampEditor_1 = require("../TimestampEditor");
var TypeaheadEditor_1 = require("../TypeaheadEditor");
var SelectEditor_1 = require("../SelectEditor");
describe('EditorsFactory', function () {
    it('should render string editor for non-specified type', function () {
        expect(EditorsFactory_1.EditorsFactory.build('Anything')).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, null));
    });
    it('should render TextEditor for "String" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_STRING)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, null));
    });
    it('should render multiline TextEditor for "Text" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_TEXT)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, { multiline: true, maxRows: 7, minRows: 2 }));
    });
    it('should render password TextEditor for "Password" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_PASSWORD)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, { type: 'password' }));
    });
    it('should render NumberEditor with integer option for "Long" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_LONG)).toEqual(react_1.default.createElement(NumberEditor_1.NumberEditor, { integer: true }));
    });
    it('should render NumberEditor with integer option for "Int" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_INT)).toEqual(react_1.default.createElement(NumberEditor_1.NumberEditor, { integer: true }));
    });
    it('should render NumberEditor for "Dollar" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_DOLLAR)).toEqual(react_1.default.createElement(NumberEditor_1.NumberEditor, null));
    });
    it('should render NumberEditor for "Float" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_FLOAT)).toEqual(react_1.default.createElement(NumberEditor_1.NumberEditor, null));
    });
    it('should render NumberEditor for "Double" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_DOUBLE)).toEqual(react_1.default.createElement(NumberEditor_1.NumberEditor, null));
    });
    it('should render NumberEditor for "Number" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_NUMBER)).toEqual(react_1.default.createElement(NumberEditor_1.NumberEditor, null));
    });
    it('should render BooleanEditor for "Boolean" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_BOOLEAN)).toEqual(react_1.default.createElement(BooleanRadioEditor_1.BooleanRadioEditor, null));
    });
    it('should render BooleanRadioEditor for "Boolean_Radio" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_BOOLEAN_RADIO)).toEqual(react_1.default.createElement(BooleanRadioEditor_1.BooleanRadioEditor, null));
    });
    it('should render DateEditor for "Date" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_DATE)).toEqual(react_1.default.createElement(DateEditor_1.DateEditor, { slotProps: { textField: undefined } }));
    });
    it('should render TimestampEditor for "Timestamp" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_TIMESTAMP)).toEqual(react_1.default.createElement(TimestampEditor_1.TimestampEditor, { slotProps: { textField: undefined } }));
    });
    it('should render multiline TextEditor for "Blob" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_BLOB)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, { multiline: true, maxRows: 7, minRows: 2 }));
    });
    it('should render SelectEditor for "Enum" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_ENUM)).toEqual(react_1.default.createElement(SelectEditor_1.SelectEditor, null));
    });
    it('should render TextEditor for "cik id" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_CIK_ID)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, null));
    });
    it('should render LookupEditor for "Lookup" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_LOOKUP)).toEqual(react_1.default.createElement(LookupEditor_1.LookupEditor, null));
    });
    it('should render TypeaheadEditor for "Typeahead" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_TYPEAHEAD)).toEqual(react_1.default.createElement(TypeaheadEditor_1.TypeaheadEditor, null));
    });
    it('should render TextEditor for "URL" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_URL)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, null));
    });
    it('should render TextEditor for "Blog URL" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_BLOG_URL)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, null));
    });
    it('should render TextEditor for "Image URL" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_IMAGE_URL)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, null));
    });
    it('should render TextEditor for "Email" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_EMAIL)).toEqual(react_1.default.createElement(TextEditor_1.TextEditor, { type: 'email' }));
    });
    it('should render SelectEditor for "Select" type', function () {
        expect(EditorsFactory_1.EditorsFactory.build(mdm_sdk_1.DataTypes.TYPE_SELECT)).toEqual(react_1.default.createElement(SelectEditor_1.SelectEditor, null));
    });
});
