This is not easy to do because the dart: html library is not headless (i.e. it needs a browser). I usually try to follow the MVP design pattern to make sure that the code that interacts with the DOM is only in my view class and that all the biz logic is in the lead. Thus, I am a unit test lead, not needing access to the DOM API. Below is a small example.
source share