ember-test-helpers: Focusout event not triggered when test window is not focused
So, I have a simple Ember component input which has the built-in focusOut Ember event. In an integration test, using ember-test-helpers triggerEvent(input, 'blur') on this input or fillIn(other-input, 'blbl') in another input does not trigger the focusOut event if the window test is not focused while running.
I created a new Ember project to demonstrate this bug (see tests/integration/my-component-test.js), you can check it out here => test-focusout
How to test
ember t -s --filter='Integration | Component | my-component'- Open dev tools in test window.
- Click in console and refresh page (click inside test window if you want to re-focusin).
- Same behaviour when running the test while focusing another window. Reproduced on Chrome 76.0.3809.87 and Firefox 68.0.1
Is that the expected behaviour ?
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 16 (13 by maintainers)
Lets do it!
You are suggesting that we would effectively to do:
Inside
fillIn/typeIn/click?hmm, I don’t think we should blur at the end. what we could potentially do is blur at the start if the focus is on another element. or am I missing something?
@ohcibi - Ya, you are right sorry about that. I’m not sure what the best path forward here is though.
fillIn/typeIncould theoretically focus out at the end, but I’m not 100% sure that is the correct behavior for us. 🤔@ro0gr / @Turbo87 - Thoughts?
Not that it’s a fix, but we worked around this by adding a
testWithBrowserFocuswrapper fortestthat we use in these cases.Here we preferred false positives.
And it works just like
test: