to-be-in-the-dom.js 847 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.toBeInTheDOM = toBeInTheDOM;
  6. var _utils = require("./utils");
  7. function toBeInTheDOM(element, container) {
  8. (0, _utils.deprecate)('toBeInTheDOM', 'Please use toBeInTheDocument for searching the entire document and toContainElement for searching a specific container.');
  9. if (element) {
  10. (0, _utils.checkHtmlElement)(element, toBeInTheDOM, this);
  11. }
  12. if (container) {
  13. (0, _utils.checkHtmlElement)(container, toBeInTheDOM, this);
  14. }
  15. return {
  16. pass: container ? container.contains(element) : !!element,
  17. message: () => {
  18. return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeInTheDOM`, 'element', ''), '', 'Received:', ` ${this.utils.printReceived(element ? element.cloneNode(false) : element)}`].join('\n');
  19. }
  20. };
  21. }