Skip to content

Commit

Permalink
[Release] Stage to Main (#3581)
Browse files Browse the repository at this point in the history
  • Loading branch information
milo-pr-merge[bot] authored Jan 30, 2025
2 parents 7097c97 + c12af33 commit 2d31710
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 8 deletions.
3 changes: 2 additions & 1 deletion libs/blocks/global-navigation/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ export const transformTemplateToMobile = async (popup, item, localnav = false) =
{{main-menu}}
</button>
`;
const brand = document.querySelector('.feds-brand')?.outerHTML;
// Get the outerHTML of the .feds-brand element or use a default empty <span> if it doesn't exist
const brand = document.querySelector('.feds-brand')?.outerHTML || '<span></span>';
const breadCrumbs = document.querySelector('.feds-breadcrumbs')?.outerHTML;
popup.innerHTML = `
<div class="top-bar">
Expand Down
13 changes: 13 additions & 0 deletions libs/blocks/merch/merch.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,19 @@ export async function buildCta(el, params) {
reopenModal(cta);
});
}

// Adding aria-label for checkout-link using productFamily and customerSegment as placeholder key.
if (!cta.getAttribute('aria-label')) {
cta.onceSettled().finally(async () => {
const productFamily = cta.value[0]?.productArrangement?.productFamily;
const marketSegment = cta.value[0]?.marketSegments[0];
const customerSegment = marketSegment === 'EDU' ? marketSegment : cta.value[0]?.customerSegment;
let ariaLabel = cta.textContent;
ariaLabel = productFamily ? `${ariaLabel} - ${await replaceKey(productFamily, getConfig())}` : ariaLabel;
ariaLabel = customerSegment ? `${ariaLabel} - ${await replaceKey(customerSegment, getConfig())}` : ariaLabel;
cta.setAttribute('aria-label', ariaLabel);
});
}
return cta;
}

Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function getPathModal(path, dialog) {
}

export async function getModal(details, custom) {
if (!(details?.path || custom)) return null;
if (!((details?.path && details?.id) || custom)) return null;
const { id } = details || custom;

dialogLoadingSet.add(id);
Expand Down
6 changes: 5 additions & 1 deletion libs/deps/mas/mas.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion libs/deps/mas/merch-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,11 @@ merch-card[variant='twp'] merch-offer-select {
line-height: var(--consonant-merch-card-body-xxs-line-height);
}
merch-card[variant="ccd-suggested"] [slot="price"] em {
font-size: var(--consonant-merch-card-body-xxs-font-size);
line-height: var(--consonant-merch-card-body-xxs-line-height);
}
.spectrum--darkest merch-card[variant="ccd-suggested"] {
--consonant-merch-card-background-color:rgb(30, 30, 30);
--consonant-merch-card-heading-xs-color:rgb(239, 239, 239);
Expand Down Expand Up @@ -1531,7 +1536,6 @@ merch-card[variant='twp'] merch-offer-select {
:host([variant='ccd-suggested']) ::slotted([slot='price']) {
font-size: var(--consonant-merch-card-body-xs-font-size);
line-height: var(--consonant-merch-card-body-xs-line-height);
min-width: fit-content;
}
:host([variant='ccd-suggested']) ::slotted([slot='cta']) {
Expand Down
6 changes: 5 additions & 1 deletion libs/features/mas/dist/mas.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions libs/features/mas/src/variants/ccd-suggested.css.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export const CSS = `
line-height: var(--consonant-merch-card-body-xxs-line-height);
}
merch-card[variant="ccd-suggested"] [slot="price"] em {
font-size: var(--consonant-merch-card-body-xxs-font-size);
line-height: var(--consonant-merch-card-body-xxs-line-height);
}
.spectrum--darkest merch-card[variant="ccd-suggested"] {
--consonant-merch-card-background-color:rgb(30, 30, 30);
--consonant-merch-card-heading-xs-color:rgb(239, 239, 239);
Expand Down
1 change: 0 additions & 1 deletion libs/features/mas/src/variants/ccd-suggested.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ export class CCDSuggested extends VariantLayout {
:host([variant='ccd-suggested']) ::slotted([slot='price']) {
font-size: var(--consonant-merch-card-body-xs-font-size);
line-height: var(--consonant-merch-card-body-xs-line-height);
min-width: fit-content;
}
:host([variant='ccd-suggested']) ::slotted([slot='cta']) {
Expand Down
2 changes: 1 addition & 1 deletion libs/img/icons/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 37 additions & 1 deletion test/blocks/gist/gist.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sinon from 'sinon';
import { readFile } from '@web/test-runner-commands';
import { expect } from '@esm-bundle/chai';
import { waitForElement } from '../../helpers/waitfor.js';
Expand All @@ -6,10 +7,45 @@ document.body.innerHTML = await readFile({ path: './mocks/body.html' });
const { default: init } = await import('../../../libs/blocks/gist/gist.js');

describe('adobetv autoblock', () => {
it('creates iframe video block', async () => {
let createElementStub;
let clock;
let originalCreateElement;

beforeEach(() => {
clock = sinon.useFakeTimers();
originalCreateElement = document.createElement;

createElementStub = sinon.stub(document, 'createElement').callsFake((tagName) => {
if (tagName !== 'script') {
return originalCreateElement.call(document, tagName);
}
const scriptMock = originalCreateElement.call(document, 'script');
Object.defineProperty(scriptMock, 'src', {
set: async (url) => {
const gistCb = url.match(/callback=([^&]+)/)?.[1];
if (!gistCb) return;

await clock.runAllAsync();
if (window[gistCb]) {
window[gistCb]({ div: '<div class="gist-data">Mock Gist Content</div>' });
}
},
});
return scriptMock;
});
});

afterEach(() => {
createElementStub.restore();
clock.restore();
});

it('creates gist block with mocked data', async () => {
const gistLink = document.body.querySelector('a');
init(gistLink);
await clock.runAllAsync();
const div = await waitForElement('div.gist-data');
expect(div).to.exist;
expect(div.innerHTML).to.contain('Mock Gist Content');
});
});

0 comments on commit 2d31710

Please sign in to comment.