Skip to content

Commit

Permalink
fix: clarify toHaveFocus message when using .not (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis273 authored Mar 24, 2022
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
Expand Up @@ -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')
},
}
Expand Down

0 comments on commit 6988a67

Please sign in to comment.