Skip to content

Commit

Permalink
fix handling of default settings for rubiconBidAdapter (prebid#11114)
Browse files Browse the repository at this point in the history
Co-authored-by: Serhii Mozhaiskyi <smozhaiskyi@rubiconproject.com>
  • Loading branch information
smozhaiskyi-rubi and Serhii Mozhaiskyi authored Feb 20, 2024
1 parent 8cce0b8 commit 7995508
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
19 changes: 13 additions & 6 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,20 +829,27 @@ 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,
height: bid.height,
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
});
});
}
Expand Down
10 changes: 6 additions & 4 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}});
Expand Down Expand Up @@ -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');
});
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 7995508

Please sign in to comment.