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