mercredi 8 août 2018

How to simulate clientHeight in enyzme

In react component I am checking position of scroller.

So, it working correctly.

But when I run the test, dom variables returning 0.

const st = 'scrollTop';
const sh = 'scrollHeight';
const h:any = document.documentElement;
const b:any = document.body;

console.log(h[st]); // 0
console.log(b[st]); // 0
console.log(h[sh]); // 0
console.log(b[sh]); // 0
console.log(h.clientHeight); // 0

How can I set clientHeight, scrollTop, scrollHeight to some testing value?

Aucun commentaire:

Enregistrer un commentaire