web 3d图形渲染器
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.

33 lines
971 B

  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.toBeInTheDocument = toBeInTheDocument;
  6. var _utils = require("./utils");
  7. function toBeInTheDocument(element) {
  8. if (element !== null || !this.isNot) {
  9. (0, _utils.checkHtmlElement)(element, toBeInTheDocument, this);
  10. }
  11. const pass = element === null ? false : element.ownerDocument === element.getRootNode({
  12. composed: true
  13. });
  14. const errorFound = () => {
  15. return `expected document not to contain element, found ${this.utils.stringify(element.cloneNode(true))} instead`;
  16. };
  17. const errorNotFound = () => {
  18. return `element could not be found in the document`;
  19. };
  20. return {
  21. pass,
  22. message: () => {
  23. return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeInTheDocument`, 'element', ''), '', // eslint-disable-next-line babel/new-cap
  24. this.utils.RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound())].join('\n');
  25. }
  26. };
  27. }