From 7995508149f460b9660a4525634c0570ee99f632 Mon Sep 17 00:00:00 2001 From: Serhii Mozhaiskyi <57671975+smozhaiskyi-rubi@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:55:09 +0200 Subject: [PATCH] fix handling of default settings for rubiconBidAdapter (#11114) Co-authored-by: Serhii Mozhaiskyi --- modules/rubiconBidAdapter.js | 19 +++++++++++++------ test/spec/modules/rubiconBidAdapter_spec.js | 10 ++++++---- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/modules/rubiconBidAdapter.js b/modules/rubiconBidAdapter.js index 813db65717e..973c6660ece 100644 --- a/modules/rubiconBidAdapter.js +++ b/modules/rubiconBidAdapter.js @@ -829,7 +829,14 @@ function renderBid(bid) { hideSmartAdServerIframe(adUnitElement); // configure renderer - const config = bid.renderer.getConfig(); + const defaultConfig = { + align: 'center', + position: 'append', + closeButton: false, + label: undefined, + collapse: true + }; + const config = { ...defaultConfig, ...bid.renderer.getConfig() }; bid.renderer.push(() => { window.MagniteApex.renderAd({ width: bid.width, @@ -837,12 +844,12 @@ function renderBid(bid) { vastUrl: bid.vastUrl, placement: { attachTo: adUnitElement, - align: config.align || 'center', - position: config.position || 'append' + align: config.align, + position: config.position }, - closeButton: config.closeButton || false, - label: config.label || undefined, - collapse: config.collapse || true + closeButton: config.closeButton, + label: config.label, + collapse: config.collapse }); }); } diff --git a/test/spec/modules/rubiconBidAdapter_spec.js b/test/spec/modules/rubiconBidAdapter_spec.js index 62e494ea295..0312114e75b 100644 --- a/test/spec/modules/rubiconBidAdapter_spec.js +++ b/test/spec/modules/rubiconBidAdapter_spec.js @@ -3899,7 +3899,8 @@ describe('the rubicon adapter', function () { config.setConfig({rubicon: { rendererConfig: { align: 'left', - closeButton: true + closeButton: true, + collapse: false }, rendererUrl: 'https://example.test/renderer.js' }}); @@ -3971,7 +3972,8 @@ describe('the rubicon adapter', function () { expect(typeof bids[0].renderer).to.equal('object'); expect(bids[0].renderer.getConfig()).to.deep.equal({ align: 'left', - closeButton: true + closeButton: true, + collapse: false }); expect(bids[0].renderer.url).to.equal('https://example.test/renderer.js'); }); @@ -4025,7 +4027,7 @@ describe('the rubicon adapter', function () { const renderCall = window.MagniteApex.renderAd.getCall(0); expect(renderCall.args[0]).to.deep.equal({ closeButton: true, - collapse: true, + collapse: false, height: 320, label: undefined, placement: { @@ -4094,7 +4096,7 @@ describe('the rubicon adapter', function () { const renderCall = window.MagniteApex.renderAd.getCall(0); expect(renderCall.args[0]).to.deep.equal({ closeButton: true, - collapse: true, + collapse: false, height: 480, label: undefined, placement: {