@mailonline/video-ad-sdk
Advanced tools
Comparing version 1.3.5 to 1.3.6
{ | ||
"name": "@mailonline/video-ad-sdk", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "Video ad SDK to load and play video ads", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -852,2 +852,39 @@ /* eslint-disable no-loop-func, max-nested-callbacks */ | ||
test('must emit start event once', async () => { | ||
const callback = jest.fn(); | ||
adUnit.on(start, callback); | ||
await adUnit.start(); | ||
adUnit.creativeAd.emit(adVideoStart); | ||
adUnit.creativeAd.emit(adVideoStart); | ||
adUnit.creativeAd.emit(adVideoStart); | ||
expect(callback).toHaveBeenCalledTimes(1); | ||
}); | ||
test('must fake `adVideoStarted` on adImpression if not called already', async () => { | ||
const callback = jest.fn(); | ||
adUnit.on(start, callback); | ||
await adUnit.start(); | ||
adUnit.creativeAd.emit(adImpression); | ||
expect(callback).toHaveBeenCalledTimes(1); | ||
expect(callback).toHaveBeenCalledWith({ | ||
adUnit, | ||
type: start | ||
}); | ||
}); | ||
test('must not fake `adVideoStarted` on adImpression if called already', async () => { | ||
const callback = jest.fn(); | ||
adUnit.on(start, callback); | ||
await adUnit.start(); | ||
adUnit.creativeAd.emit(adVideoStart); | ||
expect(callback).toHaveBeenCalledTimes(1); | ||
adUnit.creativeAd.emit(adImpression); | ||
expect(callback).toHaveBeenCalledTimes(1); | ||
}); | ||
describe('paused', () => { | ||
@@ -854,0 +891,0 @@ it('must return true if the creative is paused and false otherwise', async () => { |
@@ -132,2 +132,7 @@ /* eslint-disable promise/prefer-await-to-callbacks, class-methods-use-this, import/no-named-as-default-member */ | ||
[adImpression]: () => { | ||
// NOTE: some ads forget to trigger the adVideoStart event. :( | ||
if (!this[_private].videoStart) { | ||
this[_private].handleVpaidEvt(adVideoStart); | ||
} | ||
this.emit(impression, { | ||
@@ -220,7 +225,10 @@ adUnit: this, | ||
[adVideoStart]: () => { | ||
this[_private].paused = false; | ||
this.emit(start, { | ||
adUnit: this, | ||
type: start | ||
}); | ||
if (!this[_private].videoStart) { | ||
this[_private].videoStart = true; | ||
this[_private].paused = false; | ||
this.emit(start, { | ||
adUnit: this, | ||
type: start | ||
}); | ||
} | ||
}, | ||
@@ -227,0 +235,0 @@ [adVideoThirdQuartile]: () => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2112236
28127