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

test: standard theme color metadata setting two metas #881

Merged

Conversation

davidlj95
Copy link
Owner

@davidlj95 davidlj95 commented Oct 3, 2024

Issue or need

After trying to rebuild the APIs to set <meta> elements on the page (NgxMetaMetaService, NgxMetaMetaDefinition, ...), inspected how Angular's Meta APIs work

And at that point in time wondered what happens with the case that more than one multiple <meta> element with same name is valid. Like in the case of standard's <meta name='theme-color'>.

So added some E2E tests to see what happens when trying to add 2 <meta name='theme-color'>. One for dark mode and another for the default (light) mode.

Turns out that the API wasn't working as intended when trying to insert more than one <meta>. 2 elements are expected if providing an array with two elements.

However just one is created and later updated. Which makes sense given we call Angular's Meta.updateTag API.

Proposed changes

Add E2E tests to reflect the issue & avoid it from happening in the future.

In #919 new APIs to manage <meta> elements are used around. So this should fix the issue. Adding here the tests then to ensure it doesn't repeat again.

Quick reminders

  • 🤝 I will follow Code of Conduct
  • No existing pull request already does almost same changes
  • 👁️ Contributing docs are something I've taken a look at
  • 📝 Commit messages convention has been followed
  • 💬 TSDoc comments have been added or updated indicating API visibility if API surface has changed.
  • 🧪 Tests have been added if needed. For instance, if adding new features or fixing a bug. Or removed if removing features.
  • ⚙️ API Report has been updated if API surface is altered.

Copy link
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @davidlj95 and the rest of your teammates on Graphite Graphite

@davidlj95 davidlj95 force-pushed the stacked/fix-standard-theme-color-metadata-can-t-set-two-metas branch from 7f11b44 to bbe366a Compare October 11, 2024 14:42
@davidlj95 davidlj95 marked this pull request as ready for review October 11, 2024 14:42
@davidlj95 davidlj95 changed the title fix: standard theme color metadata can't set two metas test: standard theme color metadata setting two metas Oct 11, 2024
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.14%. Comparing base (dfdd97c) to head (a82990b).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #881   +/-   ##
=======================================
  Coverage   98.14%   98.14%           
=======================================
  Files          83       83           
  Lines         377      377           
  Branches       70       70           
=======================================
  Hits          370      370           
  Misses          3        3           
  Partials        4        4           

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

Copy link

github-actions bot commented Oct 11, 2024

📦 Bundle size (Angular v16)

Git ref: a82990b209aa3c155352d1819b4b3b9da7ea9ece

Module file Size Base size Difference
ngx-meta-core.mjs 3386 bytes (3.4KiB) 3386 bytes (3.4KiB) No change
ngx-meta-json-ld.mjs 370 bytes (370B) 370 bytes (370B) No change
ngx-meta-open-graph.mjs 1284 bytes (1.3KiB) 1284 bytes (1.3KiB) No change
ngx-meta-routing.mjs 572 bytes (572B) 572 bytes (572B) No change
ngx-meta-standard.mjs 1054 bytes (1.1KiB) 1054 bytes (1.1KiB) No change
ngx-meta-twitter-card.mjs 679 bytes (679B) 679 bytes (679B) No change
Total 7345 bytes (7.2KiB) 7345 bytes (7.2KiB) No change

Copy link

github-actions bot commented Oct 11, 2024

📦 Bundle size (Angular v18)

Git ref: a82990b209aa3c155352d1819b4b3b9da7ea9ece

Module file Size Base size Difference
ngx-meta-core.mjs 2978 bytes (3.0KiB) 2978 bytes (3.0KiB) No change
ngx-meta-json-ld.mjs 226 bytes (226B) 226 bytes (226B) No change
ngx-meta-open-graph.mjs 997 bytes (997B) 997 bytes (997B) No change
ngx-meta-routing.mjs 394 bytes (394B) 394 bytes (394B) No change
ngx-meta-standard.mjs 949 bytes (949B) 949 bytes (949B) No change
ngx-meta-twitter-card.mjs 540 bytes (540B) 540 bytes (540B) No change
Total 6084 bytes (6.0KiB) 6084 bytes (6.0KiB) No change

Copy link

github-actions bot commented Oct 11, 2024

📦 Bundle size (Angular v15)

Git ref: a82990b209aa3c155352d1819b4b3b9da7ea9ece

Module file Size Base size Difference
ngx-meta-core.mjs 3346 bytes (3.3KiB) 3346 bytes (3.3KiB) No change
ngx-meta-json-ld.mjs 355 bytes (355B) 355 bytes (355B) No change
ngx-meta-open-graph.mjs 1254 bytes (1.3KiB) 1254 bytes (1.3KiB) No change
ngx-meta-routing.mjs 557 bytes (557B) 557 bytes (557B) No change
ngx-meta-standard.mjs 1039 bytes (1.1KiB) 1039 bytes (1.1KiB) No change
ngx-meta-twitter-card.mjs 664 bytes (664B) 664 bytes (664B) No change
Total 7215 bytes (7.1KiB) 7215 bytes (7.1KiB) No change

Copy link

github-actions bot commented Oct 11, 2024

📦 Bundle size (Angular v17)

Git ref: a82990b209aa3c155352d1819b4b3b9da7ea9ece

Module file Size Base size Difference
ngx-meta-core.mjs 2978 bytes (3.0KiB) 2978 bytes (3.0KiB) No change
ngx-meta-json-ld.mjs 226 bytes (226B) 226 bytes (226B) No change
ngx-meta-open-graph.mjs 997 bytes (997B) 997 bytes (997B) No change
ngx-meta-routing.mjs 394 bytes (394B) 394 bytes (394B) No change
ngx-meta-standard.mjs 949 bytes (949B) 949 bytes (949B) No change
ngx-meta-twitter-card.mjs 540 bytes (540B) 540 bytes (540B) No change
Total 6084 bytes (6.0KiB) 6084 bytes (6.0KiB) No change

@davidlj95 davidlj95 force-pushed the stacked/fix-standard-theme-color-metadata-can-t-set-two-metas branch from bbe366a to a82990b Compare October 11, 2024 14:51
@davidlj95 davidlj95 enabled auto-merge (squash) October 11, 2024 14:52
@davidlj95 davidlj95 merged commit ef90c7c into main Oct 11, 2024
34 checks passed
@davidlj95 davidlj95 deleted the stacked/fix-standard-theme-color-metadata-can-t-set-two-metas branch October 11, 2024 14:56
Copy link

🎉 This PR is included in version 1.0.0-beta.19 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant