Skip to content

Commit

Permalink
Unit Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Drashti Modasara authored and Drashti Modasara committed Nov 30, 2023
1 parent 315256d commit 3ec930b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { getLibs } from '../../scripts/utils.js';

const miloLibs = getLibs('/libs');

// [headingSize, bodySize, detailSize, titlesize]
const typeSizes = ['xxl', 'xl', 'l', 'xs'];

Expand Down Expand Up @@ -70,6 +68,7 @@ function interactiveInit(el, decorateButtons, decorateBlockBg, createTag, loadSt
}

export default async function init(el) {
const miloLibs = getLibs('/libs');
const { decorateButtons, decorateBlockBg } = await import(`${miloLibs}/utils/decorate.js`);
const { createTag, loadStyle } = await import(`${miloLibs}/utils/utils.js`);
switch (true) {
Expand All @@ -89,7 +88,7 @@ export default async function init(el) {
break;
}
default:
await interactiveInit(el);
await interactiveInit(el, decorateButtons, decorateBlockBg, createTag, loadStyle);
break;
}
}
16 changes: 0 additions & 16 deletions test/features/genfill/genfill-interactive.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { readFile } from '@web/test-runner-commands';
import { expect } from '@esm-bundle/chai';
import sinon from 'sinon';

document.body.innerHTML = await readFile({ path: './mocks/genfill.html' });
const { setLibs } = await import('../../../creativecloud/scripts/utils.js');
Expand Down Expand Up @@ -30,19 +29,4 @@ describe('genfill variant of interactive marquee', () => {
expect(ent.querySelector('.enticement-text')).to.exist;
expect(ent.querySelector('.enticement-arrow')).to.exist;
});
it('should implement click functionality', () => {
const a = im.querySelector('.desktop-only a');
a.click();
expect(a.style.display).to.equal('none');
expect(a.nextElementSibling.style.display).to.equal('block');
});

it('should call the callback after a delay', async () => {
const a = im.querySelector('.desktop-only a');
const clock = await sinon.useFakeTimers();
clock.tick(1000);
expect(a.style.display).to.equal('none');
expect(a.nextElementSibling.style.display).to.equal('block');
clock.restore();
});
});

0 comments on commit 3ec930b

Please sign in to comment.