Skip to content

Commit

Permalink
implements the todo comment in the code (prebid#4821)
Browse files Browse the repository at this point in the history
* implements the todo comment in the code

adUnit.sizes was still being referenced here in two places despite being deprecated. This simply deletes the references.

* Update pbjs_api_spec.js

* Update pbjs_api_spec.js
  • Loading branch information
patmmccann authored Feb 12, 2020
1 parent c99c78f commit 469ec57
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
4 changes: 1 addition & 3 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ 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 @@ -107,7 +105,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) {
adUnit.sizes = video.playerSize = videoSizes;
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: 0 additions & 8 deletions test/spec/unit/pbjs_api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,6 @@ 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 @@ -1543,7 +1542,6 @@ 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 @@ -1566,7 +1564,6 @@ 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 @@ -1582,7 +1579,6 @@ 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 @@ -1601,7 +1597,6 @@ 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 @@ -1621,7 +1616,6 @@ 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 @@ -1638,7 +1632,6 @@ 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 @@ -1656,7 +1649,6 @@ 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 469ec57

Please sign in to comment.