From da24f45464f7e59114ea309eb53b69a5edef86be Mon Sep 17 00:00:00 2001 From: Andrey Polischuk Date: Thu, 7 Jul 2022 14:08:10 +0300 Subject: [PATCH] Revert "fix: ignore `pauseOnAdClick` on non-clickable ad" --- src/adUnit/VpaidAdUnit.js | 6 +++--- .../handlers/__tests__/onClickThrough.spec.js | 12 ++---------- .../helpers/metrics/handlers/onClickThrough.js | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/adUnit/VpaidAdUnit.js b/src/adUnit/VpaidAdUnit.js index 131787f6..6022089a 100644 --- a/src/adUnit/VpaidAdUnit.js +++ b/src/adUnit/VpaidAdUnit.js @@ -92,11 +92,11 @@ class VpaidAdUnit extends VideoAdUnit { evtHandler: { [adClickThru]: (url, id, playerHandles) => { if (playerHandles) { - const clickThroughUrl = typeof url === 'string' && url.length > 0 ? url : getClickThrough(this.vastChain[0].ad); - - if (this.paused() && (this.pauseOnAdClick || !clickThroughUrl)) { + if (this.paused() && this.pauseOnAdClick) { this.resume(); } else { + const clickThroughUrl = typeof url === 'string' && url.length > 0 ? url : getClickThrough(this.vastChain[0].ad); + if (this.pauseOnAdClick) { this.pause(); } diff --git a/src/adUnit/helpers/metrics/handlers/__tests__/onClickThrough.spec.js b/src/adUnit/helpers/metrics/handlers/__tests__/onClickThrough.spec.js index 6b8a4aed..b368aff6 100644 --- a/src/adUnit/helpers/metrics/handlers/__tests__/onClickThrough.spec.js +++ b/src/adUnit/helpers/metrics/handlers/__tests__/onClickThrough.spec.js @@ -98,12 +98,8 @@ test('onClickThrough must on anchor second click, play the video and not call th test('onClickThrough must on anchor every click, not pause the video and call the callback with clickthrough', () => { const {element, videoElement} = videoAdContainer; - const clickThroughUrl = 'http://test.example.com/clickThroughUrl'; - onClickThrough(videoAdContainer, callback, { - clickThroughUrl, - pauseOnAdClick: false - }); + onClickThrough(videoAdContainer, callback, {pauseOnAdClick: false}); const anchor = element.querySelector('a.mol-vast-clickthrough'); @@ -118,12 +114,8 @@ test('onClickThrough must on anchor every click, not pause the video and call th test('onClickThrough must on anchor every click, not play the video and call the callback with clickthrough', () => { const {element, videoElement} = videoAdContainer; - const clickThroughUrl = 'http://test.example.com/clickThroughUrl'; - onClickThrough(videoAdContainer, callback, { - clickThroughUrl, - pauseOnAdClick: false - }); + onClickThrough(videoAdContainer, callback, {pauseOnAdClick: false}); const anchor = element.querySelector('a.mol-vast-clickthrough'); diff --git a/src/adUnit/helpers/metrics/handlers/onClickThrough.js b/src/adUnit/helpers/metrics/handlers/onClickThrough.js index da90422d..485a50ae 100644 --- a/src/adUnit/helpers/metrics/handlers/onClickThrough.js +++ b/src/adUnit/helpers/metrics/handlers/onClickThrough.js @@ -24,7 +24,7 @@ const onClickThrough = ({videoElement, element}, callback, {clickThroughUrl, pau event.stopPropagation(); } - if (videoElement.paused && (pauseOnAdClick || !clickThroughUrl)) { + if (videoElement.paused && pauseOnAdClick) { if (Event.prototype.preventDefault !== undefined) { event.preventDefault(); }