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

[JR] Bugfix/restore original container style on destroy #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

joshua-econify
Copy link
Collaborator

@joshua-econify joshua-econify commented Oct 17, 2019

Fix #103

Description

  • if bugfix:
    • Explanation of the problems behavior & repro steps, the code culprit and the solution.

Writing some tests to familiarize with ad.js (+ bonus increase coverage) and came across:

    this.originalStyle = container.style;

    container.style.position = 'sticky';
    container.style.top = `${stickyOffset}px`;

https://github.com/Econify/ad.js/blob/master/src/plugins/Sticky.ts#L34

Understanding is original style is a reference to container.style so the next line that sets the value of container.style overwrites the original value to be preserved in this.originalStyle (used for restoration in .onDestroy -> .cleanUp). As is this means position and top if set are never restored to their original values onDestroy -> cleanUp.

PR Requirements

Before requesting review this criteria must be met:
Overall test coverage >= current master?

  • Yes
  • N.A.

Documentation included (if any behavioral changes)?

  • Yes
  • N.A.

Backwards compatibility (if breaking change)?

  • Yes
  • N.A.

Release

Will this pr trigger a release i.e. version in package.json has been bumped?

  • Yes
  • No

Screenshots

If U.I. component, include screenshots or video screen capture showing
behavior and responsive styling below.

@joshua-econify joshua-econify changed the title [JR] Fix #103: Bugfix/restore original container style on destroy [JR] Bugfix/restore original container style on destroy Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Original style values used for restoration onDestroy are overridden onCreate
1 participant