Skip to content
Snippets Groups Projects
Select Git revision
  • a36796ffaacb936f9589cfb81233452565896615
  • master default protected
  • 1.31
  • 4.28.0
  • 4.27.0
  • 4.26.0
  • 4.25.5
  • 4.25.4
  • 4.25.3
  • 4.25.2
  • 4.25.1
  • 4.25.0
  • 4.24.3
  • 4.24.2
  • 4.24.1
  • 4.24.0
  • 4.23.6
  • 4.23.5
  • 4.23.4
  • 4.23.3
  • 4.23.2
  • 4.23.1
  • 4.23.0
23 results

Monster.Data.html

Blame
  • customelement-initfromscripthost.mjs 4.77 KiB
    'use strict';
    
    import * as chai from 'chai';
    import {getDocument} from "../../../source/dom/util.mjs";
    import {chaiDom} from "../../util/chai-dom.mjs";
    import {initJSDOM} from "../../util/jsdom.mjs";
    
    
    let expect = chai.expect;
    chai.use(chaiDom);
    
    // let html1 = `
    //     <div id="scripthost">
    //     </div>
    //    
    //     <div>
    //     <
    // </div>
    // `;
    
    
    // defined in constants.mjs
    // const updaterSymbolKey = "@schukai/monster/dom/custom-element@@options-updater-link"
    // const updaterSymbolSymbol = Symbol.for(updaterSymbolKey);
    
    
    
    describe('DOM', function () {
    
        let CustomElement, registerCustomElement, TestComponent, document, TestComponent2,assignUpdaterToElement;
    
        describe('initFromScriptHost()', function () {
    
            const randomTagNumber = "monster-test"+Math.floor(Math.random() * 1000000);
            
            before(function (done) {
                initJSDOM().then(() => {
    
                    import("../../../source/dom/customelement.mjs").then((m) => {
    
                        try {
                            CustomElement = m['CustomElement'];
                            registerCustomElement = m['registerCustomElement'];
    
                            TestComponent2 = class extends CustomElement {
                                static getTag() {
                                    return randomTagNumber;
                                }
    
                                /**
                                 *
                                 * @return {Object}
                                 */
                                get defaults() {
    
                                    return Object.assign({}, super.defaults, {
                                        test: 0,
                                        templates: {
                                            main: '<h1></h1><article><p>test</p><div id="container"></div></article>'
                                        },
                                    })
                                }
    
                            }
    
                            registerCustomElement(TestComponent2)
    
                            document = getDocument();
                            done()
                        } catch (e) {