From 2f4bffc3137704d92c05b7b4873778a5331dc309 Mon Sep 17 00:00:00 2001 From: Andrew Slagle <42588549+spotxslagle@users.noreply.github.com> Date: Sat, 23 Jul 2022 09:57:59 -0600 Subject: [PATCH] SpotX Adapter: Render immediately (#8731) * Render spotx ads immediately * Formatting fix --- modules/spotxBidAdapter.js | 2 +- test/spec/modules/spotxBidAdapter_spec.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/spotxBidAdapter.js b/modules/spotxBidAdapter.js index 86a37e97e2f..bcc65c85791 100644 --- a/modules/spotxBidAdapter.js +++ b/modules/spotxBidAdapter.js @@ -379,7 +379,7 @@ export const spec = { const playersize = deepAccess(currentBidRequest, 'mediaTypes.video.playerSize'); const renderer = Renderer.install({ id: 0, - url: '/', + renderNow: true, config: { adText: 'SpotX Outstream Video Ad via Prebid.js', player_width: playersize[0][0], diff --git a/test/spec/modules/spotxBidAdapter_spec.js b/test/spec/modules/spotxBidAdapter_spec.js index 9d961657ac2..274ef60471b 100644 --- a/test/spec/modules/spotxBidAdapter_spec.js +++ b/test/spec/modules/spotxBidAdapter_spec.js @@ -442,6 +442,7 @@ describe('the spotx adapter', function () { }, bidId: 123, params: { + ad_unit: 'outstream', player_width: 400, player_height: 300, content_page_url: 'prebid.js', @@ -533,6 +534,17 @@ describe('the spotx adapter', function () { expect(responses[1].videoCacheKey).to.equal('cache124'); expect(responses[1].width).to.equal(200); }); + + it('should set the renderer attached to the bid to render immediately', function () { + var renderer = spec.interpretResponse(serverResponse, bidderRequestObj)[0].renderer, + hasRun = false; + expect(renderer._render).to.be.a('function'); + renderer._render = () => { + hasRun = true; + } + renderer.render(); + expect(hasRun).to.equal(true); + }); }); describe('outstreamRender', function() {