v2 new release (#77)
This commit is contained in:
committed by
GitHub
parent
217bf70cbd
commit
199ab446df
2
node_modules/pretty-format/build/plugins/DOMCollection.js
generated
vendored
2
node_modules/pretty-format/build/plugins/DOMCollection.js
generated
vendored
@@ -13,6 +13,8 @@ var _collections = require('../collections');
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually */
|
||||
const SPACE = ' ';
|
||||
const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
|
||||
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
|
||||
|
41
node_modules/pretty-format/build/plugins/DOMElement.js
generated
vendored
41
node_modules/pretty-format/build/plugins/DOMElement.js
generated
vendored
@@ -19,17 +19,38 @@ const COMMENT_NODE = 8;
|
||||
const FRAGMENT_NODE = 11;
|
||||
const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
|
||||
|
||||
const testNode = (nodeType, name) =>
|
||||
(nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name)) ||
|
||||
(nodeType === TEXT_NODE && name === 'Text') ||
|
||||
(nodeType === COMMENT_NODE && name === 'Comment') ||
|
||||
(nodeType === FRAGMENT_NODE && name === 'DocumentFragment');
|
||||
const testNode = val => {
|
||||
var _val$hasAttribute;
|
||||
|
||||
const test = val =>
|
||||
val &&
|
||||
val.constructor &&
|
||||
val.constructor.name &&
|
||||
testNode(val.nodeType, val.constructor.name);
|
||||
const constructorName = val.constructor.name;
|
||||
const {nodeType, tagName} = val;
|
||||
const isCustomElement =
|
||||
(typeof tagName === 'string' && tagName.includes('-')) ||
|
||||
((_val$hasAttribute = val.hasAttribute) === null ||
|
||||
_val$hasAttribute === void 0
|
||||
? void 0
|
||||
: _val$hasAttribute.call(val, 'is'));
|
||||
return (
|
||||
(nodeType === ELEMENT_NODE &&
|
||||
(ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||
|
||||
(nodeType === TEXT_NODE && constructorName === 'Text') ||
|
||||
(nodeType === COMMENT_NODE && constructorName === 'Comment') ||
|
||||
(nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment')
|
||||
);
|
||||
};
|
||||
|
||||
const test = val => {
|
||||
var _val$constructor;
|
||||
|
||||
return (
|
||||
(val === null || val === void 0
|
||||
? void 0
|
||||
: (_val$constructor = val.constructor) === null ||
|
||||
_val$constructor === void 0
|
||||
? void 0
|
||||
: _val$constructor.name) && testNode(val)
|
||||
);
|
||||
};
|
||||
|
||||
exports.test = test;
|
||||
|
||||
|
4
node_modules/pretty-format/build/plugins/lib/markup.d.ts
generated
vendored
4
node_modules/pretty-format/build/plugins/lib/markup.d.ts
generated
vendored
@@ -5,8 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import type { Config, Printer, Refs } from '../../types';
|
||||
export declare const printProps: (keys: string[], props: Record<string, unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
||||
export declare const printChildren: (children: any[], config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
||||
export declare const printProps: (keys: Array<string>, props: Record<string, unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
||||
export declare const printChildren: (children: Array<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
||||
export declare const printText: (text: string, config: Config) => string;
|
||||
export declare const printComment: (comment: string, config: Config) => string;
|
||||
export declare const printElement: (type: string, printedProps: string, printedChildren: string, config: Config, indentation: string) => string;
|
||||
|
Reference in New Issue
Block a user