Skip to content

Commit

Permalink
Merge branch 'stage' into MWPW-157037-handover
Browse files Browse the repository at this point in the history
  • Loading branch information
Blainegunn authored Sep 30, 2024
2 parents a77dd6c + 07a5da4 commit d9cb250
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions acrobat/blocks/prompt-card/prompt-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@
flex: 1 0 0;
flex-direction: column;
justify-content: space-between;
padding: 20px 20px 24px;
padding: 16px 16px 24px;
transition-delay: 3s;
transition-property: border;
max-width: 276px;
}

.prompt-blade:hover {
box-shadow: 3px 6px 6px 0 rgba(0, 0, 0, .16)
box-shadow: 0 3px 6px rgba(0, 0, 0, 16%)
}

.prompt-blade:active {
Expand Down Expand Up @@ -153,7 +153,7 @@
font-style: normal;
font-weight: 400;
line-height: 150%;
padding: 2px 8px
padding: 2px 16px
}

.prompt-copy-btn:after {
Expand Down
2 changes: 1 addition & 1 deletion acrobat/blocks/prompt-card/prompt-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async function createBlocks(element, blockArray, templateCfg) {
}
element.remove();

if (templateCfg.rows && parentNode.classList.contains('section')) {
if (templateCfg?.rows && parentNode.classList.contains('section')) {
const resizeObserver = new ResizeObserver(() => {
const computedStyle = window.getComputedStyle(parentNode);
if (/^(\d+(\.\d+)?(px|fr|em|rem|%))( (\d+(\.\d+)?(px|fr|em|rem|%)))*$/.test(computedStyle.gridTemplateColumns)) {
Expand Down
7 changes: 2 additions & 5 deletions acrobat/blocks/verb-widget/verb-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export default async function init(element) {

button.addEventListener('click', () => {
verbAnalytics('filepicker:shown', VERB);
verbAnalytics('dropzone:choose-file-clicked', VERB);
initiatePrefetch(VERB);
});

Expand Down Expand Up @@ -191,7 +192,7 @@ export default async function init(element) {

window.addEventListener('unity:track-analytics', (e) => {
if (e.detail?.event === 'change') {
verbAnalytics('choose-file:open', VERB);
verbAnalytics('choose-file:open', VERB, e.detail?.data);
setUser();
}
// maybe new event name files-dropped?
Expand All @@ -200,10 +201,6 @@ export default async function init(element) {
setDraggingClass(widget, false);
setUser();
}
if (e.detail?.event === 'choose-file-clicked') {
verbAnalytics('dropzone:choose-file-clicked', VERB, e.detail?.data);
setUser();
}

if (e.detail?.event === 'uploading') {
verbAnalytics('job:uploading', VERB, e.detail?.data);
Expand Down
7 changes: 4 additions & 3 deletions test/scripts/scripts-preloads.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { expect } from '@esm-bundle/chai';
import { waitForElement } from '../helpers/waitfor.js';

describe('Test scripts.js configurable preloads', () => {
it('has preload metadata', async () => {
document.head.innerHTML = '<link rel="icon" href="data:,"><meta name="preloads" content="$MILOLIBS/blocks/marquee/marquee.js,$MILOLIBS/blocks/marquee/marquee.css,https://www.example.com/abc.js"/>';
document.body.innerHTML = '<main><div class="marquee"></main>';
await import('../../acrobat/scripts/scripts.js');
const js = document.querySelector('link[rel="preload"][href="https://main--milo--adobecom.hlx.page/libs/blocks/marquee/marquee.js"]');
const css = document.querySelector('link[rel="stylesheet"][href="https://main--milo--adobecom.hlx.page/libs/blocks/marquee/marquee.css"]');
const js = document.querySelector('link[rel="preload"][href="https://main--milo--adobecom.hlx.live/libs/blocks/marquee/marquee.js"]');
const css = document.querySelector('link[rel="stylesheet"][href="https://main--milo--adobecom.hlx.live/libs/blocks/marquee/marquee.css"]');
const other = document.querySelector('link[rel="preload"][href="https://www.example.com/abc.js"]');
const acrobatcss = document.querySelector('link[rel="stylesheet"][href="/acrobat/styles/styles.css"]');
const milocss = document.querySelector('link[rel="stylesheet"][href="https://main--milo--adobecom.hlx.page/libs/styles/styles.css"]');
const milocss = document.querySelector('link[rel="stylesheet"][href="https://main--milo--adobecom.hlx.live/libs/styles/styles.css"]');
expect(js).not.to.be.null;
expect(css).not.to.be.null;
expect(other).not.to.be.null;
Expand Down

0 comments on commit d9cb250

Please sign in to comment.