title: How to test DOM methods in embed js script library?
body: <p>I am working in a Javascript library to embed in the browser.</p>
  
  <p>The thing is that I was started the project from <a href="https://github.com/krasimir/webpack-library-starter" rel="nofollow noreferrer">https://github.com/krasimir/webpack-library-starter</a> and I would to test my library but I have a problem with the <code>DOM</code> because my proyect hasn't got html so, I don't know how I should to test the <code>DOM</code> methods.</p>
  
  <p>The library is to embed in to our clients websites, the idea is to make a embed script like google maps, analytics sdk, etc.</p>
  
  <p>I am using <code>chai</code> and <code>mocha</code> to test but maybe I should to change to <code>ava</code> or something like.</p>
  
  <p>I know that in React for example you have tools to simulate the <code>DOM</code> but it is in vanilla JS so... help please.</p>
  
  <p><strong>Example of my library class:</strong></p>
  
  <pre><code>export class MyClass {
    constructor(htmlElement) {
     this.clientWebsiteHTMLElement = htmlElement;
     this.addChild();
    }
  
    addChild() {
     let child = document.createElement('div');
     this.clientWebsiteHTMLElement.appendChild(child);
    }
  }
  </code></pre>
  
  <p><strong>Example of my-lib.js</strong></p>
  
  <pre><code>import { MyClass } from './my-class.js'
  
  
  if (window &amp;&amp; document) {
    (function (window, document){
      let container = document.getElementById('container');
      let myClass = new MyClass(container);
  
      window.myLib = myClass;
    })(window, document) 
  }
  </code></pre>
  
  <p><strong>Example of entry point (In to the client website, is not in the same project):</strong></p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;
     &lt;div id="container"&gt;&lt;/div&gt;
  
    &lt;script src="http://myserver.com/to/serve/embed/scripts/myLib-bundle.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;html&gt;
  </code></pre>
  
  <p>Really is more complex than this, but the solution are the same.</p>
  
  <p>How I can test that for example?</p>
  
  <p>Thanks! :D</p>