-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Size mapping functionality #651
Conversation
if(!isSizeMappingValid(adUnit.sizeMapping)){ | ||
return adUnit.sizes; | ||
} | ||
const width = this.getScreenWidth(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a test page, this line gave me TypeError: Cannot read property 'getScreenWidth' of undefined
due to this module using CommonJS-style exports but adapter manager using ES2015-style imports. Line 4 of adaptermanager could be changed to use a require statement, or the functions in this module could be exported with the ES2015 export
keyword--in that case the unit tests fail though and would need to be changed as well
if(utils.isArray(sizeMapping) && sizeMapping.length > 0){ | ||
return true; | ||
} | ||
utils.logError('sizeMapping needs at least one screen size defined'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On pages that haven't set up any sizeMapping
s but are still using sizes
array(s), this message still gets logged
const sizes = adUnit.sizeMapping.find(sizeMapping =>{ | ||
return width > sizeMapping.minWidth; | ||
}).sizes; | ||
utils.logMessage(`AdUnit : ${adUnit.code} resized based on device width to : ${adUnit.sizes}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a sizeMapping
is configured, is that meant to replace the sizes
property? If so this message will show width as undefined
it('mapSizes 1029 width', function() { | ||
let stub = sinon.stub(sizeMapping, 'getScreenWidth').returns(1029); | ||
let sizes = sizeMapping.mapSizes(validAdUnit); | ||
console.log(sizeMapping.getScreenWidth()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May want to remove this line
@matthewlane |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass, functionality works on test page, LGTM
return adUnit.sizes; | ||
} | ||
const width = getScreenWidth(); | ||
console.log('internal screen width: ' + width); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log snuck in here
* Size mapping initial draft. * Unit tests * Use desktop size if cannot determine width * Hygiene. * Increase unit coverage to 100% * Change to ES6 style export and updating unit tests * Remove console.log
* Size mapping initial draft. * Unit tests * Use desktop size if cannot determine width * Hygiene. * Increase unit coverage to 100% * Change to ES6 style export and updating unit tests * Remove console.log
…ebid-0.13.1 to release/1.4.0 * commit 'd174ef271e55e7f26210f50caac52c0a036bc9a1': CHANGELOG. 0.13.1 release add an --https flag to run local dev server over https (prebid#670) test ie variant of url parse pathname (prebid#669) Prevent SpringServe TypeError (prebid#663) XDomainRequest does not support `readyState` and was not executing the callback. (prebid#668) Prevent Sovrn TypeError (prebid#664) Prevent TripleLift TypeError (prebid#662) fixed bug with using non standard "standard" keys and sendAllBids (prebid#665) Initial value 0 for adder. (prebid#656) Prevent bidmanager TypeError (prebid#661) Prevent Pubmatic TypeError (prebid#666) Size mapping functionality (prebid#651) Added '320x80': 59, '320x320': 72, '320x160': 73 to RUBICON_SIZE_MAP (prebid#649) Add defy alias + increment version. (prebid#650) Add additional sizes to rubicon size mapping (prebid#646)
…4.0 to master * commit '5e7eec42d84ec5de47a28ba493a9357b595761d3': CHANGELOG. New adapter. 0.13.1 release add an --https flag to run local dev server over https (prebid#670) test ie variant of url parse pathname (prebid#669) Prevent SpringServe TypeError (prebid#663) XDomainRequest does not support `readyState` and was not executing the callback. (prebid#668) Prevent Sovrn TypeError (prebid#664) Prevent TripleLift TypeError (prebid#662) fixed bug with using non standard "standard" keys and sendAllBids (prebid#665) Initial value 0 for adder. (prebid#656) Prevent bidmanager TypeError (prebid#661) Prevent Pubmatic TypeError (prebid#666) Size mapping functionality (prebid#651) Added '320x80': 59, '320x320': 72, '320x160': 73 to RUBICON_SIZE_MAP (prebid#649) Add defy alias + increment version. (prebid#650) Add additional sizes to rubicon size mapping (prebid#646)
Type of change
Description of change
Adding support for #87 - size mapping.
Other information
@prebid/core for review.