You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
686 B
20 lines
686 B
4 years ago
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.toHaveFocus = toHaveFocus;
|
||
|
|
||
|
var _jestMatcherUtils = require("jest-matcher-utils");
|
||
|
|
||
|
var _utils = require("./utils");
|
||
|
|
||
|
function toHaveFocus(element) {
|
||
|
(0, _utils.checkHtmlElement)(element, toHaveFocus, this);
|
||
|
return {
|
||
|
pass: element.ownerDocument.activeElement === element,
|
||
|
message: () => {
|
||
|
return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveFocus`, 'element', ''), '', 'Expected', ` ${(0, _jestMatcherUtils.printExpected)(element)}`, 'Received:', ` ${(0, _jestMatcherUtils.printReceived)(element.ownerDocument.activeElement)}`].join('\n');
|
||
|
}
|
||
|
};
|
||
|
}
|