Skip to content

Commit

Permalink
Revert "implements the todo comment in the code (#4821)"
Browse files Browse the repository at this point in the history
This reverts commit 469ec57.
  • Loading branch information
jsnellbaker authored Feb 13, 2020
1 parent ec6faef commit d9135b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export const checkAdUnitSetup = hook('sync', function (adUnits) {
const bannerSizes = validateSizes(mediaTypes.banner.sizes);
if (bannerSizes.length > 0) {
mediaTypes.banner.sizes = bannerSizes;
// TODO eventually remove this internal copy once we're ready to deprecate bidders from reading this adUnit.sizes property
adUnit.sizes = bannerSizes;
} else {
utils.logError('Detected a mediaTypes.banner object without a proper sizes field. Please ensure the sizes are listed like: [[300, 250], ...]. Removing invalid mediaTypes.banner object from request.');
delete adUnit.mediaTypes.banner;
Expand All @@ -105,7 +107,7 @@ export const checkAdUnitSetup = hook('sync', function (adUnits) {
let tarPlayerSizeLen = (typeof video.playerSize[0] === 'number') ? 2 : 1;
const videoSizes = validateSizes(video.playerSize, tarPlayerSizeLen);
if (videoSizes.length > 0) {
video.playerSize = videoSizes;
adUnit.sizes = video.playerSize = videoSizes;
} else {
utils.logError('Detected incorrect configuration of mediaTypes.video.playerSize. Please specify only one set of dimensions in a format like: [[640, 480]]. Removing invalid mediaTypes.video.playerSize property from request.');
delete adUnit.mediaTypes.video.playerSize;
Expand Down
8 changes: 8 additions & 0 deletions test/spec/unit/pbjs_api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,7 @@ describe('Unit: Prebid Module', function () {
$$PREBID_GLOBAL$$.requestBids({
adUnits: fullAdUnit
});
expect(auctionArgs.adUnits[0].sizes).to.deep.equal([[640, 480]]);
expect(auctionArgs.adUnits[0].mediaTypes.video.playerSize).to.deep.equal([[640, 480]]);
expect(auctionArgs.adUnits[0].mediaTypes.native.image.sizes).to.deep.equal([150, 150]);
expect(auctionArgs.adUnits[0].mediaTypes.native.icon.sizes).to.deep.equal([75, 75]);
Expand Down Expand Up @@ -1542,6 +1543,7 @@ describe('Unit: Prebid Module', function () {
$$PREBID_GLOBAL$$.requestBids({
adUnits: noOptnlFieldAdUnit
});
expect(auctionArgs.adUnits[0].sizes).to.deep.equal([[300, 250]]);
expect(auctionArgs.adUnits[0].mediaTypes.video).to.exist;

let mixedAdUnit = [{
Expand All @@ -1564,6 +1566,7 @@ describe('Unit: Prebid Module', function () {
$$PREBID_GLOBAL$$.requestBids({
adUnits: mixedAdUnit
});
expect(auctionArgs.adUnits[0].sizes).to.deep.equal([[400, 350]]);
expect(auctionArgs.adUnits[0].mediaTypes.video).to.exist;

let altVideoPlayerSize = [{
Expand All @@ -1579,6 +1582,7 @@ describe('Unit: Prebid Module', function () {
$$PREBID_GLOBAL$$.requestBids({
adUnits: altVideoPlayerSize
});
expect(auctionArgs.adUnits[0].sizes).to.deep.equal([[640, 480]]);
expect(auctionArgs.adUnits[0].mediaTypes.video.playerSize).to.deep.equal([[640, 480]]);
expect(auctionArgs.adUnits[0].mediaTypes.video).to.exist;
});
Expand All @@ -1597,6 +1601,7 @@ describe('Unit: Prebid Module', function () {
$$PREBID_GLOBAL$$.requestBids({
adUnits: normalizeAdUnit
});
expect(auctionArgs.adUnits[0].sizes).to.deep.equal([[300, 250]]);
expect(auctionArgs.adUnits[0].mediaTypes.banner.sizes).to.deep.equal([[300, 250]]);
});
});
Expand All @@ -1616,6 +1621,7 @@ describe('Unit: Prebid Module', function () {
$$PREBID_GLOBAL$$.requestBids({
adUnits: badBanner
});
expect(auctionArgs.adUnits[0].sizes).to.deep.equal([[300, 250], [300, 600]]);
expect(auctionArgs.adUnits[0].mediaTypes.banner).to.be.undefined;
assert.ok(logErrorSpy.calledWith('Detected a mediaTypes.banner object without a proper sizes field. Please ensure the sizes are listed like: [[300, 250], ...]. Removing invalid mediaTypes.banner object from request.'));

Expand All @@ -1632,6 +1638,7 @@ describe('Unit: Prebid Module', function () {
$$PREBID_GLOBAL$$.requestBids({
adUnits: badVideo1
});
expect(auctionArgs.adUnits[0].sizes).to.deep.equal([[600, 600]]);
expect(auctionArgs.adUnits[0].mediaTypes.video.playerSize).to.be.undefined;
expect(auctionArgs.adUnits[0].mediaTypes.video).to.exist;
assert.ok(logErrorSpy.calledWith('Detected incorrect configuration of mediaTypes.video.playerSize. Please specify only one set of dimensions in a format like: [[640, 480]]. Removing invalid mediaTypes.video.playerSize property from request.'));
Expand All @@ -1649,6 +1656,7 @@ describe('Unit: Prebid Module', function () {
$$PREBID_GLOBAL$$.requestBids({
adUnits: badVideo2
});
expect(auctionArgs.adUnits[0].sizes).to.deep.equal([[600, 600]]);
expect(auctionArgs.adUnits[0].mediaTypes.video.playerSize).to.be.undefined;
expect(auctionArgs.adUnits[0].mediaTypes.video).to.exist;
assert.ok(logErrorSpy.calledWith('Detected incorrect configuration of mediaTypes.video.playerSize. Please specify only one set of dimensions in a format like: [[640, 480]]. Removing invalid mediaTypes.video.playerSize property from request.'));
Expand Down

0 comments on commit d9135b3

Please sign in to comment.