Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release] Stage to Main #3581

Merged
merged 6 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

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');
});
});
Loading