Skip to content

Commit

Permalink
fix: clarify toHaveFocus message when using .not (#447)
Browse files Browse the repository at this point in the history
Dennis273 authored Mar 24, 2022

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
1 parent 4d0ceeb commit 6988a67
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/to-have-focus.js
Original file line number Diff line number Diff line change
@@ -13,10 +13,19 @@ export function toHaveFocus(element) {
'',
),
'',
'Expected element with focus:',
` ${this.utils.printExpected(element)}`,
'Received element with focus:',
` ${this.utils.printReceived(element.ownerDocument.activeElement)}`,
...(this.isNot
? [
'Received element is focused:',
` ${this.utils.printReceived(element)}`,
]
: [
'Expected element with focus:',
` ${this.utils.printExpected(element)}`,
'Received element with focus:',
` ${this.utils.printReceived(
element.ownerDocument.activeElement,
)}`,
]),
].join('\n')
},
}

0 comments on commit 6988a67

Please sign in to comment.