It might be more interesting to append customElement to div first, and assert that callbackCalledCounter is still zero. Then attach div to the document, and assert that callbackCalledCounter is incremented. ie that the callback is called even if the element isn't directly the node being attached (or detached, or moved.)