import {initJSDOM} from "../../../util/jsdom.mjs";
import {getGlobal} from "../../../../source/types/global.mjs";
import * as chai from 'chai';
import {chaiDom} from "../../../util/chai-dom.mjs";


let expect = chai.expect;
chai.use(chaiDom);

const global = getGlobal();


describe('Overlay', function () {

    let host;
    let html1 = `
        <monster-overlay id="details1"></monster-overlay>
    `;

    before(function (done) {
        initJSDOM().then(() => {
            import("../../../../source/components/host/overlay.mjs").then((m) => {
                host = m['Details'];
                done()
            }).catch(e => done(e))

        });
    })

    beforeEach(() => {
        let mocks = document.getElementById('mocks');
        mocks.innerHTML = html1;
    });    

    afterEach(() => {
        let mocks = document.getElementById('mocks');
        mocks.innerHTML = "";
    })
    
    
    it('should run', function (done) {

        let mocks = document.getElementById('mocks');
        const formControl = document.createElement('monster-overlay');
        mocks.appendChild(formControl);

        setTimeout(() => {
            try {
                expect(document.getElementById('mocks')).contain.html(
                    ' <monster-overlay data-monster-objectlink="Symbol(@schukai/monster/dom/custom-element@@options-updater-link)"></monster-overlay>')
            } catch (e) {
                return done(e);
            }

            done();
        }, 0)

    });

});
