Skip to content

Commit

Permalink
fixup! Add new window features to HB request
Browse files Browse the repository at this point in the history
  • Loading branch information
github-saad-elmahfoudi committed Dec 5, 2023
1 parent b5afcbe commit 870bdd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/teadsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const spec = {
viewportHeight: topWindow.visualViewport?.height,
viewportWidth: topWindow.visualViewport?.width,
hardwareConcurrency: topWindow.navigator?.hardwareConcurrency,
deviceMemory: topWindow.navigator?.deviceMemory,
deviceMemory: topWindow.navigator?.deviceMemory.toString() || '',
hb_version: '$prebid.version$',
...getSharedViewerIdParameters(validBidRequests),
...getFirstPartyTeadsIdParameter(validBidRequests)
Expand Down
5 changes: 4 additions & 1 deletion test/spec/modules/teadsBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,12 @@ describe('teadsBidAdapter', () => {
it('should add deviceMemory info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);
const deviceMemory = window.top.navigator?.deviceMemory

expect(payload.deviceMemory).to.exist;
expect(payload.deviceMemory).to.deep.equal(window.top.navigator.deviceMemory);
if (deviceMemory) {
expect(payload.deviceMemory).to.deep.equal(deviceMemory.toString());
} else expect(payload.deviceMemory).to.deep.equal('')
});

describe('pageTitle', function () {
Expand Down

0 comments on commit 870bdd5

Please sign in to comment.