guard-jasmine: Focus test not working in PhantomJS

I have keydown tests that seem to work fine in the browser with jasminerice

I am trying to get guard-jasmine working.

I need some assistance.

here is one of the tests that works in firefox and safari via jasmine rice and fails in phantomjs

it("is focused",function() {
  expect($(selector).filter(':focus').size()).toBe(0)
  $(selector).filter(':first').trigger('click.editable')
  expect($(selector).filter(':focus').size()).toBe(1)
})

About this issue

  • Original URL
  • State: open
  • Created 12 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

Passed several years. The issue wasn’t gone.

I’m running latest version of Grunt, Grunt Jasmine, jQuery and this is still an issue. However the document.activeElement shared by @netzpirat makes the trick.

expect(defaultView.$('.some').get(0)).toBe(document.activeElement);

Did you attach the elements to the DOM? Visibility tests won’t work in-memory, the elements must be attached to the document.