mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-08 16:19:17 +03:00
Don’t rely on :focus selector for toHaveFocus matcher
:focus doesn’t work properly when focus is inside the shadow DOM of an element, but document.activeElement does.
This commit is contained in:
parent
e8d7058383
commit
7badd9ba25
@ -219,7 +219,7 @@ addCustomMatchers = (spec) ->
|
||||
@message = -> return "Expected element '" + @actual + "' or its descendants" + notText + " to have focus."
|
||||
element = @actual
|
||||
element = element.get(0) if element.jquery
|
||||
element.webkitMatchesSelector(":focus") or element.querySelector(":focus")
|
||||
element is document.activeElement or element.contains(document.activeElement)
|
||||
|
||||
toShow: ->
|
||||
notText = if @isNot then " not" else ""
|
||||
|
Loading…
Reference in New Issue
Block a user