Reputation: 367
I am writing component test that I am testing if the element has focused. I tried using the document.activeElement in order to accomplish this however, I am getting mix results sometimes the assert fails sometimes the asserts succeeds. Is there another strategy to test focus?
Upvotes: 1
Views: 931
Reputation: 65173
with https://github.com/simplabs/qunit-dom
you can just do
assert.dom(selector).isFocused();
Upvotes: 3