Skip to content
Snippets Groups Projects
Select Git revision
  • ee0b7703010654f3a3a64064bef0172c15cc84f2
  • master default protected
  • 1.31
  • 4.29.1
  • 4.29.0
  • 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
23 results

link.mjs

Blame
  • link.mjs 2.46 KiB
    'use strict';
    
    import chai from "chai"
    import {Link} from "../../../../source/dom/resource/link.mjs";
    import {DataUrl} from "../../../../source/types/dataurl.mjs";
    import {ID} from "../../../../source/types/id.mjs";
    import {chaiDom} from "../../../util/chai-dom.mjs";
    import {cleanupDOMFromTesting, initMutationObserverForTesting} from "../../../util/cleanupdom.mjs";
    import {initJSDOM} from "../../../util/jsdom.mjs";
    
    let expect = chai.expect;
    
    chai.use(chaiDom);
    
    
    
    describe('Link', function () {
    
        before(function (done) {
            initJSDOM().then(() => {
                done()
            });
        });
    
        beforeEach(() => {
            initMutationObserverForTesting()
        })
    
        afterEach(() => {
            cleanupDOMFromTesting();
        })
    
        describe('Link()', function () {
            this.timeout(5000);
    
            it('connect().available()', function (done) {
    
                const link = new Link({
                    href: new DataUrl('', 'text/css').toString(),
                    rel: 'stylesheet'
                });
    
                link.connect().available().then(() => {
                    done()
                }).catch(e => done(e));
    
            })
        });
    
        describe('External Link', () => {
            this.timeout(5000);
    
            let id = new ID('link').toString();
            let link, url = 'https://alvine.io/main.min.css';
    
            beforeEach(() => {
    
                link = new Link({
                    href: url,
                    id: id,
                    rel: 'stylesheet'
                });
    
            });
    
            it('append and remove Link ', (done) => {
    
                expect(link.isConnected()).to.be.false;
    
                link.connect().available().then(() => {