Open robotarmy opened 12 years ago
Did you attach the elements to the DOM? Visibility tests won't work in-memory, the elements must be attached to the document.
Closing this since lack of response.
yes - they were attatched via jquery fixture in jasmine
On Thu, Apr 5, 2012 at 2:28 AM, Michael Kessler reply@reply.github.com wrote:
Closing this since lack of response.
Reply to this email directly or view it on GitHub: https://github.com/netzpirat/guard-jasmine/issues/48#issuecomment-4972370
Modern Yoga vs Traditional Yoga http://swamij.com/traditional-yoga.htm#swamirama
I can confirm this bug, here's a PhantomJS script to reproduce:
page = require('webpage').create()
page.onConsoleMessage = (msg) -> console.log msg
page.open 'http://www.google.com/', (status) ->
console.log 'Google loaded'
page.includeJs 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', ->
console.log 'jQuery injected'
page.evaluate ->
console.log "Is search focused? #{ $('input[name=q]').is ':focus' }"
$('input[name=q]').focus()
console.log "Is search focused? #{ $('input[name=q]').is ':focus' }"
phantom.exit()
I has already been reported to the PhantomJS issue tracker, see Issue 427 and vote for it!
thank you fro your help!
On Thu, Apr 5, 2012 at 1:13 PM, Michael Kessler reply@reply.github.com wrote:
I has already been reported to PhantomJS issue tracker, see Issue 427 and vote for it!
Reply to this email directly or view it on GitHub: https://github.com/netzpirat/guard-jasmine/issues/48#issuecomment-4984695
Modern Yoga vs Traditional Yoga http://swamij.com/traditional-yoga.htm#swamirama
This issue is still present in PhantomJS 1.6.0.
As workaround you can check the active document element:
$('input[name=q]').get(0) == document.activeElement
so you can write your own matcher in spec.js.coffee
like:
beforeEach ->
@addMatchers {
toBeFocused: -> @actual.get(0) is @actual.get(0).ownerDocument.activeElement
}
@netzpirat thanks for the workaround
Has anyone tried any of the newer versions of phantomjs? 1.9.0 seems to fix a lot of problems for me.
No, I haven't tried it yet.
I just tried this. Doesn't work unfortunately. Will be checking the activeElement property workaround for now.
+1 ... currently requires mocking around :focus
checks in tests which is less than ideal
I confirm, not working (thru Codeception stuff).
Thanks for the reports.
I'm not sure we'll be able to fix this in guard-jasmine since it seems like a phantomjs issue. I'll investigate it further and see if we can figure out a workaround, but I don't see any way we can do so at the moment.
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);
Passed several years. The issue wasn't gone.
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