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 #2842

Merged
merged 8 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
46 changes: 46 additions & 0 deletions .github/workflows/run-mas-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: MAS Unit Tests
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
run-tests:
name: Running tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install npm dependencies
run: npm install
working-directory: libs/features/mas

- name: Run npm test
run: npm test
working-directory: libs/features/mas

- name: Upload commerce coverage to Codecov
uses: codecov/codecov-action@v4
with:
name: mas-commerce
token: ${{ secrets.CODECOV_TOKEN }}
files: libs/features/mas/commerce/coverage/lcov.info

- name: Upload web-components coverage to Codecov
uses: codecov/codecov-action@v4
with:
name: mas-web-components
token: ${{ secrets.CODECOV_TOKEN }}
files: libs/features/mas/web-components/coverage/lcov.info
1 change: 1 addition & 0 deletions libs/blocks/aside/aside.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function addCloseButton(el) {
el.querySelector('.foreground').appendChild(closeBtn);
closeBtn.addEventListener('click', (e) => {
e.target.closest('.section').classList.add('close-sticky-section');
document.dispatchEvent(new CustomEvent('milo:sticky:closed'));
});
}

Expand Down
38 changes: 37 additions & 1 deletion libs/blocks/editorial-card/editorial-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
margin-top: auto;
}

.editorial-card .vp-media .tablet-only,
.editorial-card .vp-media .desktop-only {
display: none;
}

.editorial-card .card-footer > div {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -142,11 +147,22 @@
height: 100%;
}

.editorial-card .background .milo-video,
.editorial-card .background .milo-iframe {
height: 100%;
padding-bottom: 0;
}

.editorial-card .lockup-area,
.editorial-card .device {
margin: 0;
}

.editorial-card .device {
font-size: var(--type-body-xxs-size);
line-height: var(--type-body-xxs-lh);
}

.editorial-card .lockup-area {
row-gap: var(--spacing-xxs);
}
Expand All @@ -173,7 +189,6 @@
justify-content: center;
}


.editorial-card hr {
background-color: currentcolor;
border: none;
Expand Down Expand Up @@ -248,3 +263,24 @@

.editorial-card.footer-align-left .action-area { justify-content: start; }
.editorial-card.footer-align-center .action-area { justify-content: center; }


/* Tablet up */
@media screen and (min-width: 600px) {
.editorial-card .vp-media .mobile-only,
.editorial-card .vp-media .desktop-only {
display: none;
}

.editorial-card .vp-media .tablet-only { display: block; }
}

/* desktop up */
@media screen and (min-width: 1200px) {
.editorial-card .vp-media .mobile-only,
.editorial-card .vp-media .tablet-only {
display: none;
}

.editorial-card .vp-media .desktop-only { display: block; }
}
20 changes: 11 additions & 9 deletions libs/blocks/editorial-card/editorial-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ async function decorateLockupFromContent(el) {
const extendDeviceContent = (el) => {
const detail = el.querySelector('[class^="detail-"]');
const prevElem = detail?.previousElementSibling;
if (!prevElem || ![...prevElem.classList].some((c) => c.startsWith('body-'))) return;
prevElem.classList.remove('body-m');
prevElem.classList.add('body-xxs', 'device');
if (!prevElem) return;
const elBodyClass = [...prevElem.classList].find((c) => c.startsWith('body-'));
prevElem.classList.remove(elBodyClass);
prevElem.classList.add('device');
};

const decorateMedia = (el, media) => {
Expand All @@ -37,14 +38,14 @@ const decorateMedia = (el, media) => {
if (mediaVideo) {
applyHoverPlay(mediaVideo);
}
if (media.children.length > 1) decorateBlockBg(el, media);
if (media.children.length > 1) decorateBlockBg(el, media, { className: 'vp-media' });
};

const decorateForeground = async (el, rows) => {
rows.forEach(async (row, i) => {
rows.forEach((row, i) => {
if (i === 0) {
row.classList.add('foreground');
await decorateLockupFromContent(row);
decorateLockupFromContent(row);
} else if (i === (rows.length - 1)) {
row.classList.add('card-footer');
if (!row.textContent.trim()) row.classList.add('empty');
Expand All @@ -57,12 +58,13 @@ const decorateForeground = async (el, rows) => {
};

const decorateBgRow = (el, background) => {
if (background.textContent.trim() === '') {
decorateBlockBg(el, background);
const rows = background.querySelectorAll(':scope > div');
const bgRowsEmpty = [...rows].every((row) => row.innerHTML.trim() === '');
if (bgRowsEmpty) {
el.classList.add('no-bg');
background.remove();
return;
}
decorateBlockBg(el, background);
};

function handleClickableCard(el) {
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/hero-marquee/hero-marquee.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export default async function init(el) {
: null;
if (assetUnknown) assetUnknown.classList.add('asset-unknown');

decorateBlockText(copy, textDefault);
decorateBlockText(copy, textDefault, 'hasDetailHeading');
await decorateLockupFromContent(copy);
extendButtonsClass(copy);

Expand Down
7 changes: 6 additions & 1 deletion libs/blocks/notification/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ function wrapCopy(foreground) {

function decorateClose(el) {
const btn = createTag('button', { 'aria-label': 'close', class: 'close' }, closeSvg);
btn.addEventListener('click', () => (el.style.display = 'none'));
btn.addEventListener('click', () => {
el.style.display = 'none';
el.closest('.section')?.classList.add('close-sticky-section');
document.dispatchEvent(new CustomEvent('milo:sticky:closed'));
});

el.appendChild(btn);
}

Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/section-metadata/section-metadata.css
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@

.section.sticky-bottom.promo-sticky-section {
background: none;
z-index: 4;
z-index: 40000;
}

.section.sticky-bottom.popup {
Expand Down
8 changes: 8 additions & 0 deletions libs/blocks/table/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -705,4 +705,12 @@ header.global-navigation {
flex-direction: column;
align-items: initial;
}

.table :is(.heading-button,.action-area) {
max-width: 100%;
}

.table .action-area .con-button.button-l {
overflow: hidden;
}
}
4 changes: 3 additions & 1 deletion libs/blocks/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@ export default function init(el) {
expandSection = handleSection(sectionParams);
});

const isStickyHeader = el.classList.contains('sticky');
const isStickyHeader = el.classList.contains('sticky')
|| (el.classList.contains('sticky-desktop-up') && defineDeviceByScreenSize() === 'DESKTOP')
|| (el.classList.contains('sticky-tablet-up') && defineDeviceByScreenSize() !== 'MOBILE');

handleHighlight(el);
if (isMerch) formatMerchTable(el);
Expand Down
1 change: 0 additions & 1 deletion libs/blocks/text/text.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
position: absolute;
right: 0;
top: 0;
z-index: -1;
overflow: hidden;
}

Expand Down
5 changes: 2 additions & 3 deletions libs/deps/mas/commerce.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.

Large diffs are not rendered by default.

1,727 changes: 1,724 additions & 3 deletions 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.

Large diffs are not rendered by default.

Loading
Loading