Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/blocks/floating-buttons/floating-buttons.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,36 @@ const { default: decorate } = imports[1];
const testBody = await readFile({ path: './mocks/body.html' });
const testBody2 = await readFile({ path: './mocks/body-paragraphed.html' });

function mockPricingPlans() {
window.pricingPlans = {};
document.querySelectorAll('a[href*="commerce.adobe.com"]').forEach((a) => {
window.pricingPlans[a.href] = {
url: a.href,
country: 'us',
language: 'en',
offerId: 'CFB1B7F391F77D02FE858C43C4A5C64F',
};
});
}

describe('Floating buttons', () => {
beforeEach(() => {
window.isTestEnv = true;
window.placeholders = {};
window.pricingPlans = {};
});

it('loading the static state correctly', async () => {
document.body.innerHTML = testBody;
mockPricingPlans();
const block = document.querySelector('.floating-buttons');
await decorate(block);
expect(block).to.exist;
});

it('knows what to do when authors accidentally stacked the links', async () => {
document.body.innerHTML = testBody2;
mockPricingPlans();
const block = document.querySelector('.floating-buttons');
await decorate(block);
expect(block.querySelector('.button-container')).to.not.exist;
Expand Down
Loading