Skip to content

Commit

Permalink
improve code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
yesil committed Oct 30, 2024
1 parent 71d34fb commit 05d6b03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions libs/features/mas/web-components/src/hydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ function createSpectrumButton(cta, strong, aemFragmentMapping, cardVariant) {

spectrumCta.addEventListener('click', (e) => {
if (e.target !== cta) {
/* c8 ignore next 3 */
e.stopPropagation();
cta.click();
}
Expand Down
5 changes: 3 additions & 2 deletions libs/features/mas/web-components/test/hydrate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ describe('processCTAs', async () => {

it('should handle link-style CTAs', async () => {
const fragment = {
ctas: '<a is="checkout-link" data-wcs-osi="abm" class="primary-link">Link Style</a>',
ctas: `<a is="checkout-link" data-wcs-osi="abm" class="primary-link">Link Style</a>
<a is="checkout-link" data-wcs-osi="abm">Link Style</a>`,
};

processCTAs(fragment, merchCard, aemFragmentMapping);
processCTAs(fragment, merchCard, aemFragmentMapping, 'ccd-suggested');

const footer = merchCard.append.firstCall.args[0];
const link = footer.firstChild;
Expand Down

0 comments on commit 05d6b03

Please sign in to comment.