| [9af201e] | 1 | "use strict";
|
|---|
| 2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|---|
| 3 | if (k2 === undefined) k2 = k;
|
|---|
| 4 | var desc = Object.getOwnPropertyDescriptor(m, k);
|
|---|
| 5 | if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|---|
| 6 | desc = { enumerable: true, get: function() { return m[k]; } };
|
|---|
| 7 | }
|
|---|
| 8 | Object.defineProperty(o, k2, desc);
|
|---|
| 9 | }) : (function(o, m, k, k2) {
|
|---|
| 10 | if (k2 === undefined) k2 = k;
|
|---|
| 11 | o[k2] = m[k];
|
|---|
| 12 | }));
|
|---|
| 13 | var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|---|
| 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|---|
| 15 | };
|
|---|
| 16 | Object.defineProperty(exports, "__esModule", { value: true });
|
|---|
| 17 | exports.ABSENCE_MATCHERS = exports.PRESENCE_MATCHERS = exports.ALL_RETURNING_NODES = exports.METHODS_RETURNING_NODES = exports.PROPERTIES_RETURNING_NODES = exports.LIBRARY_MODULES = exports.TESTING_FRAMEWORK_SETUP_HOOKS = exports.EVENTS_SIMULATORS = exports.DEBUG_UTILS = exports.ASYNC_UTILS = exports.ALL_QUERIES_COMBINATIONS = exports.ASYNC_QUERIES_COMBINATIONS = exports.SYNC_QUERIES_COMBINATIONS = exports.ALL_QUERIES_METHODS = exports.ALL_QUERIES_VARIANTS = exports.ASYNC_QUERIES_VARIANTS = exports.SYNC_QUERIES_VARIANTS = exports.getDocsUrl = exports.combineQueries = void 0;
|
|---|
| 18 | __exportStar(require("./file-import"), exports);
|
|---|
| 19 | __exportStar(require("./types"), exports);
|
|---|
| 20 | const combineQueries = (variants, methods) => {
|
|---|
| 21 | const combinedQueries = [];
|
|---|
| 22 | variants.forEach((variant) => {
|
|---|
| 23 | const variantPrefix = variant.replace('By', '');
|
|---|
| 24 | methods.forEach((method) => {
|
|---|
| 25 | combinedQueries.push(`${variantPrefix}${method}`);
|
|---|
| 26 | });
|
|---|
| 27 | });
|
|---|
| 28 | return combinedQueries;
|
|---|
| 29 | };
|
|---|
| 30 | exports.combineQueries = combineQueries;
|
|---|
| 31 | const getDocsUrl = (ruleName) => `https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/${ruleName}.md`;
|
|---|
| 32 | exports.getDocsUrl = getDocsUrl;
|
|---|
| 33 | const LIBRARY_MODULES = [
|
|---|
| 34 | '@testing-library/dom',
|
|---|
| 35 | '@testing-library/angular',
|
|---|
| 36 | '@testing-library/react',
|
|---|
| 37 | '@testing-library/preact',
|
|---|
| 38 | '@testing-library/vue',
|
|---|
| 39 | '@testing-library/svelte',
|
|---|
| 40 | '@marko/testing-library',
|
|---|
| 41 | ];
|
|---|
| 42 | exports.LIBRARY_MODULES = LIBRARY_MODULES;
|
|---|
| 43 | const SYNC_QUERIES_VARIANTS = ['getBy', 'getAllBy', 'queryBy', 'queryAllBy'];
|
|---|
| 44 | exports.SYNC_QUERIES_VARIANTS = SYNC_QUERIES_VARIANTS;
|
|---|
| 45 | const ASYNC_QUERIES_VARIANTS = ['findBy', 'findAllBy'];
|
|---|
| 46 | exports.ASYNC_QUERIES_VARIANTS = ASYNC_QUERIES_VARIANTS;
|
|---|
| 47 | const ALL_QUERIES_VARIANTS = [
|
|---|
| 48 | ...SYNC_QUERIES_VARIANTS,
|
|---|
| 49 | ...ASYNC_QUERIES_VARIANTS,
|
|---|
| 50 | ];
|
|---|
| 51 | exports.ALL_QUERIES_VARIANTS = ALL_QUERIES_VARIANTS;
|
|---|
| 52 | const ALL_QUERIES_METHODS = [
|
|---|
| 53 | 'ByLabelText',
|
|---|
| 54 | 'ByPlaceholderText',
|
|---|
| 55 | 'ByText',
|
|---|
| 56 | 'ByAltText',
|
|---|
| 57 | 'ByTitle',
|
|---|
| 58 | 'ByDisplayValue',
|
|---|
| 59 | 'ByRole',
|
|---|
| 60 | 'ByTestId',
|
|---|
| 61 | ];
|
|---|
| 62 | exports.ALL_QUERIES_METHODS = ALL_QUERIES_METHODS;
|
|---|
| 63 | const SYNC_QUERIES_COMBINATIONS = combineQueries(SYNC_QUERIES_VARIANTS, ALL_QUERIES_METHODS);
|
|---|
| 64 | exports.SYNC_QUERIES_COMBINATIONS = SYNC_QUERIES_COMBINATIONS;
|
|---|
| 65 | const ASYNC_QUERIES_COMBINATIONS = combineQueries(ASYNC_QUERIES_VARIANTS, ALL_QUERIES_METHODS);
|
|---|
| 66 | exports.ASYNC_QUERIES_COMBINATIONS = ASYNC_QUERIES_COMBINATIONS;
|
|---|
| 67 | const ALL_QUERIES_COMBINATIONS = [
|
|---|
| 68 | ...SYNC_QUERIES_COMBINATIONS,
|
|---|
| 69 | ...ASYNC_QUERIES_COMBINATIONS,
|
|---|
| 70 | ];
|
|---|
| 71 | exports.ALL_QUERIES_COMBINATIONS = ALL_QUERIES_COMBINATIONS;
|
|---|
| 72 | const ASYNC_UTILS = [
|
|---|
| 73 | 'waitFor',
|
|---|
| 74 | 'waitForElementToBeRemoved',
|
|---|
| 75 | 'wait',
|
|---|
| 76 | 'waitForElement',
|
|---|
| 77 | 'waitForDomChange',
|
|---|
| 78 | ];
|
|---|
| 79 | exports.ASYNC_UTILS = ASYNC_UTILS;
|
|---|
| 80 | const DEBUG_UTILS = [
|
|---|
| 81 | 'debug',
|
|---|
| 82 | 'logTestingPlaygroundURL',
|
|---|
| 83 | 'prettyDOM',
|
|---|
| 84 | 'logRoles',
|
|---|
| 85 | 'logDOM',
|
|---|
| 86 | 'prettyFormat',
|
|---|
| 87 | ];
|
|---|
| 88 | exports.DEBUG_UTILS = DEBUG_UTILS;
|
|---|
| 89 | const EVENTS_SIMULATORS = ['fireEvent', 'userEvent'];
|
|---|
| 90 | exports.EVENTS_SIMULATORS = EVENTS_SIMULATORS;
|
|---|
| 91 | const TESTING_FRAMEWORK_SETUP_HOOKS = ['beforeEach', 'beforeAll'];
|
|---|
| 92 | exports.TESTING_FRAMEWORK_SETUP_HOOKS = TESTING_FRAMEWORK_SETUP_HOOKS;
|
|---|
| 93 | const PROPERTIES_RETURNING_NODES = [
|
|---|
| 94 | 'activeElement',
|
|---|
| 95 | 'children',
|
|---|
| 96 | 'childElementCount',
|
|---|
| 97 | 'firstChild',
|
|---|
| 98 | 'firstElementChild',
|
|---|
| 99 | 'fullscreenElement',
|
|---|
| 100 | 'lastChild',
|
|---|
| 101 | 'lastElementChild',
|
|---|
| 102 | 'nextElementSibling',
|
|---|
| 103 | 'nextSibling',
|
|---|
| 104 | 'parentElement',
|
|---|
| 105 | 'parentNode',
|
|---|
| 106 | 'pointerLockElement',
|
|---|
| 107 | 'previousElementSibling',
|
|---|
| 108 | 'previousSibling',
|
|---|
| 109 | 'rootNode',
|
|---|
| 110 | 'scripts',
|
|---|
| 111 | ];
|
|---|
| 112 | exports.PROPERTIES_RETURNING_NODES = PROPERTIES_RETURNING_NODES;
|
|---|
| 113 | const METHODS_RETURNING_NODES = [
|
|---|
| 114 | 'closest',
|
|---|
| 115 | 'getElementById',
|
|---|
| 116 | 'getElementsByClassName',
|
|---|
| 117 | 'getElementsByName',
|
|---|
| 118 | 'getElementsByTagName',
|
|---|
| 119 | 'getElementsByTagNameNS',
|
|---|
| 120 | 'querySelector',
|
|---|
| 121 | 'querySelectorAll',
|
|---|
| 122 | ];
|
|---|
| 123 | exports.METHODS_RETURNING_NODES = METHODS_RETURNING_NODES;
|
|---|
| 124 | const ALL_RETURNING_NODES = [
|
|---|
| 125 | ...PROPERTIES_RETURNING_NODES,
|
|---|
| 126 | ...METHODS_RETURNING_NODES,
|
|---|
| 127 | ];
|
|---|
| 128 | exports.ALL_RETURNING_NODES = ALL_RETURNING_NODES;
|
|---|
| 129 | const PRESENCE_MATCHERS = ['toBeInTheDocument', 'toBeTruthy', 'toBeDefined'];
|
|---|
| 130 | exports.PRESENCE_MATCHERS = PRESENCE_MATCHERS;
|
|---|
| 131 | const ABSENCE_MATCHERS = ['toBeNull', 'toBeFalsy'];
|
|---|
| 132 | exports.ABSENCE_MATCHERS = ABSENCE_MATCHERS;
|
|---|