We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
.not
1 parent 4d0ceeb commit 6988a67Copy full SHA for 6988a67
src/to-have-focus.js
@@ -13,10 +13,19 @@ export function toHaveFocus(element) {
13
'',
14
),
15
16
- 'Expected element with focus:',
17
- ` ${this.utils.printExpected(element)}`,
18
- 'Received element with focus:',
19
- ` ${this.utils.printReceived(element.ownerDocument.activeElement)}`,
+ ...(this.isNot
+ ? [
+ 'Received element is focused:',
+ ` ${this.utils.printReceived(element)}`,
20
+ ]
21
+ : [
22
+ 'Expected element with focus:',
23
+ ` ${this.utils.printExpected(element)}`,
24
+ 'Received element with focus:',
25
+ ` ${this.utils.printReceived(
26
+ element.ownerDocument.activeElement,
27
+ )}`,
28
+ ]),
29
].join('\n')
30
},
31
}
0 commit comments