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

[#1641] add parent option to createTag #1647

Closed
wants to merge 15 commits into from

Conversation

npeltier
Copy link
Contributor

@npeltier npeltier added run-nala Run Nala Test Automation against PR @marquee Run Marquee Tests Nala @marketo Run Marketo Block Tests @modal Run Modal Tests Nala commerce labels Dec 13, 2023
Copy link
Contributor

aem-code-sync bot commented Dec 13, 2023

Hello, I'm the AEM Code Sync Bot and I will run some test suites that validate the page speed.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-run PSI Checks

@npeltier npeltier requested review from rgclayton and a team as code owners December 13, 2023 09:09
Copy link
Contributor

aem-code-sync bot commented Dec 13, 2023

Page Scores Audits Google
/?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
/docs/library/kitchen-sink/merch-card?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (dba63ec) 95.67% compared to head (6a066c3) 95.02%.
Report is 14 commits behind head on main.

❗ Current head 6a066c3 differs from pull request most recent head f08e92f. Consider uploading reports for the commit f08e92f to get more accurate results

Files Patch % Lines
libs/blocks/featured-article/featured-article.js 0.00% 6 Missing ⚠️
libs/blocks/article-feed/article-feed.js 0.00% 2 Missing ⚠️
libs/features/personalization/preview.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1647      +/-   ##
==========================================
- Coverage   95.67%   95.02%   -0.65%     
==========================================
  Files         154      153       -1     
  Lines       39657    39562      -95     
==========================================
- Hits        37940    37592     -348     
- Misses       1717     1970     +253     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

libs/utils/utils.js Outdated Show resolved Hide resolved
Copy link
Contributor

@overmyheadandbody overmyheadandbody left a comment

Choose a reason for hiding this comment

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

Looking good for the most part, it must've been a tedious task to go through all of these. I just have a few notes

libs/blocks/library-config/lists/personalization.js Outdated Show resolved Hide resolved
test/blocks/instagram/mocks/embed-utils.js Outdated Show resolved Hide resolved
test/blocks/marketo/mocks/marketo-utils.js Outdated Show resolved Hide resolved
test/blocks/slideshare/mocks/utils.js Outdated Show resolved Hide resolved
libs/utils/utils.js Show resolved Hide resolved
@overmyheadandbody
Copy link
Contributor

Also, you could add the needs-verification label so the checks are on a better path to green

@npeltier npeltier added the needs-verification PR requires E2E testing by a reviewer label Dec 13, 2023
@@ -143,8 +143,7 @@ async function combineLibraries(base, supplied) {
function createList(libraries) {
const container = createTag('div', { class: 'con-container' });

const libraryList = createTag('ul', { class: 'sk-library-list' });
container.append(libraryList);
const libraryList = createTag('ul', { class: 'sk-library-list' }, null, { parent: container });
Copy link
Contributor

Choose a reason for hiding this comment

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

you missed one element here -

const item = createTag('li', { class: 'content-type' }, type.replace('_', ' '));

@@ -22,6 +22,9 @@ export function createTag(tag, attributes, html) {
el.setAttribute(key, val);
});
}
if (options?.parent) {
Copy link
Contributor

Choose a reason for hiding this comment

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

options will always be defined, no need for ?. I think we can skip the whole if clause and do options.parent?.append(el);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, forgot to cleanup that test, thanks

Copy link
Contributor

aem-code-sync bot commented Dec 18, 2023

Page Scores Audits Google
/?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
/docs/library/kitchen-sink/merch-card?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

@hparra hparra left a comment

Choose a reason for hiding this comment

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

Sorry for delay. I was out for most of December.

@@ -115,6 +115,5 @@ export default function init(el) {
el.remove();
const obj = createVideoObject(metadata);
if (!obj) return;
const script = createTag('script', { type: 'application/ld+json' }, JSON.stringify(obj));
document.head.append(script);
createTag('script', { type: 'application/ld+json' }, JSON.stringify(obj), { parent: document.head });
Copy link
Contributor

Choose a reason for hiding this comment

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

lgtm

@@ -42,8 +42,7 @@ export async function appendScriptTag({ locationUrl, getMetadata, createTag, get
? SEOTECH_API_URL_PROD : SEOTECH_API_URL_STAGE;

const append = (obj) => {
const script = createTag('script', { type: 'application/ld+json' }, JSON.stringify(obj));
document.head.append(script);
createTag('script', { type: 'application/ld+json' }, JSON.stringify(obj), { parent: document.head });
Copy link
Contributor

Choose a reason for hiding this comment

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

lgtm

libs/utils/utils.js Show resolved Hide resolved
@@ -572,6 +573,20 @@ describe('Utils', () => {
});
});

describe('createTag', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@npeltier did createTag not have a UT prior to this diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not specifically, but indirectly i think it was already 100% covered

@@ -84,7 +84,6 @@ function getEvent(el) {
export default function init(el) {
const event = getEvent(el);
logNullValues(event);
const script = createTag('script', { type: 'application/ld+json' }, JSON.stringify(event));
document.head.append(script);
createTag('script', { type: 'application/ld+json' }, JSON.stringify(event), { parent: document.head });
Copy link
Contributor

Choose a reason for hiding this comment

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

lgtm. not formal owner but it is seo.

Copy link
Member

@auniverseaway auniverseaway left a comment

Choose a reason for hiding this comment

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

I would have opted to change these in batches and start with just changing the function first.

We always encourage small changes with small blast radiuses over large sweeping changes. The rare exception is net-new features that do not touch existing functionality (UAR, Merch, GlobalNav, etc.).

If one of these features blows up because there was a specific sequencing that should have been followed... appends have a very specific order, this entire PR must be reverted. Not having the complete historical knowledge of each use of create tag makes this a very risky PR.

Who is going to E2E QA this before it gets merged?

@npeltier
Copy link
Contributor Author

npeltier commented Jan 4, 2024

I would have opted to change these in batches and start with just changing the function first.

We always encourage small changes with small blast radiuses over large sweeping changes. The rare exception is net-new features that do not touch existing functionality (UAR, Merch, GlobalNav, etc.).

If one of these features blows up because there was a specific sequencing that should have been followed... appends have a very specific order, this entire PR must be reverted. Not having the complete historical knowledge of each use of create tag makes this a very risky PR.

Who is going to E2E QA this before it gets merged?

this makes sense, will make that PR the "feature" one, and usage in other ones (may be one per area, will see)

@npeltier
Copy link
Contributor Author

npeltier commented Jan 4, 2024

actually will close that one for simplicity reasons :)

@npeltier npeltier closed this Jan 4, 2024
@npeltier
Copy link
Contributor Author

npeltier commented Jan 4, 2024

core one #1698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commerce @marketo Run Marketo Block Tests @marquee Run Marquee Tests Nala @modal Run Modal Tests Nala needs-verification PR requires E2E testing by a reviewer run-nala Run Nala Test Automation against PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants