adobe / aem-core-cif-components

A set of configurations and components to get you started with AEM Commerce development
Apache License 2.0
103 stars 80 forks source link

CIF-2948: parse response html in the current browsing context #955

Closed buuhuu closed 2 years ago

buuhuu commented 2 years ago

Description

This change replaces the use of DOMParser in the load more handlers of product collections with a document.createRange().createContextualFragment.

The DOMParser previously parsed the returned html without any browsing context, hence flagged as scripting disabled. This causes all nodes in <noscript> tags to be parsed as dom nodes.

The image v2 component on the other hand expects the content of the <noscript> tag to be pure text, which is the expected for javascript enabled browsers. Because of this the image v2 component was not working for product list experience fragments in combination with load more yet.

Related Issue

CIF-2948

Motivation and Context

How Has This Been Tested?

Locally, existing uint tests

Screenshots (if appropriate):

Types of changes

Checklist:

codecov[bot] commented 2 years ago

Codecov Report

Merging #955 (9422782) into master (60cdd75) will decrease coverage by 0.00%. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #955      +/-   ##
============================================
- Coverage     89.47%   89.46%   -0.01%     
  Complexity     2204     2204              
============================================
  Files           351      351              
  Lines          9860     9857       -3     
  Branches       1422     1422              
============================================
- Hits           8822     8819       -3     
  Misses          742      742              
  Partials        296      296              
Flag Coverage Δ
integration 52.17% <ø> (ø)
jest 86.55% <ø> (ø)
karma 95.32% <100.00%> (-0.01%) :arrow_down:
unittests 88.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...oductcollection/clientlibs/js/productcollection.js 87.71% <100.00%> (-0.22%) :arrow_down:
...oductcollection/clientlibs/js/productcollection.js 89.55% <100.00%> (-0.31%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more