Skip to content

Commit

Permalink
PWA-3137-V3::Image is rendered on wrong pages when parallax is used o…
Browse files Browse the repository at this point in the history
…n page builder (#4129)

Co-authored-by: Aanchal Pawar <97873570+glo82145@users.noreply.github.com>
  • Loading branch information
glo80771 and glo82145 authored Oct 4, 2023
1 parent 59ad6b7 commit 44101ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
17 changes: 2 additions & 15 deletions packages/pagebuilder/lib/ContentTypes/Row/__tests__/row.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ test('render row with parallax initializes Jarallax', () => {
}
});

expect(mockJarallax).toHaveBeenCalledWith(true, {
speed: 0.75,
imgPosition: 'center center',
imgRepeat: 'repeat',
imgSize: 'cover'
});
expect(mockJarallax).toHaveBeenCalledWith(true, 'destroy');
});

test('render row with parallax initializes JarallaxVideo', () => {
Expand Down Expand Up @@ -99,15 +94,7 @@ test('row unmount causes Jarallax to be destroyed', () => {
});

expect(mockJarallax.mock.calls).toEqual([
[
true,
{
speed: 0.75,
imgPosition: 'top left',
imgRepeat: 'no-repeat',
imgSize: 'contain'
}
],
[true, 'destroy'],
[true, 'destroy']
]);
});
Expand Down
7 changes: 1 addition & 6 deletions packages/pagebuilder/lib/ContentTypes/Row/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,7 @@ const Row = props => {
if (enableParallax && bgImageStyle && backgroundType !== 'video') {
({ jarallax } = require('jarallax'));
parallaxElement = backgroundElement.current;
jarallax(parallaxElement, {
speed: parallaxSpeed,
imgSize: backgroundSize,
imgPosition: backgroundPosition,
imgRepeat: backgroundRepeat
});
jarallax(parallaxElement, 'destroy');
}

if (backgroundType === 'video') {
Expand Down

0 comments on commit 44101ef

Please sign in to comment.