From 7badd9ba25ca3de7f5dd6972403425eb810e4a92 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 16 Oct 2014 13:53:17 -0600 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20rely=20on=20:focus=20selector?= =?UTF-8?q?=20for=20toHaveFocus=20matcher?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :focus doesn’t work properly when focus is inside the shadow DOM of an element, but document.activeElement does. --- spec/spec-helper.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 663b10ae1..0f313433a 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -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 ""