Skip to content

Commit 44bd817

Browse files
Add test case for domComplexity feature
1 parent 3ae342b commit 44bd817

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

modules/teadsBidAdapter.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const spec = {
6262
networkQuality: getNetworkQuality(window.navigator),
6363
timeToFirstByte: getTimeToFirstByte(window),
6464
data: bids,
65-
domComplexity: document.querySelectorAll("*")?.length,
65+
domComplexity: document.querySelectorAll('*')?.length,
6666
deviceWidth: screen.width,
6767
deviceHeight: screen.height,
6868
devicePixelRatio: topWindow.devicePixelRatio,
@@ -235,7 +235,7 @@ function getConnectionDownLink(nav) {
235235
function getNetworkQuality(navigator) {
236236
const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
237237

238-
return connection?.effectiveType ?? ""
238+
return connection?.effectiveType ?? ''
239239
}
240240

241241
function getTimeToFirstByte(win) {

test/spec/modules/teadsBidAdapter_spec.js

+6
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,13 @@ describe('teadsBidAdapter', () => {
266266
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
267267
const payload = JSON.parse(request.data);
268268

269+
const domComplexity = document.querySelectorAll('*').length;
270+
269271
expect(payload.domComplexity).to.exist;
272+
273+
if (domComplexity) {
274+
expect(payload.domComplexity).to.deep.equal(domComplexity);
275+
}
270276
})
271277

272278
it('should add pageReferrer info to payload', function () {

0 commit comments

Comments
 (0)