prismicio / prismic-react

React components and hooks to fetch and present Prismic content
https://prismic.io/docs/technologies/homepage-reactjs
Apache License 2.0
154 stars 40 forks source link

fix: do not execute `<PrismicToolbar>`'s script during Happy DOM tests #151

Closed angeloashmore closed 1 year ago

angeloashmore commented 1 year ago

Types of changes

Description

This PR patches <PrismicToolbar> to prevent the component's <script> element to execute in Happpy DOM environments. This is useful when using Happy DOM in tests, such as in Vitest.

The included patch will be pruned during code minification in non-test environments.

Checklist:

🐍

codecov-commenter commented 1 year ago

Codecov Report

Merging #151 (0b36b98) into master (add20dd) will decrease coverage by 0.26%. The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master     #151      +/-   ##
==========================================
- Coverage   92.06%   91.79%   -0.27%     
==========================================
  Files          18       18              
  Lines         315      317       +2     
  Branches       74       75       +1     
==========================================
+ Hits          290      291       +1     
  Misses          5        5              
- Partials       20       21       +1     
Impacted Files Coverage Ξ”
src/PrismicToolbar.tsx 88.88% <50.00%> (-4.87%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update add20dd...0b36b98. Read the comment docs.

github-actions[bot] commented 1 year ago

size-limit report πŸ“¦

Path Size
dist/index.js 5.31 KB (0%)
dist/index.cjs 6.83 KB (0%)