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.

29 lines
1.1 KiB

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBeEmpty = exports.toBeEmptyElement = void 0;
const jest_matcher_utils_1 = require("jest-matcher-utils");
const utils_1 = require("./utils");
function toBeEmptyElement(element) {
(0, utils_1.checkReactElement)(element, toBeEmptyElement, this);
return {
pass: (0, utils_1.isEmpty)(element?.props?.children),
message: () => {
return [
(0, jest_matcher_utils_1.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEmpty`, 'element', ''),
'',
'Received:',
(0, utils_1.printElement)(element),
].join('\n');
},
};
}
exports.toBeEmptyElement = toBeEmptyElement;
/**
* @deprecated This function has been renamed to `toBeEmptyElement`.
*/
function toBeEmpty(element) {
(0, utils_1.printDeprecationWarning)('toBeEmpty', `"toBeEmpty()" matcher has been renamed to "toBeEmptyElement()". Old name will be deleted in future versions of @testing-library/jest-native.`);
return toBeEmptyElement.call(this, element);
}
exports.toBeEmpty = toBeEmpty;