Skip to content

Commit

Permalink
Wait for DOMContentLoaded event before observe changes on document bo…
Browse files Browse the repository at this point in the history
…dy on eplanning adapter (prebid#4791)

* Wait for DOMContentLoaded event before observe changes on document body

* Replaced hardcoded value for constant
  • Loading branch information
sebaperez authored and xiekevin committed Jan 19, 2023
1 parent 4f725d4 commit 7963349
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/spec/modules/eplanningBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ describe('E-Planning Adapter', function () {

context('when element is fully in view', function() {
let respuesta;
const NO_VIEWABLE = 'F';
beforeEach(function () {
createElementVisible();
setIntersectionObserverMock({[ADUNIT_CODE_VIEW]: {'ratio': 1, 'isIntersecting': true, 'width': 200, 'height': 200}});
Expand All @@ -1091,7 +1092,7 @@ describe('E-Planning Adapter', function () {
respuesta = spec.buildRequests(bidRequests, bidderRequest);
clock.tick(1005);

expect(respuesta.data.vs).to.equal('F');
expect(respuesta.data.vs).to.equal(NO_VIEWABLE);

expect(storage.getDataFromLocalStorage(storageIdRender)).to.equal('1');
expect(storage.getDataFromLocalStorage(storageIdView)).to.equal('1');
Expand Down Expand Up @@ -1121,6 +1122,7 @@ describe('E-Planning Adapter', function () {

context('when element is out of view', function() {
let respuesta;
const NO_VIEWABLE = 'F';
beforeEach(function () {
createElementOutOfView();
setIntersectionObserverMock({[ADUNIT_CODE_VIEW]: {'ratio': 0, 'isIntersecting': false, 'width': 200, 'height': 200}});
Expand All @@ -1129,7 +1131,7 @@ describe('E-Planning Adapter', function () {
it('when you have a render', function() {
respuesta = spec.buildRequests(bidRequests, bidderRequest);
clock.tick(1005);
expect(respuesta.data.vs).to.equal('F');
expect(respuesta.data.vs).to.equal(NO_VIEWABLE);

expect(storage.getDataFromLocalStorage(storageIdRender)).to.equal('1');
expect(storage.getDataFromLocalStorage(storageIdView)).to.equal(null);
Expand Down

0 comments on commit 7963349

Please sign in to comment.