Sha256: 7c947903a7278071559184d7c7c600a5dd698421f5d9accadfc1ca3c047aa677

Contents?: true

Size: 1.42 KB

Versions: 26

Compression:

Stored size: 1.42 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.queryByAltText = exports.queryAllByAltText = exports.getByAltText = exports.getAllByAltText = exports.findByAltText = exports.findAllByAltText = void 0;
var _queryHelpers = require("../query-helpers");
var _helpers = require("../helpers");
var _allUtils = require("./all-utils");
// Valid tags are img, input, area and custom elements
const VALID_TAG_REGEXP = /^(img|input|area|.+-.+)$/i;
const queryAllByAltText = (container, alt, options = {}) => {
  (0, _helpers.checkContainerType)(container);
  return (0, _queryHelpers.queryAllByAttribute)('alt', container, alt, options).filter(node => VALID_TAG_REGEXP.test(node.tagName));
};
const getMultipleError = (c, alt) => `Found multiple elements with the alt text: ${alt}`;
const getMissingError = (c, alt) => `Unable to find an element with the alt text: ${alt}`;
const queryAllByAltTextWithSuggestions = exports.queryAllByAltText = (0, _queryHelpers.wrapAllByQueryWithSuggestion)(queryAllByAltText, queryAllByAltText.name, 'queryAll');
const [queryByAltText, getAllByAltText, getByAltText, findAllByAltText, findByAltText] = (0, _allUtils.buildQueries)(queryAllByAltText, getMultipleError, getMissingError);
exports.findByAltText = findByAltText;
exports.findAllByAltText = findAllByAltText;
exports.getByAltText = getByAltText;
exports.getAllByAltText = getAllByAltText;
exports.queryByAltText = queryByAltText;

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/@testing-library/dom/dist/queries/alt-text.js