I need to test a method called scrollToBottom
which does the following:
this.getMainElem().scrollTop = this.getMainElem().scrollHeight;
Since a new element has no scrollHeight
or scrollTop
value until it has been pasted onto the DOM, how can I test my method? At the moment, I have to create a new element with text, a height and overflow auto then append it directly to document.body
.
Can you suggest a cleaner way of testing this?
Aucun commentaire:
Enregistrer un commentaire