vpaid-html5-client
Advanced tools
Comparing version 0.1.9 to 0.1.10
{ | ||
"name": "VPAIDHTML5Client", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"homepage": "https://github.com/MailOnline/VPAIDHTML5Client", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -196,2 +196,14 @@ 'use strict'; | ||
this._creative.subscribe($clickThruHook.bind(this), AD_CLICK); | ||
// because we are adding the element inside the iframe | ||
// the user is not able to click in the video | ||
if (this._videoEl) { | ||
var documentElement = this._iframe.contentDocument.documentElement; | ||
var videoEl = this._videoEl; | ||
documentElement.addEventListener('click', function(e) { | ||
if (e.target === documentElement) { | ||
videoEl.click(); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -198,0 +210,0 @@ |
{ | ||
"name": "vpaid-html5-client", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "VPAID HTML5", | ||
@@ -5,0 +5,0 @@ "main": [ |
@@ -33,5 +33,7 @@ var noop = require('../testHelper').noop; | ||
var clock; | ||
var clock, iframe; | ||
beforeEach(function () { | ||
clock = sinon.useFakeTimers(); | ||
iframe = document.createElement('iframe'); | ||
document.body.appendChild(iframe); | ||
}); | ||
@@ -41,2 +43,3 @@ | ||
clock.restore(); | ||
document.body.removeChild(iframe); | ||
}); | ||
@@ -67,2 +70,3 @@ | ||
var video = document.createElement('video'); | ||
iframe.contentDocument.body.appendChild(el); | ||
@@ -73,3 +77,3 @@ var creative = new IVPAIDAdUnit(); | ||
new VPAIDAdUnit(creative, el, video).initAd(200, 200, 'normal', -1, {}, {videoSlotCanAutoPlay: true}, callback); | ||
new VPAIDAdUnit(creative, el, video, iframe).initAd(200, 200, 'normal', -1, {}, {videoSlotCanAutoPlay: true}, callback); | ||
new VPAIDAdUnit(creative).initAd(200, 200, 'normal', -1, {}, {slot: el, videoSlot: video, videoSlotCanAutoPlay: true}, callback); | ||
@@ -83,2 +87,18 @@ clock.tick(1); | ||
it('must add event listerner to iframe html element', function() { | ||
var el = document.createElement('div'); | ||
var video = document.createElement('video'); | ||
iframe.contentDocument.body.appendChild(el); | ||
var creative = new IVPAIDAdUnit(); | ||
var callback = sinon.spy(); | ||
new VPAIDAdUnit(creative, el, video, iframe).initAd(200, 200, 'normal', -1, {}, {videoSlotCanAutoPlay: true}, noop); | ||
video.addEventListener('click', callback); | ||
iframe.contentDocument.documentElement.click(); | ||
assert(callback.called, 'must trigger click in videoEl synchronous'); | ||
}); | ||
it('must subscribe to all events', function() { | ||
@@ -168,3 +188,2 @@ var creative = new IVPAIDAdUnit(); | ||
}); | ||
}); | ||
@@ -171,0 +190,0 @@ |
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
144627
3106