attachDom: Refactor tests and extract DOM setters