mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 05:32:18 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
5
web/node_modules/@testing-library/jest-dom/CHANGELOG.md
generated
vendored
Normal file
5
web/node_modules/@testing-library/jest-dom/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# CHANGELOG
|
||||
|
||||
The changelog is automatically updated using
|
||||
[semantic-release](https://github.com/semantic-release/semantic-release). You
|
||||
can see it on the [releases page](../../releases).
|
20
web/node_modules/@testing-library/jest-dom/LICENSE
generated
vendored
Normal file
20
web/node_modules/@testing-library/jest-dom/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
Copyright (c) 2017 Kent C. Dodds
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
1413
web/node_modules/@testing-library/jest-dom/README.md
generated
vendored
Normal file
1413
web/node_modules/@testing-library/jest-dom/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
9
web/node_modules/@testing-library/jest-dom/dist/extend-expect.js
generated
vendored
Normal file
9
web/node_modules/@testing-library/jest-dom/dist/extend-expect.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
var extensions = _interopRequireWildcard(require("./matchers"));
|
||||
|
||||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
||||
|
||||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
expect.extend(extensions);
|
3
web/node_modules/@testing-library/jest-dom/dist/index.js
generated
vendored
Normal file
3
web/node_modules/@testing-library/jest-dom/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
require("./extend-expect");
|
209
web/node_modules/@testing-library/jest-dom/dist/matchers.js
generated
vendored
Normal file
209
web/node_modules/@testing-library/jest-dom/dist/matchers.js
generated
vendored
Normal file
|
@ -0,0 +1,209 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "toBeInTheDOM", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeInTheDom.toBeInTheDOM;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeInTheDocument", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeInTheDocument.toBeInTheDocument;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeEmpty", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeEmpty.toBeEmpty;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeEmptyDOMElement", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeEmptyDomElement.toBeEmptyDOMElement;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toContainElement", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toContainElement.toContainElement;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toContainHTML", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toContainHtml.toContainHTML;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveTextContent", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveTextContent.toHaveTextContent;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveAccessibleDescription", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveAccessibleDescription.toHaveAccessibleDescription;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveAccessibleName", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveAccessibleName.toHaveAccessibleName;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveAttribute", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveAttribute.toHaveAttribute;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveClass", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveClass.toHaveClass;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveStyle", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveStyle.toHaveStyle;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveFocus", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveFocus.toHaveFocus;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveFormValues", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveFormValues.toHaveFormValues;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeVisible", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeVisible.toBeVisible;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeDisabled", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeDisabled.toBeDisabled;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeEnabled", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeDisabled.toBeEnabled;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeRequired", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeRequired.toBeRequired;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeInvalid", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeInvalid.toBeInvalid;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeValid", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeInvalid.toBeValid;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveValue", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveValue.toHaveValue;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveDisplayValue", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveDisplayValue.toHaveDisplayValue;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBeChecked", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBeChecked.toBeChecked;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBePartiallyChecked", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBePartiallyChecked.toBePartiallyChecked;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveDescription", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveDescription.toHaveDescription;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toHaveErrorMessage", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toHaveErrormessage.toHaveErrorMessage;
|
||||
}
|
||||
});
|
||||
|
||||
var _toBeInTheDom = require("./to-be-in-the-dom");
|
||||
|
||||
var _toBeInTheDocument = require("./to-be-in-the-document");
|
||||
|
||||
var _toBeEmpty = require("./to-be-empty");
|
||||
|
||||
var _toBeEmptyDomElement = require("./to-be-empty-dom-element");
|
||||
|
||||
var _toContainElement = require("./to-contain-element");
|
||||
|
||||
var _toContainHtml = require("./to-contain-html");
|
||||
|
||||
var _toHaveTextContent = require("./to-have-text-content");
|
||||
|
||||
var _toHaveAccessibleDescription = require("./to-have-accessible-description");
|
||||
|
||||
var _toHaveAccessibleName = require("./to-have-accessible-name");
|
||||
|
||||
var _toHaveAttribute = require("./to-have-attribute");
|
||||
|
||||
var _toHaveClass = require("./to-have-class");
|
||||
|
||||
var _toHaveStyle = require("./to-have-style");
|
||||
|
||||
var _toHaveFocus = require("./to-have-focus");
|
||||
|
||||
var _toHaveFormValues = require("./to-have-form-values");
|
||||
|
||||
var _toBeVisible = require("./to-be-visible");
|
||||
|
||||
var _toBeDisabled = require("./to-be-disabled");
|
||||
|
||||
var _toBeRequired = require("./to-be-required");
|
||||
|
||||
var _toBeInvalid = require("./to-be-invalid");
|
||||
|
||||
var _toHaveValue = require("./to-have-value");
|
||||
|
||||
var _toHaveDisplayValue = require("./to-have-display-value");
|
||||
|
||||
var _toBeChecked = require("./to-be-checked");
|
||||
|
||||
var _toBePartiallyChecked = require("./to-be-partially-checked");
|
||||
|
||||
var _toHaveDescription = require("./to-have-description");
|
||||
|
||||
var _toHaveErrormessage = require("./to-have-errormessage");
|
56
web/node_modules/@testing-library/jest-dom/dist/to-be-checked.js
generated
vendored
Normal file
56
web/node_modules/@testing-library/jest-dom/dist/to-be-checked.js
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeChecked = toBeChecked;
|
||||
|
||||
var _ariaQuery = require("aria-query");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toBeChecked(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeChecked, this);
|
||||
|
||||
const isValidInput = () => {
|
||||
return element.tagName.toLowerCase() === 'input' && ['checkbox', 'radio'].includes(element.type);
|
||||
};
|
||||
|
||||
if (!isValidInput() && !(() => {
|
||||
return roleSupportsChecked(element.getAttribute('role')) && ['true', 'false'].includes(element.getAttribute('aria-checked'));
|
||||
})()) {
|
||||
return {
|
||||
pass: false,
|
||||
message: () => `only inputs with type="checkbox" or type="radio" or elements with ${supportedRolesSentence()} and a valid aria-checked attribute can be used with .toBeChecked(). Use .toHaveValue() instead`
|
||||
};
|
||||
}
|
||||
|
||||
const isChecked = () => {
|
||||
if (isValidInput()) return element.checked;
|
||||
return element.getAttribute('aria-checked') === 'true';
|
||||
};
|
||||
|
||||
return {
|
||||
pass: isChecked(),
|
||||
message: () => {
|
||||
const is = isChecked() ? 'is' : 'is not';
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''), '', `Received element ${is} checked:`, ` ${this.utils.printReceived(element.cloneNode(false))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function supportedRolesSentence() {
|
||||
return (0, _utils.toSentence)(supportedRoles().map(role => `role="${role}"`), {
|
||||
lastWordConnector: ' or '
|
||||
});
|
||||
}
|
||||
|
||||
function supportedRoles() {
|
||||
return Array.from(_ariaQuery.roles.keys()).filter(roleSupportsChecked);
|
||||
}
|
||||
|
||||
function roleSupportsChecked(role) {
|
||||
var _roles$get;
|
||||
|
||||
return ((_roles$get = _ariaQuery.roles.get(role)) == null ? void 0 : _roles$get.props['aria-checked']) !== undefined;
|
||||
}
|
70
web/node_modules/@testing-library/jest-dom/dist/to-be-disabled.js
generated
vendored
Normal file
70
web/node_modules/@testing-library/jest-dom/dist/to-be-disabled.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeDisabled = toBeDisabled;
|
||||
exports.toBeEnabled = toBeEnabled;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
// form elements that support 'disabled'
|
||||
const FORM_TAGS = ['fieldset', 'input', 'select', 'optgroup', 'option', 'button', 'textarea'];
|
||||
/*
|
||||
* According to specification:
|
||||
* If <fieldset> is disabled, the form controls that are its descendants,
|
||||
* except descendants of its first optional <legend> element, are disabled
|
||||
*
|
||||
* https://html.spec.whatwg.org/multipage/form-elements.html#concept-fieldset-disabled
|
||||
*
|
||||
* This method tests whether element is first legend child of fieldset parent
|
||||
*/
|
||||
|
||||
function isFirstLegendChildOfFieldset(element, parent) {
|
||||
return (0, _utils.getTag)(element) === 'legend' && (0, _utils.getTag)(parent) === 'fieldset' && element.isSameNode(Array.from(parent.children).find(child => (0, _utils.getTag)(child) === 'legend'));
|
||||
}
|
||||
|
||||
function isElementDisabledByParent(element, parent) {
|
||||
return isElementDisabled(parent) && !isFirstLegendChildOfFieldset(element, parent);
|
||||
}
|
||||
|
||||
function canElementBeDisabled(element) {
|
||||
return FORM_TAGS.includes((0, _utils.getTag)(element));
|
||||
}
|
||||
|
||||
function isElementDisabled(element) {
|
||||
return canElementBeDisabled(element) && element.hasAttribute('disabled');
|
||||
}
|
||||
|
||||
function isAncestorDisabled(element) {
|
||||
const parent = element.parentElement;
|
||||
return Boolean(parent) && (isElementDisabledByParent(element, parent) || isAncestorDisabled(parent));
|
||||
}
|
||||
|
||||
function isElementOrAncestorDisabled(element) {
|
||||
return canElementBeDisabled(element) && (isElementDisabled(element) || isAncestorDisabled(element));
|
||||
}
|
||||
|
||||
function toBeDisabled(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeDisabled, this);
|
||||
const isDisabled = isElementOrAncestorDisabled(element);
|
||||
return {
|
||||
pass: isDisabled,
|
||||
message: () => {
|
||||
const is = isDisabled ? 'is' : 'is not';
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''), '', `Received element ${is} disabled:`, ` ${this.utils.printReceived(element.cloneNode(false))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function toBeEnabled(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeEnabled, this);
|
||||
const isEnabled = !isElementOrAncestorDisabled(element);
|
||||
return {
|
||||
pass: isEnabled,
|
||||
message: () => {
|
||||
const is = isEnabled ? 'is' : 'is not';
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''), '', `Received element ${is} enabled:`, ` ${this.utils.printReceived(element.cloneNode(false))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
32
web/node_modules/@testing-library/jest-dom/dist/to-be-empty-dom-element.js
generated
vendored
Normal file
32
web/node_modules/@testing-library/jest-dom/dist/to-be-empty-dom-element.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeEmptyDOMElement = toBeEmptyDOMElement;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toBeEmptyDOMElement(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeEmptyDOMElement, this);
|
||||
return {
|
||||
pass: isEmptyElement(element),
|
||||
message: () => {
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeEmptyDOMElement`, 'element', ''), '', 'Received:', ` ${this.utils.printReceived(element.innerHTML)}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Identifies if an element doesn't contain child nodes (excluding comments)
|
||||
* ℹ Node.COMMENT_NODE can't be used because of the following issue
|
||||
* https://github.com/jsdom/jsdom/issues/2220
|
||||
*
|
||||
* @param {*} element an HtmlElement or SVGElement
|
||||
* @return {*} true if the element only contains comments or none
|
||||
*/
|
||||
|
||||
|
||||
function isEmptyElement(element) {
|
||||
const nonCommentChildNodes = [...element.childNodes].filter(node => node.nodeType !== 8);
|
||||
return nonCommentChildNodes.length === 0;
|
||||
}
|
19
web/node_modules/@testing-library/jest-dom/dist/to-be-empty.js
generated
vendored
Normal file
19
web/node_modules/@testing-library/jest-dom/dist/to-be-empty.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeEmpty = toBeEmpty;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toBeEmpty(element) {
|
||||
(0, _utils.deprecate)('toBeEmpty', 'Please use instead toBeEmptyDOMElement for finding empty nodes in the DOM.');
|
||||
(0, _utils.checkHtmlElement)(element, toBeEmpty, this);
|
||||
return {
|
||||
pass: element.innerHTML === '',
|
||||
message: () => {
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeEmpty`, 'element', ''), '', 'Received:', ` ${this.utils.printReceived(element.innerHTML)}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
34
web/node_modules/@testing-library/jest-dom/dist/to-be-in-the-document.js
generated
vendored
Normal file
34
web/node_modules/@testing-library/jest-dom/dist/to-be-in-the-document.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeInTheDocument = toBeInTheDocument;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toBeInTheDocument(element) {
|
||||
if (element !== null || !this.isNot) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeInTheDocument, this);
|
||||
}
|
||||
|
||||
const pass = element === null ? false : element.ownerDocument === element.getRootNode({
|
||||
composed: true
|
||||
});
|
||||
|
||||
const errorFound = () => {
|
||||
return `expected document not to contain element, found ${this.utils.stringify(element.cloneNode(true))} instead`;
|
||||
};
|
||||
|
||||
const errorNotFound = () => {
|
||||
return `element could not be found in the document`;
|
||||
};
|
||||
|
||||
return {
|
||||
pass,
|
||||
message: () => {
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeInTheDocument`, 'element', ''), '', // eslint-disable-next-line babel/new-cap
|
||||
this.utils.RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound())].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
27
web/node_modules/@testing-library/jest-dom/dist/to-be-in-the-dom.js
generated
vendored
Normal file
27
web/node_modules/@testing-library/jest-dom/dist/to-be-in-the-dom.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeInTheDOM = toBeInTheDOM;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toBeInTheDOM(element, container) {
|
||||
(0, _utils.deprecate)('toBeInTheDOM', 'Please use toBeInTheDocument for searching the entire document and toContainElement for searching a specific container.');
|
||||
|
||||
if (element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeInTheDOM, this);
|
||||
}
|
||||
|
||||
if (container) {
|
||||
(0, _utils.checkHtmlElement)(container, toBeInTheDOM, this);
|
||||
}
|
||||
|
||||
return {
|
||||
pass: container ? container.contains(element) : !!element,
|
||||
message: () => {
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeInTheDOM`, 'element', ''), '', 'Received:', ` ${this.utils.printReceived(element ? element.cloneNode(false) : element)}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
53
web/node_modules/@testing-library/jest-dom/dist/to-be-invalid.js
generated
vendored
Normal file
53
web/node_modules/@testing-library/jest-dom/dist/to-be-invalid.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeInvalid = toBeInvalid;
|
||||
exports.toBeValid = toBeValid;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
const FORM_TAGS = ['form', 'input', 'select', 'textarea'];
|
||||
|
||||
function isElementHavingAriaInvalid(element) {
|
||||
return element.hasAttribute('aria-invalid') && element.getAttribute('aria-invalid') !== 'false';
|
||||
}
|
||||
|
||||
function isSupportsValidityMethod(element) {
|
||||
return FORM_TAGS.includes((0, _utils.getTag)(element));
|
||||
}
|
||||
|
||||
function isElementInvalid(element) {
|
||||
const isHaveAriaInvalid = isElementHavingAriaInvalid(element);
|
||||
|
||||
if (isSupportsValidityMethod(element)) {
|
||||
return isHaveAriaInvalid || !element.checkValidity();
|
||||
} else {
|
||||
return isHaveAriaInvalid;
|
||||
}
|
||||
}
|
||||
|
||||
function toBeInvalid(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeInvalid, this);
|
||||
const isInvalid = isElementInvalid(element);
|
||||
return {
|
||||
pass: isInvalid,
|
||||
message: () => {
|
||||
const is = isInvalid ? 'is' : 'is not';
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeInvalid`, 'element', ''), '', `Received element ${is} currently invalid:`, ` ${this.utils.printReceived(element.cloneNode(false))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function toBeValid(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeValid, this);
|
||||
const isValid = !isElementInvalid(element);
|
||||
return {
|
||||
pass: isValid,
|
||||
message: () => {
|
||||
const is = isValid ? 'is' : 'is not';
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeValid`, 'element', ''), '', `Received element ${is} currently valid:`, ` ${this.utils.printReceived(element.cloneNode(false))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
43
web/node_modules/@testing-library/jest-dom/dist/to-be-partially-checked.js
generated
vendored
Normal file
43
web/node_modules/@testing-library/jest-dom/dist/to-be-partially-checked.js
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBePartiallyChecked = toBePartiallyChecked;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toBePartiallyChecked(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBePartiallyChecked, this);
|
||||
|
||||
const isValidInput = () => {
|
||||
return element.tagName.toLowerCase() === 'input' && element.type === 'checkbox';
|
||||
};
|
||||
|
||||
if (!isValidInput() && !(() => {
|
||||
return element.getAttribute('role') === 'checkbox';
|
||||
})()) {
|
||||
return {
|
||||
pass: false,
|
||||
message: () => 'only inputs with type="checkbox" or elements with role="checkbox" and a valid aria-checked attribute can be used with .toBePartiallyChecked(). Use .toHaveValue() instead'
|
||||
};
|
||||
}
|
||||
|
||||
const isPartiallyChecked = () => {
|
||||
const isAriaMixed = element.getAttribute('aria-checked') === 'mixed';
|
||||
|
||||
if (isValidInput()) {
|
||||
return element.indeterminate || isAriaMixed;
|
||||
}
|
||||
|
||||
return isAriaMixed;
|
||||
};
|
||||
|
||||
return {
|
||||
pass: isPartiallyChecked(),
|
||||
message: () => {
|
||||
const is = isPartiallyChecked() ? 'is' : 'is not';
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'element', ''), '', `Received element ${is} partially checked:`, ` ${this.utils.printReceived(element.cloneNode(false))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
38
web/node_modules/@testing-library/jest-dom/dist/to-be-required.js
generated
vendored
Normal file
38
web/node_modules/@testing-library/jest-dom/dist/to-be-required.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeRequired = toBeRequired;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
// form elements that support 'required'
|
||||
const FORM_TAGS = ['select', 'textarea'];
|
||||
const ARIA_FORM_TAGS = ['input', 'select', 'textarea'];
|
||||
const UNSUPPORTED_INPUT_TYPES = ['color', 'hidden', 'range', 'submit', 'image', 'reset'];
|
||||
const SUPPORTED_ARIA_ROLES = ['combobox', 'gridcell', 'radiogroup', 'spinbutton', 'tree'];
|
||||
|
||||
function isRequiredOnFormTagsExceptInput(element) {
|
||||
return FORM_TAGS.includes((0, _utils.getTag)(element)) && element.hasAttribute('required');
|
||||
}
|
||||
|
||||
function isRequiredOnSupportedInput(element) {
|
||||
return (0, _utils.getTag)(element) === 'input' && element.hasAttribute('required') && (element.hasAttribute('type') && !UNSUPPORTED_INPUT_TYPES.includes(element.getAttribute('type')) || !element.hasAttribute('type'));
|
||||
}
|
||||
|
||||
function isElementRequiredByARIA(element) {
|
||||
return element.hasAttribute('aria-required') && element.getAttribute('aria-required') === 'true' && (ARIA_FORM_TAGS.includes((0, _utils.getTag)(element)) || element.hasAttribute('role') && SUPPORTED_ARIA_ROLES.includes(element.getAttribute('role')));
|
||||
}
|
||||
|
||||
function toBeRequired(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeRequired, this);
|
||||
const isRequired = isRequiredOnFormTagsExceptInput(element) || isRequiredOnSupportedInput(element) || isElementRequiredByARIA(element);
|
||||
return {
|
||||
pass: isRequired,
|
||||
message: () => {
|
||||
const is = isRequired ? 'is' : 'is not';
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeRequired`, 'element', ''), '', `Received element ${is} required:`, ` ${this.utils.printReceived(element.cloneNode(false))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
43
web/node_modules/@testing-library/jest-dom/dist/to-be-visible.js
generated
vendored
Normal file
43
web/node_modules/@testing-library/jest-dom/dist/to-be-visible.js
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toBeVisible = toBeVisible;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function isStyleVisible(element) {
|
||||
const {
|
||||
getComputedStyle
|
||||
} = element.ownerDocument.defaultView;
|
||||
const {
|
||||
display,
|
||||
visibility,
|
||||
opacity
|
||||
} = getComputedStyle(element);
|
||||
return display !== 'none' && visibility !== 'hidden' && visibility !== 'collapse' && opacity !== '0' && opacity !== 0;
|
||||
}
|
||||
|
||||
function isAttributeVisible(element, previousElement) {
|
||||
return !element.hasAttribute('hidden') && (element.nodeName === 'DETAILS' && previousElement.nodeName !== 'SUMMARY' ? element.hasAttribute('open') : true);
|
||||
}
|
||||
|
||||
function isElementVisible(element, previousElement) {
|
||||
return isStyleVisible(element) && isAttributeVisible(element, previousElement) && (!element.parentElement || isElementVisible(element.parentElement, element));
|
||||
}
|
||||
|
||||
function toBeVisible(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toBeVisible, this);
|
||||
const isInDocument = element.ownerDocument === element.getRootNode({
|
||||
composed: true
|
||||
});
|
||||
const isVisible = isInDocument && isElementVisible(element);
|
||||
return {
|
||||
pass: isVisible,
|
||||
message: () => {
|
||||
const is = isVisible ? 'is' : 'is not';
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toBeVisible`, 'element', ''), '', `Received element ${is} visible${isInDocument ? '' : ' (element is not in the document)'}:`, ` ${this.utils.printReceived(element.cloneNode(false))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
25
web/node_modules/@testing-library/jest-dom/dist/to-contain-element.js
generated
vendored
Normal file
25
web/node_modules/@testing-library/jest-dom/dist/to-contain-element.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toContainElement = toContainElement;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toContainElement(container, element) {
|
||||
(0, _utils.checkHtmlElement)(container, toContainElement, this);
|
||||
|
||||
if (element !== null) {
|
||||
(0, _utils.checkHtmlElement)(element, toContainElement, this);
|
||||
}
|
||||
|
||||
return {
|
||||
pass: container.contains(element),
|
||||
message: () => {
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toContainElement`, 'element', 'element'), '', // eslint-disable-next-line babel/new-cap
|
||||
this.utils.RECEIVED_COLOR(`${this.utils.stringify(container.cloneNode(false))} ${this.isNot ? 'contains:' : 'does not contain:'} ${this.utils.stringify(element ? element.cloneNode(false) : element)}
|
||||
`)].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
30
web/node_modules/@testing-library/jest-dom/dist/to-contain-html.js
generated
vendored
Normal file
30
web/node_modules/@testing-library/jest-dom/dist/to-contain-html.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toContainHTML = toContainHTML;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function getNormalizedHtml(container, htmlText) {
|
||||
const div = container.ownerDocument.createElement('div');
|
||||
div.innerHTML = htmlText;
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
function toContainHTML(container, htmlText) {
|
||||
(0, _utils.checkHtmlElement)(container, toContainHTML, this);
|
||||
|
||||
if (typeof htmlText !== 'string') {
|
||||
throw new Error(`.toContainHTML() expects a string value, got ${htmlText}`);
|
||||
}
|
||||
|
||||
return {
|
||||
pass: container.outerHTML.includes(getNormalizedHtml(container, htmlText)),
|
||||
message: () => {
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toContainHTML`, 'element', ''), 'Expected:', // eslint-disable-next-line babel/new-cap
|
||||
` ${this.utils.EXPECTED_COLOR(htmlText)}`, 'Received:', ` ${this.utils.printReceived(container.cloneNode(true))}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
33
web/node_modules/@testing-library/jest-dom/dist/to-have-accessible-description.js
generated
vendored
Normal file
33
web/node_modules/@testing-library/jest-dom/dist/to-have-accessible-description.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveAccessibleDescription = toHaveAccessibleDescription;
|
||||
|
||||
var _domAccessibilityApi = require("dom-accessibility-api");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toHaveAccessibleDescription(htmlElement, expectedAccessibleDescription) {
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveAccessibleDescription, this);
|
||||
const actualAccessibleDescription = (0, _domAccessibilityApi.computeAccessibleDescription)(htmlElement);
|
||||
const missingExpectedValue = arguments.length === 1;
|
||||
let pass = false;
|
||||
|
||||
if (missingExpectedValue) {
|
||||
// When called without an expected value we only want to validate that the element has an
|
||||
// accessible description, whatever it may be.
|
||||
pass = actualAccessibleDescription !== '';
|
||||
} else {
|
||||
pass = expectedAccessibleDescription instanceof RegExp ? expectedAccessibleDescription.test(actualAccessibleDescription) : this.equals(actualAccessibleDescription, expectedAccessibleDescription);
|
||||
}
|
||||
|
||||
return {
|
||||
pass,
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
return (0, _utils.getMessage)(this, this.utils.matcherHint(`${this.isNot ? '.not' : ''}.${toHaveAccessibleDescription.name}`, 'element', ''), `Expected element ${to} have accessible description`, expectedAccessibleDescription, 'Received', actualAccessibleDescription);
|
||||
}
|
||||
};
|
||||
}
|
33
web/node_modules/@testing-library/jest-dom/dist/to-have-accessible-name.js
generated
vendored
Normal file
33
web/node_modules/@testing-library/jest-dom/dist/to-have-accessible-name.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveAccessibleName = toHaveAccessibleName;
|
||||
|
||||
var _domAccessibilityApi = require("dom-accessibility-api");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toHaveAccessibleName(htmlElement, expectedAccessibleName) {
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveAccessibleName, this);
|
||||
const actualAccessibleName = (0, _domAccessibilityApi.computeAccessibleName)(htmlElement);
|
||||
const missingExpectedValue = arguments.length === 1;
|
||||
let pass = false;
|
||||
|
||||
if (missingExpectedValue) {
|
||||
// When called without an expected value we only want to validate that the element has an
|
||||
// accessible name, whatever it may be.
|
||||
pass = actualAccessibleName !== '';
|
||||
} else {
|
||||
pass = expectedAccessibleName instanceof RegExp ? expectedAccessibleName.test(actualAccessibleName) : this.equals(actualAccessibleName, expectedAccessibleName);
|
||||
}
|
||||
|
||||
return {
|
||||
pass,
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
return (0, _utils.getMessage)(this, this.utils.matcherHint(`${this.isNot ? '.not' : ''}.${toHaveAccessibleName.name}`, 'element', ''), `Expected element ${to} have accessible name`, expectedAccessibleName, 'Received', actualAccessibleName);
|
||||
}
|
||||
};
|
||||
}
|
35
web/node_modules/@testing-library/jest-dom/dist/to-have-attribute.js
generated
vendored
Normal file
35
web/node_modules/@testing-library/jest-dom/dist/to-have-attribute.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveAttribute = toHaveAttribute;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function printAttribute(stringify, name, value) {
|
||||
return value === undefined ? name : `${name}=${stringify(value)}`;
|
||||
}
|
||||
|
||||
function getAttributeComment(stringify, name, value) {
|
||||
return value === undefined ? `element.hasAttribute(${stringify(name)})` : `element.getAttribute(${stringify(name)}) === ${stringify(value)}`;
|
||||
}
|
||||
|
||||
function toHaveAttribute(htmlElement, name, expectedValue) {
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveAttribute, this);
|
||||
const isExpectedValuePresent = expectedValue !== undefined;
|
||||
const hasAttribute = htmlElement.hasAttribute(name);
|
||||
const receivedValue = htmlElement.getAttribute(name);
|
||||
return {
|
||||
pass: isExpectedValuePresent ? hasAttribute && this.equals(receivedValue, expectedValue) : hasAttribute,
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
const receivedAttribute = hasAttribute ? printAttribute(this.utils.stringify, name, receivedValue) : null;
|
||||
const matcher = this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toHaveAttribute`, 'element', this.utils.printExpected(name), {
|
||||
secondArgument: isExpectedValuePresent ? this.utils.printExpected(expectedValue) : undefined,
|
||||
comment: getAttributeComment(this.utils.stringify, name, expectedValue)
|
||||
});
|
||||
return (0, _utils.getMessage)(this, matcher, `Expected the element ${to} have attribute`, printAttribute(this.utils.stringify, name, expectedValue), 'Received', receivedAttribute);
|
||||
}
|
||||
};
|
||||
}
|
71
web/node_modules/@testing-library/jest-dom/dist/to-have-class.js
generated
vendored
Normal file
71
web/node_modules/@testing-library/jest-dom/dist/to-have-class.js
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveClass = toHaveClass;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function getExpectedClassNamesAndOptions(params) {
|
||||
const lastParam = params.pop();
|
||||
let expectedClassNames, options;
|
||||
|
||||
if (typeof lastParam === 'object') {
|
||||
expectedClassNames = params;
|
||||
options = lastParam;
|
||||
} else {
|
||||
expectedClassNames = params.concat(lastParam);
|
||||
options = {
|
||||
exact: false
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
expectedClassNames,
|
||||
options
|
||||
};
|
||||
}
|
||||
|
||||
function splitClassNames(str) {
|
||||
if (!str) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return str.split(/\s+/).filter(s => s.length > 0);
|
||||
}
|
||||
|
||||
function isSubset(subset, superset) {
|
||||
return subset.every(item => superset.includes(item));
|
||||
}
|
||||
|
||||
function toHaveClass(htmlElement, ...params) {
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveClass, this);
|
||||
const {
|
||||
expectedClassNames,
|
||||
options
|
||||
} = getExpectedClassNamesAndOptions(params);
|
||||
const received = splitClassNames(htmlElement.getAttribute('class'));
|
||||
const expected = expectedClassNames.reduce((acc, className) => acc.concat(splitClassNames(className)), []);
|
||||
|
||||
if (options.exact) {
|
||||
return {
|
||||
pass: isSubset(expected, received) && expected.length === received.length,
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
return (0, _utils.getMessage)(this, `Expected the element ${to} have EXACTLY defined classes`, expected.join(' '), 'Received', received.join(' '));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return expected.length > 0 ? {
|
||||
pass: isSubset(expected, received),
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
return (0, _utils.getMessage)(this, this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toHaveClass`, 'element', this.utils.printExpected(expected.join(' '))), `Expected the element ${to} have class`, expected.join(' '), 'Received', received.join(' '));
|
||||
}
|
||||
} : {
|
||||
pass: this.isNot ? received.length > 0 : false,
|
||||
message: () => this.isNot ? (0, _utils.getMessage)(this, this.utils.matcherHint('.not.toHaveClass', 'element', ''), 'Expected the element to have classes', '(none)', 'Received', received.join(' ')) : [this.utils.matcherHint(`.toHaveClass`, 'element'), 'At least one expected class must be provided.'].join('\n')
|
||||
};
|
||||
}
|
32
web/node_modules/@testing-library/jest-dom/dist/to-have-description.js
generated
vendored
Normal file
32
web/node_modules/@testing-library/jest-dom/dist/to-have-description.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveDescription = toHaveDescription;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
// See algoritm: https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description
|
||||
function toHaveDescription(htmlElement, checkWith) {
|
||||
(0, _utils.deprecate)('toBeInTheDOM', 'Please use toBeInTheDocument for searching the entire document and toContainElement for searching a specific container.');
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveDescription, this);
|
||||
const expectsDescription = checkWith !== undefined;
|
||||
const descriptionIDRaw = htmlElement.getAttribute('aria-describedby') || '';
|
||||
const descriptionIDs = descriptionIDRaw.split(/\s+/).filter(Boolean);
|
||||
let description = '';
|
||||
|
||||
if (descriptionIDs.length > 0) {
|
||||
const document = htmlElement.ownerDocument;
|
||||
const descriptionEls = descriptionIDs.map(descriptionID => document.getElementById(descriptionID)).filter(Boolean);
|
||||
description = (0, _utils.normalize)(descriptionEls.map(el => el.textContent).join(' '));
|
||||
}
|
||||
|
||||
return {
|
||||
pass: expectsDescription ? checkWith instanceof RegExp ? checkWith.test(description) : this.equals(description, checkWith) : Boolean(description),
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
return (0, _utils.getMessage)(this, this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toHaveDescription`, 'element', ''), `Expected the element ${to} have description`, this.utils.printExpected(checkWith), 'Received', this.utils.printReceived(description));
|
||||
}
|
||||
};
|
||||
}
|
39
web/node_modules/@testing-library/jest-dom/dist/to-have-display-value.js
generated
vendored
Normal file
39
web/node_modules/@testing-library/jest-dom/dist/to-have-display-value.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveDisplayValue = toHaveDisplayValue;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toHaveDisplayValue(htmlElement, expectedValue) {
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveDisplayValue, this);
|
||||
const tagName = htmlElement.tagName.toLowerCase();
|
||||
|
||||
if (!['select', 'input', 'textarea'].includes(tagName)) {
|
||||
throw new Error('.toHaveDisplayValue() currently supports only input, textarea or select elements, try with another matcher instead.');
|
||||
}
|
||||
|
||||
if (tagName === 'input' && ['radio', 'checkbox'].includes(htmlElement.type)) {
|
||||
throw new Error(`.toHaveDisplayValue() currently does not support input[type="${htmlElement.type}"], try with another matcher instead.`);
|
||||
}
|
||||
|
||||
const values = getValues(tagName, htmlElement);
|
||||
const expectedValues = getExpectedValues(expectedValue);
|
||||
const numberOfMatchesWithValues = expectedValues.filter(expected => values.some(value => expected instanceof RegExp ? expected.test(value) : this.equals(value, String(expected)))).length;
|
||||
const matchedWithAllValues = numberOfMatchesWithValues === values.length;
|
||||
const matchedWithAllExpectedValues = numberOfMatchesWithValues === expectedValues.length;
|
||||
return {
|
||||
pass: matchedWithAllValues && matchedWithAllExpectedValues,
|
||||
message: () => (0, _utils.getMessage)(this, this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toHaveDisplayValue`, 'element', ''), `Expected element ${this.isNot ? 'not ' : ''}to have display value`, expectedValue, 'Received', values)
|
||||
};
|
||||
}
|
||||
|
||||
function getValues(tagName, htmlElement) {
|
||||
return tagName === 'select' ? Array.from(htmlElement).filter(option => option.selected).map(option => option.textContent) : [htmlElement.value];
|
||||
}
|
||||
|
||||
function getExpectedValues(expectedValue) {
|
||||
return expectedValue instanceof Array ? expectedValue : [expectedValue];
|
||||
}
|
42
web/node_modules/@testing-library/jest-dom/dist/to-have-errormessage.js
generated
vendored
Normal file
42
web/node_modules/@testing-library/jest-dom/dist/to-have-errormessage.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveErrorMessage = toHaveErrorMessage;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
// See aria-errormessage spec https://www.w3.org/TR/wai-aria-1.2/#aria-errormessage
|
||||
function toHaveErrorMessage(htmlElement, checkWith) {
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveErrorMessage, this);
|
||||
|
||||
if (!htmlElement.hasAttribute('aria-invalid') || htmlElement.getAttribute('aria-invalid') === 'false') {
|
||||
const not = this.isNot ? '.not' : '';
|
||||
return {
|
||||
pass: false,
|
||||
message: () => {
|
||||
return (0, _utils.getMessage)(this, this.utils.matcherHint(`${not}.toHaveErrorMessage`, 'element', ''), `Expected the element to have invalid state indicated by`, 'aria-invalid="true"', 'Received', htmlElement.hasAttribute('aria-invalid') ? `aria-invalid="${htmlElement.getAttribute('aria-invalid')}"` : this.utils.printReceived(''));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const expectsErrorMessage = checkWith !== undefined;
|
||||
const errormessageIDRaw = htmlElement.getAttribute('aria-errormessage') || '';
|
||||
const errormessageIDs = errormessageIDRaw.split(/\s+/).filter(Boolean);
|
||||
let errormessage = '';
|
||||
|
||||
if (errormessageIDs.length > 0) {
|
||||
const document = htmlElement.ownerDocument;
|
||||
const errormessageEls = errormessageIDs.map(errormessageID => document.getElementById(errormessageID)).filter(Boolean);
|
||||
errormessage = (0, _utils.normalize)(errormessageEls.map(el => el.textContent).join(' '));
|
||||
}
|
||||
|
||||
return {
|
||||
pass: expectsErrorMessage ? checkWith instanceof RegExp ? checkWith.test(errormessage) : this.equals(errormessage, checkWith) : Boolean(errormessage),
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
return (0, _utils.getMessage)(this, this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toHaveErrorMessage`, 'element', ''), `Expected the element ${to} have error message`, this.utils.printExpected(checkWith), 'Received', this.utils.printReceived(errormessage));
|
||||
}
|
||||
};
|
||||
}
|
18
web/node_modules/@testing-library/jest-dom/dist/to-have-focus.js
generated
vendored
Normal file
18
web/node_modules/@testing-library/jest-dom/dist/to-have-focus.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveFocus = toHaveFocus;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toHaveFocus(element) {
|
||||
(0, _utils.checkHtmlElement)(element, toHaveFocus, this);
|
||||
return {
|
||||
pass: element.ownerDocument.activeElement === element,
|
||||
message: () => {
|
||||
return [this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toHaveFocus`, 'element', ''), '', 'Expected element with focus:', ` ${this.utils.printExpected(element)}`, 'Received element with focus:', ` ${this.utils.printReceived(element.ownerDocument.activeElement)}`].join('\n');
|
||||
}
|
||||
};
|
||||
}
|
94
web/node_modules/@testing-library/jest-dom/dist/to-have-form-values.js
generated
vendored
Normal file
94
web/node_modules/@testing-library/jest-dom/dist/to-have-form-values.js
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveFormValues = toHaveFormValues;
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _isEqualWith = _interopRequireDefault(require("lodash/isEqualWith"));
|
||||
|
||||
var _uniq = _interopRequireDefault(require("lodash/uniq"));
|
||||
|
||||
var _css = _interopRequireDefault(require("css.escape"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
// Returns the combined value of several elements that have the same name
|
||||
// e.g. radio buttons or groups of checkboxes
|
||||
function getMultiElementValue(elements) {
|
||||
const types = (0, _uniq.default)(elements.map(element => element.type));
|
||||
|
||||
if (types.length !== 1) {
|
||||
throw new Error('Multiple form elements with the same name must be of the same type');
|
||||
}
|
||||
|
||||
switch (types[0]) {
|
||||
case 'radio':
|
||||
{
|
||||
const theChosenOne = elements.find(radio => radio.checked);
|
||||
return theChosenOne ? theChosenOne.value : undefined;
|
||||
}
|
||||
|
||||
case 'checkbox':
|
||||
return elements.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
|
||||
|
||||
default:
|
||||
// NOTE: Not even sure this is a valid use case, but just in case...
|
||||
return elements.map(element => element.value);
|
||||
}
|
||||
}
|
||||
|
||||
function getFormValue(container, name) {
|
||||
const elements = [...container.querySelectorAll(`[name="${(0, _css.default)(name)}"]`)];
|
||||
/* istanbul ignore if */
|
||||
|
||||
if (elements.length === 0) {
|
||||
return undefined; // shouldn't happen, but just in case
|
||||
}
|
||||
|
||||
switch (elements.length) {
|
||||
case 1:
|
||||
return (0, _utils.getSingleElementValue)(elements[0]);
|
||||
|
||||
default:
|
||||
return getMultiElementValue(elements);
|
||||
}
|
||||
} // Strips the `[]` suffix off a form value name
|
||||
|
||||
|
||||
function getPureName(name) {
|
||||
return /\[\]$/.test(name) ? name.slice(0, -2) : name;
|
||||
}
|
||||
|
||||
function getAllFormValues(container) {
|
||||
const names = Array.from(container.elements).map(element => element.name);
|
||||
return names.reduce((obj, name) => (0, _extends2.default)({}, obj, {
|
||||
[getPureName(name)]: getFormValue(container, name)
|
||||
}), {});
|
||||
}
|
||||
|
||||
function toHaveFormValues(formElement, expectedValues) {
|
||||
(0, _utils.checkHtmlElement)(formElement, toHaveFormValues, this);
|
||||
|
||||
if (!formElement.elements) {
|
||||
// TODO: Change condition to use instanceof against the appropriate element classes instead
|
||||
throw new Error('toHaveFormValues must be called on a form or a fieldset');
|
||||
}
|
||||
|
||||
const formValues = getAllFormValues(formElement);
|
||||
return {
|
||||
pass: Object.entries(expectedValues).every(([name, expectedValue]) => (0, _isEqualWith.default)(formValues[name], expectedValue, _utils.compareArraysAsSet)),
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
const matcher = `${this.isNot ? '.not' : ''}.toHaveFormValues`;
|
||||
const commonKeyValues = Object.keys(formValues).filter(key => expectedValues.hasOwnProperty(key)).reduce((obj, key) => (0, _extends2.default)({}, obj, {
|
||||
[key]: formValues[key]
|
||||
}), {});
|
||||
return [this.utils.matcherHint(matcher, 'element', ''), `Expected the element ${to} have form values`, this.utils.diff(expectedValues, commonKeyValues)].join('\n\n');
|
||||
}
|
||||
};
|
||||
}
|
59
web/node_modules/@testing-library/jest-dom/dist/to-have-style.js
generated
vendored
Normal file
59
web/node_modules/@testing-library/jest-dom/dist/to-have-style.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveStyle = toHaveStyle;
|
||||
|
||||
var _chalk = _interopRequireDefault(require("chalk"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function getStyleDeclaration(document, css) {
|
||||
const styles = {}; // The next block is necessary to normalize colors
|
||||
|
||||
const copy = document.createElement('div');
|
||||
Object.keys(css).forEach(property => {
|
||||
copy.style[property] = css[property];
|
||||
styles[property] = copy.style[property];
|
||||
});
|
||||
return styles;
|
||||
}
|
||||
|
||||
function isSubset(styles, computedStyle) {
|
||||
return !!Object.keys(styles).length && Object.entries(styles).every(([prop, value]) => computedStyle[prop] === value || computedStyle.getPropertyValue(prop.toLowerCase()) === value);
|
||||
}
|
||||
|
||||
function printoutStyles(styles) {
|
||||
return Object.keys(styles).sort().map(prop => `${prop}: ${styles[prop]};`).join('\n');
|
||||
} // Highlights only style rules that were expected but were not found in the
|
||||
// received computed styles
|
||||
|
||||
|
||||
function expectedDiff(diffFn, expected, computedStyles) {
|
||||
const received = Array.from(computedStyles).filter(prop => expected[prop] !== undefined).reduce((obj, prop) => Object.assign(obj, {
|
||||
[prop]: computedStyles.getPropertyValue(prop)
|
||||
}), {});
|
||||
const diffOutput = diffFn(printoutStyles(expected), printoutStyles(received)); // Remove the "+ Received" annotation because this is a one-way diff
|
||||
|
||||
return diffOutput.replace(`${_chalk.default.red('+ Received')}\n`, '');
|
||||
}
|
||||
|
||||
function toHaveStyle(htmlElement, css) {
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveStyle, this);
|
||||
const parsedCSS = typeof css === 'object' ? css : (0, _utils.parseCSS)(css, toHaveStyle, this);
|
||||
const {
|
||||
getComputedStyle
|
||||
} = htmlElement.ownerDocument.defaultView;
|
||||
const expected = getStyleDeclaration(htmlElement.ownerDocument, parsedCSS);
|
||||
const received = getComputedStyle(htmlElement);
|
||||
return {
|
||||
pass: isSubset(expected, received),
|
||||
message: () => {
|
||||
const matcher = `${this.isNot ? '.not' : ''}.toHaveStyle`;
|
||||
return [this.utils.matcherHint(matcher, 'element', ''), expectedDiff(this.utils.diff, expected, received)].join('\n\n');
|
||||
}
|
||||
};
|
||||
}
|
24
web/node_modules/@testing-library/jest-dom/dist/to-have-text-content.js
generated
vendored
Normal file
24
web/node_modules/@testing-library/jest-dom/dist/to-have-text-content.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveTextContent = toHaveTextContent;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toHaveTextContent(node, checkWith, options = {
|
||||
normalizeWhitespace: true
|
||||
}) {
|
||||
(0, _utils.checkNode)(node, toHaveTextContent, this);
|
||||
const textContent = options.normalizeWhitespace ? (0, _utils.normalize)(node.textContent) : node.textContent.replace(/\u00a0/g, ' '); // Replace with normal spaces
|
||||
|
||||
const checkingWithEmptyString = textContent !== '' && checkWith === '';
|
||||
return {
|
||||
pass: !checkingWithEmptyString && (0, _utils.matches)(textContent, checkWith),
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
return (0, _utils.getMessage)(this, this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toHaveTextContent`, 'element', ''), checkingWithEmptyString ? `Checking with empty string will always match, use .toBeEmptyDOMElement() instead` : `Expected element ${to} have text content`, checkWith, 'Received', textContent);
|
||||
}
|
||||
};
|
||||
}
|
39
web/node_modules/@testing-library/jest-dom/dist/to-have-value.js
generated
vendored
Normal file
39
web/node_modules/@testing-library/jest-dom/dist/to-have-value.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toHaveValue = toHaveValue;
|
||||
|
||||
var _isEqualWith = _interopRequireDefault(require("lodash/isEqualWith"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function toHaveValue(htmlElement, expectedValue) {
|
||||
(0, _utils.checkHtmlElement)(htmlElement, toHaveValue, this);
|
||||
|
||||
if (htmlElement.tagName.toLowerCase() === 'input' && ['checkbox', 'radio'].includes(htmlElement.type)) {
|
||||
throw new Error('input with type=checkbox or type=radio cannot be used with .toHaveValue(). Use .toBeChecked() for type=checkbox or .toHaveFormValues() instead');
|
||||
}
|
||||
|
||||
const receivedValue = (0, _utils.getSingleElementValue)(htmlElement);
|
||||
const expectsValue = expectedValue !== undefined;
|
||||
let expectedTypedValue = expectedValue;
|
||||
let receivedTypedValue = receivedValue;
|
||||
|
||||
if (expectedValue == receivedValue && expectedValue !== receivedValue) {
|
||||
expectedTypedValue = `${expectedValue} (${typeof expectedValue})`;
|
||||
receivedTypedValue = `${receivedValue} (${typeof receivedValue})`;
|
||||
}
|
||||
|
||||
return {
|
||||
pass: expectsValue ? (0, _isEqualWith.default)(receivedValue, expectedValue, _utils.compareArraysAsSet) : Boolean(receivedValue),
|
||||
message: () => {
|
||||
const to = this.isNot ? 'not to' : 'to';
|
||||
const matcher = this.utils.matcherHint(`${this.isNot ? '.not' : ''}.toHaveValue`, 'element', expectedValue);
|
||||
return (0, _utils.getMessage)(this, matcher, `Expected the element ${to} have value`, expectsValue ? expectedTypedValue : '(any)', 'Received', receivedTypedValue);
|
||||
}
|
||||
};
|
||||
}
|
228
web/node_modules/@testing-library/jest-dom/dist/utils.js
generated
vendored
Normal file
228
web/node_modules/@testing-library/jest-dom/dist/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,228 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.checkHtmlElement = checkHtmlElement;
|
||||
exports.checkNode = checkNode;
|
||||
exports.parseCSS = parseCSS;
|
||||
exports.deprecate = deprecate;
|
||||
exports.getMessage = getMessage;
|
||||
exports.matches = matches;
|
||||
exports.normalize = normalize;
|
||||
exports.getTag = getTag;
|
||||
exports.getSingleElementValue = getSingleElementValue;
|
||||
exports.compareArraysAsSet = compareArraysAsSet;
|
||||
exports.toSentence = toSentence;
|
||||
exports.NodeTypeError = exports.HtmlElementTypeError = void 0;
|
||||
|
||||
var _redent = _interopRequireDefault(require("redent"));
|
||||
|
||||
var _css = require("css");
|
||||
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
|
||||
class GenericTypeError extends Error {
|
||||
constructor(expectedString, received, matcherFn, context) {
|
||||
super();
|
||||
/* istanbul ignore next */
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, matcherFn);
|
||||
}
|
||||
|
||||
let withType = '';
|
||||
|
||||
try {
|
||||
withType = context.utils.printWithType('Received', received, context.utils.printReceived);
|
||||
} catch (e) {// Can throw for Document:
|
||||
// https://github.com/jsdom/jsdom/issues/2304
|
||||
}
|
||||
|
||||
this.message = [context.utils.matcherHint(`${context.isNot ? '.not' : ''}.${matcherFn.name}`, 'received', ''), '', // eslint-disable-next-line babel/new-cap
|
||||
`${context.utils.RECEIVED_COLOR('received')} value must ${expectedString}.`, withType].join('\n');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class HtmlElementTypeError extends GenericTypeError {
|
||||
constructor(...args) {
|
||||
super('be an HTMLElement or an SVGElement', ...args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.HtmlElementTypeError = HtmlElementTypeError;
|
||||
|
||||
class NodeTypeError extends GenericTypeError {
|
||||
constructor(...args) {
|
||||
super('be a Node', ...args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.NodeTypeError = NodeTypeError;
|
||||
|
||||
function checkHasWindow(htmlElement, ErrorClass, ...args) {
|
||||
if (!htmlElement || !htmlElement.ownerDocument || !htmlElement.ownerDocument.defaultView) {
|
||||
throw new ErrorClass(htmlElement, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
function checkNode(node, ...args) {
|
||||
checkHasWindow(node, NodeTypeError, ...args);
|
||||
const window = node.ownerDocument.defaultView;
|
||||
|
||||
if (!(node instanceof window.Node)) {
|
||||
throw new NodeTypeError(node, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
function checkHtmlElement(htmlElement, ...args) {
|
||||
checkHasWindow(htmlElement, HtmlElementTypeError, ...args);
|
||||
const window = htmlElement.ownerDocument.defaultView;
|
||||
|
||||
if (!(htmlElement instanceof window.HTMLElement) && !(htmlElement instanceof window.SVGElement)) {
|
||||
throw new HtmlElementTypeError(htmlElement, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
class InvalidCSSError extends Error {
|
||||
constructor(received, matcherFn, context) {
|
||||
super();
|
||||
/* istanbul ignore next */
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, matcherFn);
|
||||
}
|
||||
|
||||
this.message = [received.message, '', // eslint-disable-next-line babel/new-cap
|
||||
context.utils.RECEIVED_COLOR(`Failing css:`), // eslint-disable-next-line babel/new-cap
|
||||
context.utils.RECEIVED_COLOR(`${received.css}`)].join('\n');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function parseCSS(css, ...args) {
|
||||
const ast = (0, _css.parse)(`selector { ${css} }`, {
|
||||
silent: true
|
||||
}).stylesheet;
|
||||
|
||||
if (ast.parsingErrors && ast.parsingErrors.length > 0) {
|
||||
const {
|
||||
reason,
|
||||
line
|
||||
} = ast.parsingErrors[0];
|
||||
throw new InvalidCSSError({
|
||||
css,
|
||||
message: `Syntax error parsing expected css: ${reason} on line: ${line}`
|
||||
}, ...args);
|
||||
}
|
||||
|
||||
const parsedRules = ast.rules[0].declarations.filter(d => d.type === 'declaration').reduce((obj, {
|
||||
property,
|
||||
value
|
||||
}) => Object.assign(obj, {
|
||||
[property]: value
|
||||
}), {});
|
||||
return parsedRules;
|
||||
}
|
||||
|
||||
function display(context, value) {
|
||||
return typeof value === 'string' ? value : context.utils.stringify(value);
|
||||
}
|
||||
|
||||
function getMessage(context, matcher, expectedLabel, expectedValue, receivedLabel, receivedValue) {
|
||||
return [`${matcher}\n`, // eslint-disable-next-line babel/new-cap
|
||||
`${expectedLabel}:\n${context.utils.EXPECTED_COLOR((0, _redent.default)(display(context, expectedValue), 2))}`, // eslint-disable-next-line babel/new-cap
|
||||
`${receivedLabel}:\n${context.utils.RECEIVED_COLOR((0, _redent.default)(display(context, receivedValue), 2))}`].join('\n');
|
||||
}
|
||||
|
||||
function matches(textToMatch, matcher) {
|
||||
if (matcher instanceof RegExp) {
|
||||
return matcher.test(textToMatch);
|
||||
} else {
|
||||
return textToMatch.includes(String(matcher));
|
||||
}
|
||||
}
|
||||
|
||||
function deprecate(name, replacementText) {
|
||||
// Notify user that they are using deprecated functionality.
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`Warning: ${name} has been deprecated and will be removed in future updates.`, replacementText);
|
||||
}
|
||||
|
||||
function normalize(text) {
|
||||
return text.replace(/\s+/g, ' ').trim();
|
||||
}
|
||||
|
||||
function getTag(element) {
|
||||
return element.tagName && element.tagName.toLowerCase();
|
||||
}
|
||||
|
||||
function getSelectValue({
|
||||
multiple,
|
||||
options
|
||||
}) {
|
||||
const selectedOptions = [...options].filter(option => option.selected);
|
||||
|
||||
if (multiple) {
|
||||
return [...selectedOptions].map(opt => opt.value);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
|
||||
|
||||
if (selectedOptions.length === 0) {
|
||||
return undefined; // Couldn't make this happen, but just in case
|
||||
}
|
||||
|
||||
return selectedOptions[0].value;
|
||||
}
|
||||
|
||||
function getInputValue(inputElement) {
|
||||
switch (inputElement.type) {
|
||||
case 'number':
|
||||
return inputElement.value === '' ? null : Number(inputElement.value);
|
||||
|
||||
case 'checkbox':
|
||||
return inputElement.checked;
|
||||
|
||||
default:
|
||||
return inputElement.value;
|
||||
}
|
||||
}
|
||||
|
||||
function getSingleElementValue(element) {
|
||||
/* istanbul ignore if */
|
||||
if (!element) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
switch (element.tagName.toLowerCase()) {
|
||||
case 'input':
|
||||
return getInputValue(element);
|
||||
|
||||
case 'select':
|
||||
return getSelectValue(element);
|
||||
|
||||
default:
|
||||
return element.value;
|
||||
}
|
||||
}
|
||||
|
||||
function compareArraysAsSet(a, b) {
|
||||
if (Array.isArray(a) && Array.isArray(b)) {
|
||||
return (0, _isEqual.default)(new Set(a), new Set(b));
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function toSentence(array, {
|
||||
wordConnector = ', ',
|
||||
lastWordConnector = ' and '
|
||||
} = {}) {
|
||||
return [array.slice(0, -1).join(wordConnector), array[array.length - 1]].join(array.length > 1 ? lastWordConnector : '');
|
||||
}
|
2
web/node_modules/@testing-library/jest-dom/extend-expect.js
generated
vendored
Normal file
2
web/node_modules/@testing-library/jest-dom/extend-expect.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// eslint-disable-next-line
|
||||
require('./dist/extend-expect')
|
2
web/node_modules/@testing-library/jest-dom/matchers.js
generated
vendored
Normal file
2
web/node_modules/@testing-library/jest-dom/matchers.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
const matchers = require('./dist/matchers')
|
||||
module.exports = matchers
|
411
web/node_modules/@testing-library/jest-dom/node_modules/chalk/index.d.ts
generated
vendored
Normal file
411
web/node_modules/@testing-library/jest-dom/node_modules/chalk/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,411 @@
|
|||
declare const enum LevelEnum {
|
||||
/**
|
||||
All colors disabled.
|
||||
*/
|
||||
None = 0,
|
||||
|
||||
/**
|
||||
Basic 16 colors support.
|
||||
*/
|
||||
Basic = 1,
|
||||
|
||||
/**
|
||||
ANSI 256 colors support.
|
||||
*/
|
||||
Ansi256 = 2,
|
||||
|
||||
/**
|
||||
Truecolor 16 million colors support.
|
||||
*/
|
||||
TrueColor = 3
|
||||
}
|
||||
|
||||
/**
|
||||
Basic foreground colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type ForegroundColor =
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray'
|
||||
| 'grey'
|
||||
| 'blackBright'
|
||||
| 'redBright'
|
||||
| 'greenBright'
|
||||
| 'yellowBright'
|
||||
| 'blueBright'
|
||||
| 'magentaBright'
|
||||
| 'cyanBright'
|
||||
| 'whiteBright';
|
||||
|
||||
/**
|
||||
Basic background colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type BackgroundColor =
|
||||
| 'bgBlack'
|
||||
| 'bgRed'
|
||||
| 'bgGreen'
|
||||
| 'bgYellow'
|
||||
| 'bgBlue'
|
||||
| 'bgMagenta'
|
||||
| 'bgCyan'
|
||||
| 'bgWhite'
|
||||
| 'bgGray'
|
||||
| 'bgGrey'
|
||||
| 'bgBlackBright'
|
||||
| 'bgRedBright'
|
||||
| 'bgGreenBright'
|
||||
| 'bgYellowBright'
|
||||
| 'bgBlueBright'
|
||||
| 'bgMagentaBright'
|
||||
| 'bgCyanBright'
|
||||
| 'bgWhiteBright';
|
||||
|
||||
/**
|
||||
Basic colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type Color = ForegroundColor | BackgroundColor;
|
||||
|
||||
declare type Modifiers =
|
||||
| 'reset'
|
||||
| 'bold'
|
||||
| 'dim'
|
||||
| 'italic'
|
||||
| 'underline'
|
||||
| 'inverse'
|
||||
| 'hidden'
|
||||
| 'strikethrough'
|
||||
| 'visible';
|
||||
|
||||
declare namespace chalk {
|
||||
type Level = LevelEnum;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
Specify the color support for Chalk.
|
||||
By default, color support is automatically detected based on the environment.
|
||||
*/
|
||||
level?: Level;
|
||||
}
|
||||
|
||||
interface Instance {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
new (options?: Options): Chalk;
|
||||
}
|
||||
|
||||
/**
|
||||
Detect whether the terminal supports color.
|
||||
*/
|
||||
interface ColorSupport {
|
||||
/**
|
||||
The color level used by Chalk.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports basic 16 colors.
|
||||
*/
|
||||
hasBasic: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports ANSI 256 colors.
|
||||
*/
|
||||
has256: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports Truecolor 16 million colors.
|
||||
*/
|
||||
has16m: boolean;
|
||||
}
|
||||
|
||||
interface ChalkFunction {
|
||||
/**
|
||||
Use a template string.
|
||||
|
||||
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
```
|
||||
*/
|
||||
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
||||
|
||||
(...text: unknown[]): string;
|
||||
}
|
||||
|
||||
interface Chalk extends ChalkFunction {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
Instance: Instance;
|
||||
|
||||
/**
|
||||
The color support for Chalk.
|
||||
By default, color support is automatically detected based on the environment.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Use HEX value to set text color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.hex('#DEADED');
|
||||
```
|
||||
*/
|
||||
hex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set text color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.keyword('orange');
|
||||
```
|
||||
*/
|
||||
keyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set text color.
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set text color.
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set text color.
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set text color.
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
*/
|
||||
ansi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HEX value to set background color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgHex('#DEADED');
|
||||
```
|
||||
*/
|
||||
bgHex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set background color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgKeyword('orange');
|
||||
```
|
||||
*/
|
||||
bgKeyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set background color.
|
||||
*/
|
||||
bgRgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set background color.
|
||||
*/
|
||||
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set background color.
|
||||
*/
|
||||
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set background color.
|
||||
*/
|
||||
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
Use the foreground code, not the background code (for example, not 41, nor 101).
|
||||
*/
|
||||
bgAnsi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
||||
*/
|
||||
bgAnsi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Resets the current color chain.
|
||||
*/
|
||||
readonly reset: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text bold.
|
||||
*/
|
||||
readonly bold: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text only when Chalk has a color support level > 0.
|
||||
Can be useful for things that are purely cosmetic.
|
||||
*/
|
||||
readonly visible: Chalk;
|
||||
|
||||
readonly black: Chalk;
|
||||
readonly red: Chalk;
|
||||
readonly green: Chalk;
|
||||
readonly yellow: Chalk;
|
||||
readonly blue: Chalk;
|
||||
readonly magenta: Chalk;
|
||||
readonly cyan: Chalk;
|
||||
readonly white: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: Chalk;
|
||||
|
||||
readonly blackBright: Chalk;
|
||||
readonly redBright: Chalk;
|
||||
readonly greenBright: Chalk;
|
||||
readonly yellowBright: Chalk;
|
||||
readonly blueBright: Chalk;
|
||||
readonly magentaBright: Chalk;
|
||||
readonly cyanBright: Chalk;
|
||||
readonly whiteBright: Chalk;
|
||||
|
||||
readonly bgBlack: Chalk;
|
||||
readonly bgRed: Chalk;
|
||||
readonly bgGreen: Chalk;
|
||||
readonly bgYellow: Chalk;
|
||||
readonly bgBlue: Chalk;
|
||||
readonly bgMagenta: Chalk;
|
||||
readonly bgCyan: Chalk;
|
||||
readonly bgWhite: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: Chalk;
|
||||
|
||||
readonly bgBlackBright: Chalk;
|
||||
readonly bgRedBright: Chalk;
|
||||
readonly bgGreenBright: Chalk;
|
||||
readonly bgYellowBright: Chalk;
|
||||
readonly bgBlueBright: Chalk;
|
||||
readonly bgMagentaBright: Chalk;
|
||||
readonly bgCyanBright: Chalk;
|
||||
readonly bgWhiteBright: Chalk;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Main Chalk object that allows to chain styles together.
|
||||
Call the last one as a method with a string argument.
|
||||
Order doesn't matter, and later styles take precedent in case of a conflict.
|
||||
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
*/
|
||||
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
||||
supportsColor: chalk.ColorSupport | false;
|
||||
Level: typeof LevelEnum;
|
||||
Color: Color;
|
||||
ForegroundColor: ForegroundColor;
|
||||
BackgroundColor: BackgroundColor;
|
||||
Modifiers: Modifiers;
|
||||
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
||||
};
|
||||
|
||||
export = chalk;
|
9
web/node_modules/@testing-library/jest-dom/node_modules/chalk/license
generated
vendored
Normal file
9
web/node_modules/@testing-library/jest-dom/node_modules/chalk/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
63
web/node_modules/@testing-library/jest-dom/node_modules/chalk/package.json
generated
vendored
Normal file
63
web/node_modules/@testing-library/jest-dom/node_modules/chalk/package.json
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"name": "chalk",
|
||||
"version": "3.0.0",
|
||||
"description": "Terminal string styling done right",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/chalk",
|
||||
"main": "source",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd",
|
||||
"bench": "matcha benchmark.js"
|
||||
},
|
||||
"files": [
|
||||
"source",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"coveralls": "^3.0.7",
|
||||
"execa": "^3.2.0",
|
||||
"import-fresh": "^3.1.0",
|
||||
"matcha": "^0.7.0",
|
||||
"nyc": "^14.1.1",
|
||||
"resolve-from": "^5.0.0",
|
||||
"tsd": "^0.7.4",
|
||||
"xo": "^0.25.3"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"unicorn/prefer-string-slice": "off",
|
||||
"unicorn/prefer-includes": "off"
|
||||
}
|
||||
}
|
||||
}
|
304
web/node_modules/@testing-library/jest-dom/node_modules/chalk/readme.md
generated
vendored
Normal file
304
web/node_modules/@testing-library/jest-dom/node_modules/chalk/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,304 @@
|
|||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo) 
|
||||
|
||||
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~46,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 1, 2019
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install chalk
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// ES2015 tagged template literal
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.keyword('orange');
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.level
|
||||
|
||||
Specifies the level of color support.
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.Instance({level: 0});
|
||||
```
|
||||
|
||||
| Level | Description |
|
||||
| :---: | :--- |
|
||||
| `0` | All colors disabled |
|
||||
| `1` | Basic color support (16 colors) |
|
||||
| `2` | 256 color support |
|
||||
| `3` | Truecolor support (16 million colors) |
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
### chalk.stderr and chalk.stderr.supportsColor
|
||||
|
||||
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset` - Resets the current color chain.
|
||||
- `bold` - Make text bold.
|
||||
- `dim` - Emitting only a small amount of light.
|
||||
- `italic` - Make text italic. *(Not widely supported)*
|
||||
- `underline` - Make text underline. *(Not widely supported)*
|
||||
- `inverse`- Inverse background and foreground colors.
|
||||
- `hidden` - Prints the text, but makes it invisible.
|
||||
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
|
||||
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Tagged template literal
|
||||
|
||||
Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const miles = 18;
|
||||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||
|
||||
Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
|
||||
|
||||
```js
|
||||
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||
```
|
||||
|
||||
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||
|
||||
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.keyword('orange')('Some orange text')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
|
||||
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
||||
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
|
||||
## chalk for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
233
web/node_modules/@testing-library/jest-dom/node_modules/chalk/source/index.js
generated
vendored
Normal file
233
web/node_modules/@testing-library/jest-dom/node_modules/chalk/source/index.js
generated
vendored
Normal file
|
@ -0,0 +1,233 @@
|
|||
'use strict';
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
|
||||
const {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
} = require('./util');
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = [
|
||||
'ansi',
|
||||
'ansi',
|
||||
'ansi256',
|
||||
'ansi16m'
|
||||
];
|
||||
|
||||
const styles = Object.create(null);
|
||||
|
||||
const applyOptions = (object, options = {}) => {
|
||||
if (options.level > 3 || options.level < 0) {
|
||||
throw new Error('The `level` option should be an integer from 0 to 3');
|
||||
}
|
||||
|
||||
// Detect level if not set manually
|
||||
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
object.level = options.level === undefined ? colorLevel : options.level;
|
||||
};
|
||||
|
||||
class ChalkClass {
|
||||
constructor(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
}
|
||||
|
||||
const chalkFactory = options => {
|
||||
const chalk = {};
|
||||
applyOptions(chalk, options);
|
||||
|
||||
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
|
||||
|
||||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = () => {
|
||||
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
|
||||
};
|
||||
|
||||
chalk.template.Instance = ChalkClass;
|
||||
|
||||
return chalk.template;
|
||||
};
|
||||
|
||||
function Chalk(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
|
||||
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
||||
styles[styleName] = {
|
||||
get() {
|
||||
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
||||
Object.defineProperty(this, styleName, {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
styles.visible = {
|
||||
get() {
|
||||
const builder = createBuilder(this, this._styler, true);
|
||||
Object.defineProperty(this, 'visible', {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
|
||||
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
|
||||
|
||||
for (const model of usedModels) {
|
||||
styles[model] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
for (const model of usedModels) {
|
||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||
styles[bgModel] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const proto = Object.defineProperties(() => {}, {
|
||||
...styles,
|
||||
level: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this._generator.level;
|
||||
},
|
||||
set(level) {
|
||||
this._generator.level = level;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const createStyler = (open, close, parent) => {
|
||||
let openAll;
|
||||
let closeAll;
|
||||
if (parent === undefined) {
|
||||
openAll = open;
|
||||
closeAll = close;
|
||||
} else {
|
||||
openAll = parent.openAll + open;
|
||||
closeAll = close + parent.closeAll;
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
openAll,
|
||||
closeAll,
|
||||
parent
|
||||
};
|
||||
};
|
||||
|
||||
const createBuilder = (self, _styler, _isEmpty) => {
|
||||
const builder = (...arguments_) => {
|
||||
// Single argument is hot path, implicit coercion is faster than anything
|
||||
// eslint-disable-next-line no-implicit-coercion
|
||||
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
||||
};
|
||||
|
||||
// `__proto__` is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype
|
||||
builder.__proto__ = proto; // eslint-disable-line no-proto
|
||||
|
||||
builder._generator = self;
|
||||
builder._styler = _styler;
|
||||
builder._isEmpty = _isEmpty;
|
||||
|
||||
return builder;
|
||||
};
|
||||
|
||||
const applyStyle = (self, string) => {
|
||||
if (self.level <= 0 || !string) {
|
||||
return self._isEmpty ? '' : string;
|
||||
}
|
||||
|
||||
let styler = self._styler;
|
||||
|
||||
if (styler === undefined) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const {openAll, closeAll} = styler;
|
||||
if (string.indexOf('\u001B') !== -1) {
|
||||
while (styler !== undefined) {
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
string = stringReplaceAll(string, styler.close, styler.open);
|
||||
|
||||
styler = styler.parent;
|
||||
}
|
||||
}
|
||||
|
||||
// We can move both next actions out of loop, because remaining actions in loop won't have
|
||||
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
||||
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
||||
const lfIndex = string.indexOf('\n');
|
||||
if (lfIndex !== -1) {
|
||||
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
||||
}
|
||||
|
||||
return openAll + string + closeAll;
|
||||
};
|
||||
|
||||
let template;
|
||||
const chalkTag = (chalk, ...strings) => {
|
||||
const [firstString] = strings;
|
||||
|
||||
if (!Array.isArray(firstString)) {
|
||||
// If chalk() was called by itself or with a string,
|
||||
// return the string itself as a string.
|
||||
return strings.join(' ');
|
||||
}
|
||||
|
||||
const arguments_ = strings.slice(1);
|
||||
const parts = [firstString.raw[0]];
|
||||
|
||||
for (let i = 1; i < firstString.length; i++) {
|
||||
parts.push(
|
||||
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
|
||||
String(firstString.raw[i])
|
||||
);
|
||||
}
|
||||
|
||||
if (template === undefined) {
|
||||
template = require('./templates');
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
};
|
||||
|
||||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
const chalk = Chalk(); // eslint-disable-line new-cap
|
||||
chalk.supportsColor = stdoutColor;
|
||||
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
|
||||
chalk.stderr.supportsColor = stderrColor;
|
||||
|
||||
// For TypeScript
|
||||
chalk.Level = {
|
||||
None: 0,
|
||||
Basic: 1,
|
||||
Ansi256: 2,
|
||||
TrueColor: 3,
|
||||
0: 'None',
|
||||
1: 'Basic',
|
||||
2: 'Ansi256',
|
||||
3: 'TrueColor'
|
||||
};
|
||||
|
||||
module.exports = chalk;
|
134
web/node_modules/@testing-library/jest-dom/node_modules/chalk/source/templates.js
generated
vendored
Normal file
134
web/node_modules/@testing-library/jest-dom/node_modules/chalk/source/templates.js
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
'use strict';
|
||||
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
||||
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
||||
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
||||
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi;
|
||||
|
||||
const ESCAPES = new Map([
|
||||
['n', '\n'],
|
||||
['r', '\r'],
|
||||
['t', '\t'],
|
||||
['b', '\b'],
|
||||
['f', '\f'],
|
||||
['v', '\v'],
|
||||
['0', '\0'],
|
||||
['\\', '\\'],
|
||||
['e', '\u001B'],
|
||||
['a', '\u0007']
|
||||
]);
|
||||
|
||||
function unescape(c) {
|
||||
const u = c[0] === 'u';
|
||||
const bracket = c[1] === '{';
|
||||
|
||||
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
|
||||
return String.fromCharCode(parseInt(c.slice(1), 16));
|
||||
}
|
||||
|
||||
if (u && bracket) {
|
||||
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
||||
}
|
||||
|
||||
return ESCAPES.get(c) || c;
|
||||
}
|
||||
|
||||
function parseArguments(name, arguments_) {
|
||||
const results = [];
|
||||
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
||||
let matches;
|
||||
|
||||
for (const chunk of chunks) {
|
||||
const number = Number(chunk);
|
||||
if (!Number.isNaN(number)) {
|
||||
results.push(number);
|
||||
} else if ((matches = chunk.match(STRING_REGEX))) {
|
||||
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
||||
} else {
|
||||
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseStyle(style) {
|
||||
STYLE_REGEX.lastIndex = 0;
|
||||
|
||||
const results = [];
|
||||
let matches;
|
||||
|
||||
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
||||
const name = matches[1];
|
||||
|
||||
if (matches[2]) {
|
||||
const args = parseArguments(name, matches[2]);
|
||||
results.push([name].concat(args));
|
||||
} else {
|
||||
results.push([name]);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function buildStyle(chalk, styles) {
|
||||
const enabled = {};
|
||||
|
||||
for (const layer of styles) {
|
||||
for (const style of layer.styles) {
|
||||
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
let current = chalk;
|
||||
for (const [styleName, styles] of Object.entries(enabled)) {
|
||||
if (!Array.isArray(styles)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(styleName in current)) {
|
||||
throw new Error(`Unknown Chalk style: ${styleName}`);
|
||||
}
|
||||
|
||||
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
module.exports = (chalk, temporary) => {
|
||||
const styles = [];
|
||||
const chunks = [];
|
||||
let chunk = [];
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
||||
if (escapeCharacter) {
|
||||
chunk.push(unescape(escapeCharacter));
|
||||
} else if (style) {
|
||||
const string = chunk.join('');
|
||||
chunk = [];
|
||||
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
|
||||
styles.push({inverse, styles: parseStyle(style)});
|
||||
} else if (close) {
|
||||
if (styles.length === 0) {
|
||||
throw new Error('Found extraneous } in Chalk template literal');
|
||||
}
|
||||
|
||||
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
|
||||
chunk = [];
|
||||
styles.pop();
|
||||
} else {
|
||||
chunk.push(character);
|
||||
}
|
||||
});
|
||||
|
||||
chunks.push(chunk.join(''));
|
||||
|
||||
if (styles.length > 0) {
|
||||
const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
|
||||
return chunks.join('');
|
||||
};
|
39
web/node_modules/@testing-library/jest-dom/node_modules/chalk/source/util.js
generated
vendored
Normal file
39
web/node_modules/@testing-library/jest-dom/node_modules/chalk/source/util.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
const stringReplaceAll = (string, substring, replacer) => {
|
||||
let index = string.indexOf(substring);
|
||||
if (index === -1) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const substringLength = substring.length;
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
||||
endIndex = index + substringLength;
|
||||
index = string.indexOf(substring, endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
const gotCR = string[index - 1] === '\r';
|
||||
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
||||
endIndex = index + 1;
|
||||
index = string.indexOf('\n', endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
};
|
80
web/node_modules/@testing-library/jest-dom/package.json
generated
vendored
Normal file
80
web/node_modules/@testing-library/jest-dom/package.json
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"name": "@testing-library/jest-dom",
|
||||
"version": "5.14.1",
|
||||
"description": "Custom jest matchers to test the state of the DOM",
|
||||
"main": "dist/index.js",
|
||||
"engines": {
|
||||
"node": ">=8",
|
||||
"npm": ">=6",
|
||||
"yarn": ">=1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "kcd-scripts build",
|
||||
"format": "kcd-scripts format",
|
||||
"lint": "kcd-scripts lint",
|
||||
"setup": "npm install && npm run validate -s",
|
||||
"test": "kcd-scripts test",
|
||||
"test:update": "npm test -- --updateSnapshot --coverage",
|
||||
"validate": "kcd-scripts validate"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"extend-expect.js",
|
||||
"matchers.js"
|
||||
],
|
||||
"keywords": [
|
||||
"testing",
|
||||
"dom",
|
||||
"jest",
|
||||
"jsdom"
|
||||
],
|
||||
"author": "Ernesto Garcia <gnapse@gmail.com> (http://gnapse.github.io)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"@types/testing-library__jest-dom": "^5.9.1",
|
||||
"aria-query": "^4.2.2",
|
||||
"chalk": "^3.0.0",
|
||||
"css": "^3.0.0",
|
||||
"css.escape": "^1.5.1",
|
||||
"dom-accessibility-api": "^0.5.6",
|
||||
"lodash": "^4.17.15",
|
||||
"redent": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest-environment-jsdom-sixteen": "^1.0.3",
|
||||
"jest-watch-select-projects": "^2.0.0",
|
||||
"jsdom": "^16.2.1",
|
||||
"kcd-scripts": "^5.6.0",
|
||||
"pretty-format": "^25.1.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "./node_modules/kcd-scripts/eslint.js",
|
||||
"rules": {
|
||||
"babel/no-invalid-this": "off"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"src/__tests__/*.js"
|
||||
],
|
||||
"rules": {
|
||||
"max-lines-per-function": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"eslintIgnore": [
|
||||
"node_modules",
|
||||
"coverage",
|
||||
"dist"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/testing-library/jest-dom"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/testing-library/jest-dom/issues"
|
||||
},
|
||||
"homepage": "https://github.com/testing-library/jest-dom#readme"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue