Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus/Blur #56

Open
JonWatkins opened this issue Oct 4, 2016 · 1 comment
Open

Focus/Blur #56

JonWatkins opened this issue Oct 4, 2016 · 1 comment

Comments

@JonWatkins
Copy link

JonWatkins commented Oct 4, 2016

Currently any tests using focus/blur events in Firefox will currently fail unless the window has focus. I am currently running multiple launchers and have an event listener to trigger a method when an input looses focus. I have a test that works similar to this:

it('Should trigger the blur event', function () {
   var input = document.getElementById('text-input');
   spyOn(form, 'blurHandler');
   input.focus();
   input.blur();
   expect(form.blurHandler).toHaveBeenCalled();
});

This runs in chrome, but Firefox will not run the text case unless I manually focus the window and refresh the page

I had found a little bit of information on a user_pref "focusmanager.testmode" which was related to selenium testing, so I have tried adding a custom launcher to my karma config like so:

{
   browsers: ['Chrome', 'FirefoxAllowFocus'],
   customLaunchers: {
      FirefoxAllowFocus: {
         base: 'Firefox',
         prefs: {
            'focusmanager.testmode': true
         }
      }
   }
}

Unfortunately this also does not have any effect on the failing unit tests.

@stefanneculai
Copy link

stefanneculai commented Jul 5, 2017

+1. It would be great to have an option for focusing the window when the tests start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants