import mocha from 'mocha';
import chai from 'chai';
import { getNode } from './node';
import Iconify from '@iconify/iconify/lib/iconify';
const expect = chai.expect;
const selector =
'span.iconify, i.iconify, span.iconify-inline, i.iconify-inline';
const node1 = getNode('iconify-basic');
const node2 = getNode('iconify-basic');
// Set root node
Iconify.setRoot(node1);
describe('Testing Iconify object', () => {
const prefix = 'invalid-' + Date.now();
// Add mentioned icons to storage
Iconify.addCollection({
prefix,
icons: {
'account-box': {
body:
'
Testing Iconify without API
' + ' ' + ' ' + ' ' + ' ' + ' ' + 'This node should not be replaced
' + ''; // Icons should not have been replaced yet let list = node1.querySelectorAll(selector); expect(list.length).to.be.equal(5); list = node2.querySelectorAll(selector); expect(list.length).to.be.equal(1); // Check in ticks setTimeout(() => { setTimeout(() => { list = node1.querySelectorAll(selector); expect(list.length).to.be.equal(0); list = node2.querySelectorAll(selector); expect(list.length).to.be.equal(1); // Test SVG with ID const idTest = node1.querySelector('#ssvg-id-1st-place-medala'); expect(idTest).to.be.equal(null, 'Expecting ID to be replaced'); done(); }); }); }); });