Skip to content

Commit

Permalink
[Release] Stage to Main (#2129)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blainegunn authored Apr 10, 2024
2 parents c058cea + 1f48cda commit 7d4f6c3
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 119 deletions.
6 changes: 5 additions & 1 deletion .hlxignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*.json
!*/**/*.json
.*
*.md
LICENSE
test/*
build/*
LICENSE
web-test-runner.config.mjs
codecov.yaml
105 changes: 0 additions & 105 deletions akamai/sureroute-test-object.html

This file was deleted.

6 changes: 4 additions & 2 deletions libs/blocks/article-header/article-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ export default async function init(blockEl) {

const categoryContainer = childrenEls[0];
const categoryEl = categoryContainer.firstElementChild.firstElementChild;
const categoryTag = getLinkForTopic(categoryEl.textContent);
categoryEl.innerHTML = categoryTag;
if (categoryEl?.textContent) {
const categoryTag = getLinkForTopic(categoryEl.textContent);
categoryEl.innerHTML = categoryTag;
}
categoryContainer.classList.add('article-category');

const titleContainer = childrenEls[1];
Expand Down
17 changes: 13 additions & 4 deletions libs/martech/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@ export function decorateDefaultLinkAnalytics(block, config) {
let header = '';
let linkCount = 1;

let headerSelector = 'h1, h2, h3, h4, h5, h6, .tracking-header';
const headers = block.querySelectorAll(headerSelector);
if (!headers.length) headerSelector = `${headerSelector}, b, strong`;
block.querySelectorAll(`${headerSelector}, a:not(.video.link-block), button`).forEach((item) => {
const headerSelector = 'h1, h2, h3, h4, h5, h6';
let analyticsSelector = `${headerSelector}, .tracking-header`;
const headers = block.querySelectorAll(analyticsSelector);
if (!headers.length) analyticsSelector = `${analyticsSelector}, b, strong`;
block.querySelectorAll(`${analyticsSelector}, a:not(.video.link-block), button`).forEach((item) => {
if (item.nodeName === 'A' || item.nodeName === 'BUTTON') {
if (item.classList.contains('tracking-header')) {
header = processTrackingLabels(item.textContent, config, 20);
} else if (!header) {
const section = block.closest('.section');
if (section?.className.includes('-up') || section?.classList.contains('milo-card-section')) {
const previousHeader = section?.previousElementSibling?.querySelector(headerSelector);
if (previousHeader) {
header = processTrackingLabels(previousHeader.textContent, config, 20);
}
}
}
if (item.hasAttribute('daa-ll')) {
const labelArray = item.getAttribute('daa-ll').split('-').map((part) => {
Expand Down
14 changes: 7 additions & 7 deletions libs/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,7 @@ function decorateHeader() {
header.remove();
return;
}
const headerQuery = new URLSearchParams(window.location.search).get('headerqa');
header.className = headerQuery || headerMeta || 'gnav';
header.className = headerMeta || 'gnav';
const metadataConfig = getMetadata('breadcrumbs')?.toLowerCase()
|| getConfig().breadcrumbs;
if (metadataConfig === 'off') return;
Expand Down Expand Up @@ -711,8 +710,7 @@ async function loadFooter() {
footer.remove();
return;
}
const footerQuery = new URLSearchParams(window.location.search).get('footerqa');
footer.className = footerQuery || footerMeta || 'footer';
footer.className = footerMeta || 'footer';
await loadBlock(footer);
}

Expand Down Expand Up @@ -795,7 +793,10 @@ export async function loadIms() {
},
onError: reject,
};
loadScript(`${base}/deps/imslib.min.js`);
const path = PAGE_URL.searchParams.get('useAlternateImsDomain')
? 'https://auth.services.adobe.com/imslib/imslib.min.js'
: `${base}/deps/imslib.min.js`;
loadScript(path);
}).then(() => {
if (!window.adobeIMS?.isSignedInUser()) {
getConfig().entitlements([]);
Expand Down Expand Up @@ -826,8 +827,7 @@ export async function loadMartech({ persEnabled = false, persManifests = [] } =
}

async function checkForPageMods() {
const search = new URLSearchParams(window.location.search);
const offFlag = (val) => search.get(val) === 'off';
const offFlag = (val) => PAGE_URL.searchParams.get(val) === 'off';
if (offFlag('mep')) return;
const persMd = getMetadata('personalization');
const promoMd = getMetadata('manifestnames');
Expand Down
8 changes: 8 additions & 0 deletions test/blocks/article-header/article-header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,11 @@ describe('test the invalid article header', () => {
expect(date.classList.contains('article-date-invalid')).to.be.false;
});
});

describe('article header', () => {
it('allows a blank category', async () => {
document.body.innerHTML = await readFile({ path: './mocks/body-without-category.html' });
await init(document.body.querySelector('.article-header'));
expect(document.body.querySelector('.article-category a')).to.be.null;
});
});
30 changes: 30 additions & 0 deletions test/blocks/article-header/mocks/body-without-category.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<div>
<div class="section">
<div class="article-header">
<div>
<div>
</div>
</div>
<div>
<div>
<h1 id="celebrating-a-special-milestone-10-things-you-might-not-know-about-adobes-40-years-of-innovation">
Celebrating a special milestone: 10 things you might not know about Adobe’s 40 years of innovation</h1>
</div>
</div>
<div>
<div>
<p><a href="/test/blocks/article-header/mocks/adobe-communication-team">Adobe Communications Team</a></p>
<p>12-05-2022</p>
</div>
</div>
<div>
<div>
<p>
<picture>
</picture>
</p>
</div>
</div>
</div>
</div>
</div>
3 changes: 3 additions & 0 deletions test/martech/attributes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ describe('Analytics', async () => {
section.querySelectorAll('a').forEach((link, idx) => {
expect(link.getAttribute('daa-ll')).to.equal(expectedLinkValues[idx]);
});

const cardLink = document.querySelector('.milo-card-section a');
expect(cardLink.getAttribute('daa-ll')).to.equal('Learn more AI for gr-1--Header for tiles bel');
});
it('should decorate pzn with attributes', async () => {
document.body.outerHTML = await readFile({ path: './mocks/body.html' });
Expand Down
36 changes: 36 additions & 0 deletions test/martech/mocks/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,42 @@ <h3>Second Traditional Header</h3>
</div>
</div>
</div>
<div class="section">
<div class="text center l-spacing-top m-spacing-bottom text-block con-block" daa-lh="b1|text">
<div class="foreground">
<div data-valign="middle" class="body-m">
<h3 id="header-for-tiles-below" class="heading-l">Header for tiles below</h3>
</div>
</div>
</div>
</div>
<div class="section m-spacing milo-card-section">
<div class="milo-card-wrapper consonant-Wrapper consonant-Wrapper--1200MaxWidth" data-block="true">
<div class="consonant-Wrapper-inner">
<div class="consonant-Wrapper-collection">
<div class="consonant-CardsGrid consonant-CardsGrid--4up consonant-CardsGrid--with4xGutter">
<div class="card half-height-card border" daa-lh="b1|card">
<a href="https://www.adobe.com/products/firefly/discover/ai-for-graphic-designers.html" class="consonant-Card consonant-HalfHeightCard" target="_blank">
Learn more
<div class="consonant-HalfHeightCard-img" style="background-image: url(http://localhost:6456/drafts/vgoodrich/fragments/2024/q2/analyticsusepreviousheader/media_14260d0c6803386bf153ff6e754fcdfe39982f3b8.png?width=750&amp;format=png&amp;optimize=medium)"></div>
<div class="consonant-HalfHeightCard-inner">
<div data-valign="middle">
<h3 id="ai-for-graphic-designers" class="consonant-HalfHeightCard-title">AI for graphic designers.</h3>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
<div class="section-metadata">
<div>
<div data-valign="middle">style</div>
<div data-valign="middle">Four up, M spacing</div>
</div>
</div>
</div>
</main>
</body>

0 comments on commit 7d4f6c3

Please sign in to comment.