import React from 'react';
import { mount } from 'enzyme';
import { act } from 'react-dom/test-utils';
import EditDesignButton from './index';

document.createRange = function() {
    return {
        setStart: function() {},
        setEnd: function() {},
        commonAncestorContainer: document.createElement('div'),
    };
};

describe('Modules/Designer/Components/EditDesignButton', () => {
    it('the rendered component contains the custom-css-open-editor-button and custom-css-add-element-designer classes', async () => {
        let wrapper;
        await act(async () => {
            wrapper = mount(<EditDesignButton showCallToAction={true} />);
        });
        wrapper.update();
        expect(wrapper.find('button.custom-css-open-editor-button')).toHaveLength(1);
        expect(wrapper.find('div.custom-css-add-element-designer')).toHaveLength(1);
    });
});
