From 5a26c44009c6c1d295ea5837e75d67ecf9b539ab Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Mon, 27 Sep 2021 18:53:31 +0300 Subject: [PATCH] Update browser tests --- .../browser-tests/tests/10-fake-api-test.ts | 8 +- .../tests/20-renderer-v1-test.ts | 141 ++++++++++++------ .../tests/20-renderer-v2-test.ts | 141 ++++++++++++------ .../browser-tests/tests/20-scan-dom-test.ts | 1 - .../tests/21-observe-dom-test.ts | 12 +- .../tests/21-scan-dom-api-test.ts | 10 +- packages/browser-tests/tests/node.ts | 4 +- 7 files changed, 211 insertions(+), 106 deletions(-) diff --git a/packages/browser-tests/tests/10-fake-api-test.ts b/packages/browser-tests/tests/10-fake-api-test.ts index 80ce15b..e73a0e8 100644 --- a/packages/browser-tests/tests/10-fake-api-test.ts +++ b/packages/browser-tests/tests/10-fake-api-test.ts @@ -3,7 +3,7 @@ import chai from 'chai'; import { FakeData, setFakeData, prepareQuery, sendQuery } from './fake-api'; import { setAPIModule } from '@iconify/core/lib/api/modules'; -import { setAPIConfig } from '@iconify/core/lib/api/config'; +import { addAPIProvider } from '@iconify/core/lib/api/config'; import { loadIcons } from '@iconify/core/lib/api/icons'; const expect = chai.expect; @@ -40,7 +40,7 @@ describe('Testing fake API', () => { height: 24, }, }; - setAPIConfig(provider, { + addAPIProvider(provider, { resources: ['https://api1.local', 'https://api2.local'], }); setFakeData(provider, prefix, data); @@ -89,7 +89,7 @@ describe('Testing fake API', () => { height: 24, }, }; - setAPIConfig(provider, { + addAPIProvider(provider, { resources: ['https://api1.local', 'https://api2.local'], }); setFakeData(provider, prefix, data); @@ -147,7 +147,7 @@ describe('Testing fake API', () => { height: 24, }, }; - setAPIConfig(provider, { + addAPIProvider(provider, { resources: ['https://api1.local', 'https://api2.local'], rotate: 20, timeout: 100, diff --git a/packages/browser-tests/tests/20-renderer-v1-test.ts b/packages/browser-tests/tests/20-renderer-v1-test.ts index 77d4cd5..0968e13 100644 --- a/packages/browser-tests/tests/20-renderer-v1-test.ts +++ b/packages/browser-tests/tests/20-renderer-v1-test.ts @@ -11,9 +11,9 @@ import { finder as iconifyIconFinder } from '@iconify/iconify/lib/finders/iconif import { getStorage, addIconSet, - getIcon, + getIconFromStorage, } from '@iconify/core/lib/storage/storage'; -import { renderIcon } from '@iconify/iconify/lib/modules/render'; +import { renderIconInPlaceholder } from '@iconify/iconify/lib/modules/render'; import { stringToIcon } from '@iconify/utils/lib/icon/name'; import { IconifyElement } from '@iconify/iconify/lib/modules/element'; @@ -101,11 +101,11 @@ describe('Testing legacy renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -146,11 +146,15 @@ describe('Testing legacy renderer', () => { }); // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -190,11 +194,15 @@ describe('Testing legacy renderer', () => { }); // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -236,11 +244,15 @@ describe('Testing legacy renderer', () => { }); // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -278,11 +290,15 @@ describe('Testing legacy renderer', () => { }); // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -327,11 +343,15 @@ describe('Testing legacy renderer', () => { element.element.style.border = '1px solid green'; // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -398,11 +418,11 @@ describe('Testing legacy renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -452,10 +472,14 @@ describe('Testing legacy renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Test attributes, compare them with last SVG @@ -517,10 +541,14 @@ describe('Testing legacy renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Test changed attributes @@ -564,10 +592,14 @@ describe('Testing legacy renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Test changed attributes @@ -610,11 +642,11 @@ describe('Testing legacy renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -659,11 +691,11 @@ describe('Testing legacy renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -706,7 +738,7 @@ describe('Testing legacy renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); expect(iconData.body.indexOf('M6 17c0-2')).to.be.equal( -1, @@ -714,7 +746,7 @@ describe('Testing legacy renderer', () => { ); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -748,7 +780,7 @@ describe('Testing legacy renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Test icon body to make sure icon was changed @@ -757,7 +789,11 @@ describe('Testing legacy renderer', () => { 'Wrong icon body: ' + iconData.body ); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Test finder @@ -794,16 +830,16 @@ describe('Testing legacy renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData ) as IconifyElement; - let html = renderIcon( + let html = renderIconInPlaceholder( element, customisations, iconData, @@ -844,13 +880,22 @@ describe('Testing legacy renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); - html = renderIcon(element, customisations, iconData, true) as string; + html = renderIconInPlaceholder( + element, + customisations, + iconData, + true + ) as string; // Test icon body to make sure icon was changed expect(html.indexOf('transform="')).to.not.be.equal( @@ -892,11 +937,11 @@ describe('Testing legacy renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -934,10 +979,14 @@ describe('Testing legacy renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Check dimensions @@ -980,11 +1029,11 @@ describe('Testing legacy renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -1028,10 +1077,14 @@ describe('Testing legacy renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Check dimensions and alignment diff --git a/packages/browser-tests/tests/20-renderer-v2-test.ts b/packages/browser-tests/tests/20-renderer-v2-test.ts index 24d9272..89eb8ea 100644 --- a/packages/browser-tests/tests/20-renderer-v2-test.ts +++ b/packages/browser-tests/tests/20-renderer-v2-test.ts @@ -11,9 +11,9 @@ import { finder as iconifyIconFinder } from '@iconify/iconify/lib/finders/iconif import { getStorage, addIconSet, - getIcon, + getIconFromStorage, } from '@iconify/core/lib/storage/storage'; -import { renderIcon } from '@iconify/iconify/lib/modules/render'; +import { renderIconInPlaceholder } from '@iconify/iconify/lib/modules/render'; import { stringToIcon } from '@iconify/utils/lib/icon/name'; import { IconifyElement } from '@iconify/iconify/lib/modules/element'; @@ -101,11 +101,11 @@ describe('Testing renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -146,11 +146,15 @@ describe('Testing renderer', () => { }); // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -190,11 +194,15 @@ describe('Testing renderer', () => { }); // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -236,11 +244,15 @@ describe('Testing renderer', () => { }); // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -278,11 +290,15 @@ describe('Testing renderer', () => { }); // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -329,11 +345,15 @@ describe('Testing renderer', () => { element.element.style.border = '1px solid green'; // Get icon data - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; // Test SVG expect(svg.tagName.toUpperCase()).to.be.equal('SVG'); @@ -400,11 +420,11 @@ describe('Testing renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -456,10 +476,14 @@ describe('Testing renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Test attributes, compare them with last SVG @@ -521,10 +545,14 @@ describe('Testing renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Test changed attributes @@ -568,10 +596,14 @@ describe('Testing renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Test changed attributes @@ -614,11 +646,11 @@ describe('Testing renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -663,11 +695,11 @@ describe('Testing renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -710,7 +742,7 @@ describe('Testing renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); expect(iconData.body.indexOf('M6 17c0-2')).to.be.equal( -1, @@ -718,7 +750,7 @@ describe('Testing renderer', () => { ); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -752,7 +784,7 @@ describe('Testing renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Test icon body to make sure icon was changed @@ -761,7 +793,11 @@ describe('Testing renderer', () => { 'Wrong icon body: ' + iconData.body ); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Test finder @@ -798,16 +834,16 @@ describe('Testing renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData ) as IconifyElement; - let html = renderIcon( + let html = renderIconInPlaceholder( element, customisations, iconData, @@ -848,13 +884,22 @@ describe('Testing renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); - html = renderIcon(element, customisations, iconData, true) as string; + html = renderIconInPlaceholder( + element, + customisations, + iconData, + true + ) as string; // Test icon body to make sure icon was changed expect(html.indexOf('transform="')).to.not.be.equal( @@ -896,11 +941,11 @@ describe('Testing renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -938,10 +983,14 @@ describe('Testing renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Check dimensions @@ -984,11 +1033,11 @@ describe('Testing renderer', () => { }); // Get icon data - let iconData = getIcon(storage, element.name.name); + let iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); // Render icon - let svg = renderIcon( + let svg = renderIconInPlaceholder( element, customisations, iconData @@ -1032,10 +1081,14 @@ describe('Testing renderer', () => { }); // Get icon data and render SVG - iconData = getIcon(storage, element.name.name); + iconData = getIconFromStorage(storage, element.name.name); expect(iconData).to.not.be.equal(null); - svg = renderIcon(element, customisations, iconData) as IconifyElement; + svg = renderIconInPlaceholder( + element, + customisations, + iconData + ) as IconifyElement; expect(svg).to.not.be.eql(lastSVG); // Check dimensions and alignment diff --git a/packages/browser-tests/tests/20-scan-dom-test.ts b/packages/browser-tests/tests/20-scan-dom-test.ts index 7e93d52..cdc5f97 100644 --- a/packages/browser-tests/tests/20-scan-dom-test.ts +++ b/packages/browser-tests/tests/20-scan-dom-test.ts @@ -8,7 +8,6 @@ import { finder as iconifyIconFinder } from '@iconify/iconify/lib/finders/iconif import { getStorage, addIconSet } from '@iconify/core/lib/storage/storage'; import { listRootNodes } from '@iconify/iconify/lib/modules/root'; import { scanDOM, scanElement } from '@iconify/iconify/lib/modules/scanner'; -import { removeObservedNode } from '@iconify/iconify/lib/modules/observer'; const expect = chai.expect; diff --git a/packages/browser-tests/tests/21-observe-dom-test.ts b/packages/browser-tests/tests/21-observe-dom-test.ts index 481f92d..920993b 100644 --- a/packages/browser-tests/tests/21-observe-dom-test.ts +++ b/packages/browser-tests/tests/21-observe-dom-test.ts @@ -10,8 +10,8 @@ import { listRootNodes } from '@iconify/iconify/lib/modules/root'; import { scanDOM } from '@iconify/iconify/lib/modules/scanner'; import { initObserver, - observeNode, - removeObservedNode, + observe, + stopObserving, } from '@iconify/iconify/lib/modules/observer'; const expect = chai.expect; @@ -141,7 +141,7 @@ describe('Observe DOM', () => { expect(nodes[0].temporary).to.be.equal(false); // Observe another node - observeNode(node); + observe(node); nodes = listRootNodes(); expect(nodes.length).to.be.equal(2); @@ -200,7 +200,7 @@ describe('Observe DOM', () => { ''; // Observe node: should run scan on next tick - observeNode(node); + observe(node); // Test nodes setTimeout(() => { @@ -236,7 +236,7 @@ describe('Observe DOM', () => { expect(nodes[0].temporary).to.be.equal(false); // Observe another node - observeNode(node); + observe(node); nodes = listRootNodes(); expect(nodes.length).to.be.equal(2); @@ -246,7 +246,7 @@ describe('Observe DOM', () => { expect(nodes[1].temporary).to.be.equal(false); // Stop observing baseNode - removeObservedNode(baseNode); + stopObserving(baseNode); nodes = listRootNodes(); expect(nodes.length).to.be.equal(1); diff --git a/packages/browser-tests/tests/21-scan-dom-api-test.ts b/packages/browser-tests/tests/21-scan-dom-api-test.ts index b404f98..b0004bd 100644 --- a/packages/browser-tests/tests/21-scan-dom-api-test.ts +++ b/packages/browser-tests/tests/21-scan-dom-api-test.ts @@ -5,7 +5,7 @@ import { getNode, setRoot } from './node'; import { addFinder } from '@iconify/iconify/lib/modules/finder'; import { FakeData, setFakeData, prepareQuery, sendQuery } from './fake-api'; import { setAPIModule } from '@iconify/core/lib/api/modules'; -import { setAPIConfig } from '@iconify/core/lib/api/config'; +import { addAPIProvider } from '@iconify/core/lib/api/config'; import { finder as iconifyFinder } from '@iconify/iconify/lib/finders/iconify'; import { finder as iconifyIconFinder } from '@iconify/iconify/lib/finders/iconify-icon'; import { listRootNodes } from '@iconify/iconify/lib/modules/root'; @@ -37,7 +37,7 @@ describe('Scanning DOM with API', () => { const prefix2 = nextPrefix(); // Set fake API hosts to make test reliable - setAPIConfig(provider, { + addAPIProvider(provider, { resources: ['https://api1.local', 'https://api2.local'], }); @@ -146,7 +146,7 @@ describe('Scanning DOM with API', () => { const prefix2 = nextPrefix(); // Set fake API hosts to make test reliable - setAPIConfig(provider, { + addAPIProvider(provider, { resources: ['https://api1.local', 'https://api2.local'], }); @@ -295,7 +295,7 @@ describe('Scanning DOM with API', () => { const prefix2 = nextPrefix(); // Set fake API hosts to make test reliable - setAPIConfig(provider, { + addAPIProvider(provider, { resources: ['https://api1.local', 'https://api2.local'], }); @@ -396,7 +396,7 @@ describe('Scanning DOM with API', () => { const prefix = nextPrefix(); // Set fake API hosts to make test reliable - setAPIConfig(provider, { + addAPIProvider(provider, { resources: ['https://api1.local', 'https://api2.local'], }); diff --git a/packages/browser-tests/tests/node.ts b/packages/browser-tests/tests/node.ts index ca828b2..775a55c 100644 --- a/packages/browser-tests/tests/node.ts +++ b/packages/browser-tests/tests/node.ts @@ -1,5 +1,5 @@ import { addRootNode, listRootNodes } from '@iconify/iconify/lib/modules/root'; -import { removeObservedNode } from '@iconify/iconify/lib/modules/observer'; +import { stopObserving } from '@iconify/iconify/lib/modules/observer'; import { ObservedNode } from '@iconify/iconify/lib/modules/observed-node'; let counter = 0; @@ -23,7 +23,7 @@ export function getNode(prefix = 'test') { export function setRoot(node: HTMLElement): ObservedNode { listRootNodes().forEach((node) => { if (typeof node.node !== 'function') { - removeObservedNode(node.node); + stopObserving(node.node); } }); return addRootNode(node);