Socket
Socket
Sign inDemoInstall

shadow-dom-testing-library

Package Overview
Dependencies
23
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.7.0 to 1.7.1

2

dist/index.d.ts

@@ -225,3 +225,3 @@ import * as _testing_library_dom from '@testing-library/dom';

declare function deepQuerySelector(container: Container, selector: string, options?: ShadowOptions): Element | null;
declare function deepQuerySelector<T extends HTMLElement>(container: Container, selector: string, options?: ShadowOptions): T | null;
/**

@@ -228,0 +228,0 @@ * `deepQuerySelector` behaves like a normal querySelector except it will recurse into the container ShadowRoot

@@ -1,2 +0,2 @@

var me=Object.defineProperty;var ie=(e,t)=>{for(var a in t)me(e,a,{get:t[a],enumerable:!0})};import{queries as ve,within as Je}from"@testing-library/dom";var M={};ie(M,{findAllByShadowAltText:()=>z,findAllByShadowDisplayValue:()=>k,findAllByShadowLabelText:()=>g,findAllByShadowPlaceholderText:()=>I,findAllByShadowRole:()=>x,findAllByShadowTestId:()=>ne,findAllByShadowText:()=>F,findAllByShadowTitle:()=>ee,findByShadowAltText:()=>G,findByShadowDisplayValue:()=>v,findByShadowLabelText:()=>Q,findByShadowPlaceholderText:()=>O,findByShadowRole:()=>P,findByShadowTestId:()=>re,findByShadowText:()=>U,findByShadowTitle:()=>te,getAllByShadowAltText:()=>W,getAllByShadowDisplayValue:()=>N,getAllByShadowLabelText:()=>R,getAllByShadowPlaceholderText:()=>D,getAllByShadowRole:()=>A,getAllByShadowTestId:()=>ae,getAllByShadowText:()=>_,getAllByShadowTitle:()=>X,getByShadowAltText:()=>Y,getByShadowDisplayValue:()=>j,getByShadowLabelText:()=>q,getByShadowPlaceholderText:()=>H,getByShadowRole:()=>E,getByShadowTestId:()=>le,getByShadowText:()=>$,getByShadowTitle:()=>Z,queryAllByShadowAltText:()=>y,queryAllByShadowDisplayValue:()=>w,queryAllByShadowLabelText:()=>m,queryAllByShadowPlaceholderText:()=>i,queryAllByShadowRole:()=>s,queryAllByShadowTestId:()=>f,queryAllByShadowText:()=>S,queryAllByShadowTitle:()=>T,queryByShadowAltText:()=>J,queryByShadowDisplayValue:()=>C,queryByShadowLabelText:()=>L,queryByShadowPlaceholderText:()=>b,queryByShadowRole:()=>p,queryByShadowTestId:()=>oe,queryByShadowText:()=>V,queryByShadowTitle:()=>K});import{buildQueries as h,queryAllByRole as we,queryAllByLabelText as ye,queryAllByPlaceholderText as Te,queryAllByText as fe,queryAllByDisplayValue as Me,queryAllByAltText as Be,queryAllByTitle as pe,queryAllByTestId as Ae}from"@testing-library/dom";function Se(e,t,a={shallow:!1}){let o=ce(e,t,a);return Array.isArray(o)&&o.length>0?o[0]:null}function ce(e,t,a={shallow:!1}){let l=d(e,a).map(r=>Array.from(r.querySelectorAll(t))).flat(1/0);return[...new Set(l)]}function d(e,t={shallow:!1}){return ue(e,"*",t)}function ue(e,t,a={shallow:!1},o=[],l=[]){return e instanceof Document&&(e=document.documentElement),o=[e],l.push(e),e instanceof HTMLElement&&e.shadowRoot!=null&&e.shadowRoot.mode!=="closed"&&l.push(e.shadowRoot),o.forEach(r=>{r.querySelectorAll(t).forEach(n=>{if(n.shadowRoot==null||n.shadowRoot.mode==="closed"){l.push(n);return}if(l.push(n.shadowRoot),a.shallow===!0){n.shadowRoot.querySelectorAll(t).forEach(u=>{l.push(u)});return}n.shadowRoot.querySelectorAll(t).forEach(u=>{l.push(u),o.push(u)}),ue(n.shadowRoot,t,a,o,l)})}),[...new Set(l)]}function c(e){return e.map(t=>(...a)=>{let[o,l,r,...n]=a;return r==null&&(r={}),r.suggest=!1,t(o,l,r,...n)})}function s(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>we(l,a,o)).flat(1/0))]}var Ee=(e,t)=>`Found multiple elements with the role of: ${t}`,xe=(e,t)=>`Unable to find an element with the role of: ${t}`,[p,A,E,x,P]=c(h(s,Ee,xe));function m(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>ye(l,a,o)).flat(1/0))]}var Pe=(e,t)=>`Found multiple elements with the label text of: ${t}`,Le=(e,t)=>`Unable to find an element with the label text of: ${t}`,[L,R,q,g,Q]=c(h(m,Pe,Le));function i(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>Te(l,a,o)).flat(1/0))]}var Re=(e,t)=>`Found multiple elements with the placeholder text of: ${t}`,qe=(e,t)=>`Unable to find an element with the placeholder text of: ${t}`,[b,D,H,I,O]=c(h(i,Re,qe));function S(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>fe(l,a,o)).flat(1/0))]}var ge=(e,t)=>`Found multiple elements with the text of: ${t}`,Qe=(e,t)=>`Unable to find an element with the text of: ${t}`,[V,_,$,F,U]=c(h(S,ge,Qe));function w(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>Me(l,a,o)).flat(1/0))]}var be=(e,t)=>`Found multiple elements with the display value of: ${t}`,De=(e,t)=>`Unable to find an element with the display value of: ${t}`,[C,N,j,k,v]=c(h(w,be,De));function y(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>Be(l,a,o)).flat(1/0))]}var He=(e,t)=>`Found multiple elements with the alt text of: ${t}`,Ie=(e,t)=>`Unable to find an element with the alt text of: ${t}`,[J,W,Y,z,G]=c(h(y,He,Ie));function T(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>pe(l,a,o)).flat(1/0))]}var Oe=(e,t)=>`Found multiple elements with the title of: ${t}`,Ve=(e,t)=>`Unable to find an element with the title of: ${t}`,[K,X,Z,ee,te]=c(h(T,Oe,Ve));function f(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>Ae(l,a,o)).flat(1/0))]}var _e=(e,t)=>`Found multiple elements with the test id of: ${t}`,$e=(e,t)=>`Unable to find an element with the test id of: ${t}`,[oe,ae,le,ne,re]=c(h(f,_e,$e));import{logDOM as Ne}from"@testing-library/dom";import{prettyDOM as Fe}from"@testing-library/dom";function Ue(...e){let[t,a,o]=e;return Fe(de(t),a,o)}function de(e){e==null&&(e=document.documentElement);let t="";"outerHTML"in e&&(t=e.outerHTML),t=Ce(e,t),t=t.replace(/<!--.*?-->/g,""),t=t.replace(/>\s+</g,"><");let o=new DOMParser().parseFromString(t,"text/html");return e instanceof Document||e instanceof HTMLHtmlElement||e instanceof HTMLBodyElement?o.body:o.body.firstElementChild}function Ce(e,t="",a=Array.from(e.children)){for(("shadowRoot"in e)&&e.shadowRoot!=null&&a.unshift(e.shadowRoot),a.unshift(e);a.length>0;){let o=a.shift();if(o&&"shadowRoot"in o&&o.shadowRoot!=null){let l=o.outerHTML,r=document.createElement("shadow-root");r.innerHTML=o.shadowRoot.innerHTML;let n=o.cloneNode(!0);n.insertAdjacentElement("afterbegin",r),t=t.replace(l,n.outerHTML),t=t.replace(l,o.outerHTML),a.push(...Array.from(o.shadowRoot.children))}a.push(...Array.from(o.children))}return t}function B(...e){let[t,a,o]=e;Ne(de(t),a,o)}function he(...e){let[t,a,o]=e;Array.isArray(t)?t.forEach(l=>B(l,a,o)):B(t,a,o)}import{screen as je}from"@testing-library/dom";var ke={...je,debug:he,queryAllByShadowRole:(...e)=>s(document.documentElement,e[0],e[1]),queryByShadowRole:(...e)=>p(document.documentElement,e[0],e[1]),getAllByShadowRole:(...e)=>A(document.documentElement,e[0],e[1]),getByShadowRole:(...e)=>E(document.documentElement,e[0],e[1]),findAllByShadowRole:(...e)=>x(document.documentElement,e[0],e[1],e[2]),findByShadowRole:(...e)=>P(document.documentElement,e[0],e[1],e[2]),queryAllByShadowLabelText:(...e)=>m(document.documentElement,e[0],e[1]),queryByShadowLabelText:(...e)=>L(document.documentElement,e[0],e[1]),getAllByShadowLabelText:(...e)=>R(document.documentElement,e[0],e[1]),getByShadowLabelText:(...e)=>q(document.documentElement,e[0],e[1]),findAllByShadowLabelText:(...e)=>g(document.documentElement,e[0],e[1],e[2]),findByShadowLabelText:(...e)=>Q(document.documentElement,e[0],e[1],e[2]),queryAllByShadowPlaceholderText:(...e)=>i(document.documentElement,e[0],e[1]),queryByShadowPlaceholderText:(...e)=>b(document.documentElement,e[0],e[1]),getAllByShadowPlaceholderText:(...e)=>D(document.documentElement,e[0],e[1]),getByShadowPlaceholderText:(...e)=>H(document.documentElement,e[0],e[1]),findAllByShadowPlaceholderText:(...e)=>I(document.documentElement,e[0],e[1],e[2]),findByShadowPlaceholderText:(...e)=>O(document.documentElement,e[0],e[1],e[2]),queryAllByShadowText:(...e)=>S(document.documentElement,e[0],e[1]),queryByShadowText:(...e)=>V(document.documentElement,e[0],e[1]),getAllByShadowText:(...e)=>_(document.documentElement,e[0],e[1]),getByShadowText:(...e)=>$(document.documentElement,e[0],e[1]),findAllByShadowText:(...e)=>F(document.documentElement,e[0],e[1],e[2]),findByShadowText:(...e)=>U(document.documentElement,e[0],e[1],e[2]),queryAllByShadowDisplayValue:(...e)=>w(document.documentElement,e[0],e[1]),queryByShadowDisplayValue:(...e)=>C(document.documentElement,e[0],e[1]),getAllByShadowDisplayValue:(...e)=>N(document.documentElement,e[0],e[1]),getByShadowDisplayValue:(...e)=>j(document.documentElement,e[0],e[1]),findAllByShadowDisplayValue:(...e)=>k(document.documentElement,e[0],e[1],e[2]),findByShadowDisplayValue:(...e)=>v(document.documentElement,e[0],e[1],e[2]),queryAllByShadowAltText:(...e)=>y(document.documentElement,e[0],e[1]),queryByShadowAltText:(...e)=>J(document.documentElement,e[0],e[1]),getAllByShadowAltText:(...e)=>W(document.documentElement,e[0],e[1]),getByShadowAltText:(...e)=>Y(document.documentElement,e[0],e[1]),findAllByShadowAltText:(...e)=>z(document.documentElement,e[0],e[1],e[2]),findByShadowAltText:(...e)=>G(document.documentElement,e[0],e[1],e[2]),queryAllByShadowTitle:(...e)=>T(document.documentElement,e[0],e[1]),queryByShadowTitle:(...e)=>K(document.documentElement,e[0],e[1]),getAllByShadowTitle:(...e)=>X(document.documentElement,e[0],e[1]),getByShadowTitle:(...e)=>Z(document.documentElement,e[0],e[1]),findAllByShadowTitle:(...e)=>ee(document.documentElement,e[0],e[1],e[2]),findByShadowTitle:(...e)=>te(document.documentElement,e[0],e[1],e[2]),queryAllByShadowTestId:(...e)=>f(document.documentElement,e[0],e[1]),queryByShadowTestId:(...e)=>oe(document.documentElement,e[0],e[1]),getAllByShadowTestId:(...e)=>ae(document.documentElement,e[0],e[1]),getByShadowTestId:(...e)=>le(document.documentElement,e[0],e[1]),findAllByShadowTestId:(...e)=>ne(document.documentElement,e[0],e[1],e[2]),findByShadowTestId:(...e)=>re(document.documentElement,e[0],e[1],e[2])};function se(){if(typeof ShadowRoot>"u")throw"Your environment does not support shadow roots.";ShadowRoot.prototype.matches==null&&Object.defineProperties(ShadowRoot.prototype,{matches:{get(){return function(e){return e.trim()==="*"?!0:this.querySelector(e)!=null}}}}),ShadowRoot.prototype.outerHTML==null&&Object.defineProperties(ShadowRoot.prototype,{outerHTML:{get(){return this.innerHTML}}})}se();var We={...ve,...M};function Tt(e){return Je(e,We)}export{he as debug,Se as deepQuerySelector,ce as deepQuerySelectorAll,z as findAllByShadowAltText,k as findAllByShadowDisplayValue,g as findAllByShadowLabelText,I as findAllByShadowPlaceholderText,x as findAllByShadowRole,ne as findAllByShadowTestId,F as findAllByShadowText,ee as findAllByShadowTitle,G as findByShadowAltText,v as findByShadowDisplayValue,Q as findByShadowLabelText,O as findByShadowPlaceholderText,P as findByShadowRole,re as findByShadowTestId,U as findByShadowText,te as findByShadowTitle,W as getAllByShadowAltText,N as getAllByShadowDisplayValue,R as getAllByShadowLabelText,D as getAllByShadowPlaceholderText,A as getAllByShadowRole,ae as getAllByShadowTestId,_ as getAllByShadowText,X as getAllByShadowTitle,d as getAllElementsAndShadowRoots,Y as getByShadowAltText,j as getByShadowDisplayValue,q as getByShadowLabelText,H as getByShadowPlaceholderText,E as getByShadowRole,le as getByShadowTestId,$ as getByShadowText,Z as getByShadowTitle,B as logShadowDOM,Ue as prettyShadowDOM,y as queryAllByShadowAltText,w as queryAllByShadowDisplayValue,m as queryAllByShadowLabelText,i as queryAllByShadowPlaceholderText,s as queryAllByShadowRole,f as queryAllByShadowTestId,S as queryAllByShadowText,T as queryAllByShadowTitle,J as queryByShadowAltText,C as queryByShadowDisplayValue,L as queryByShadowLabelText,b as queryByShadowPlaceholderText,p as queryByShadowRole,oe as queryByShadowTestId,V as queryByShadowText,K as queryByShadowTitle,ke as screen,Tt as within};
var me=Object.defineProperty;var ie=(e,t)=>{for(var a in t)me(e,a,{get:t[a],enumerable:!0})};import{queries as ve,within as Je}from"@testing-library/dom";var M={};ie(M,{findAllByShadowAltText:()=>z,findAllByShadowDisplayValue:()=>k,findAllByShadowLabelText:()=>g,findAllByShadowPlaceholderText:()=>I,findAllByShadowRole:()=>x,findAllByShadowTestId:()=>ne,findAllByShadowText:()=>F,findAllByShadowTitle:()=>ee,findByShadowAltText:()=>G,findByShadowDisplayValue:()=>v,findByShadowLabelText:()=>Q,findByShadowPlaceholderText:()=>O,findByShadowRole:()=>P,findByShadowTestId:()=>re,findByShadowText:()=>U,findByShadowTitle:()=>te,getAllByShadowAltText:()=>W,getAllByShadowDisplayValue:()=>N,getAllByShadowLabelText:()=>R,getAllByShadowPlaceholderText:()=>H,getAllByShadowRole:()=>A,getAllByShadowTestId:()=>ae,getAllByShadowText:()=>_,getAllByShadowTitle:()=>X,getByShadowAltText:()=>Y,getByShadowDisplayValue:()=>j,getByShadowLabelText:()=>q,getByShadowPlaceholderText:()=>D,getByShadowRole:()=>E,getByShadowTestId:()=>le,getByShadowText:()=>$,getByShadowTitle:()=>Z,queryAllByShadowAltText:()=>y,queryAllByShadowDisplayValue:()=>w,queryAllByShadowLabelText:()=>m,queryAllByShadowPlaceholderText:()=>i,queryAllByShadowRole:()=>s,queryAllByShadowTestId:()=>f,queryAllByShadowText:()=>S,queryAllByShadowTitle:()=>T,queryByShadowAltText:()=>J,queryByShadowDisplayValue:()=>C,queryByShadowLabelText:()=>L,queryByShadowPlaceholderText:()=>b,queryByShadowRole:()=>p,queryByShadowTestId:()=>oe,queryByShadowText:()=>V,queryByShadowTitle:()=>K});import{buildQueries as h,queryAllByRole as we,queryAllByLabelText as ye,queryAllByPlaceholderText as Te,queryAllByText as fe,queryAllByDisplayValue as Me,queryAllByAltText as Be,queryAllByTitle as pe,queryAllByTestId as Ae}from"@testing-library/dom";function Se(e,t,a={shallow:!1}){let o=ce(e,t,a);return Array.isArray(o)&&o.length>0?o[0]:null}function ce(e,t,a={shallow:!1}){let l=d(e,a).map(r=>Array.from(r.querySelectorAll(t))).flat(1/0);return[...new Set(l)]}function d(e,t={shallow:!1}){return ue(e,"*",t)}function ue(e,t,a={shallow:!1},o=[],l=[]){return e instanceof Document&&(e=document.documentElement),o=[e],l.push(e),e instanceof HTMLElement&&e.shadowRoot!=null&&e.shadowRoot.mode!=="closed"&&(l.push(e.shadowRoot),o.push(e.shadowRoot)),o.forEach(r=>{r.querySelectorAll(t).forEach(n=>{if(n.shadowRoot==null||n.shadowRoot.mode==="closed"){l.push(n);return}if(l.push(n.shadowRoot),a.shallow===!0){n.shadowRoot.querySelectorAll(t).forEach(u=>{l.push(u)});return}n.shadowRoot.querySelectorAll(t).forEach(u=>{l.push(u),o.push(u)}),ue(n.shadowRoot,t,a,o,l)})}),[...new Set(l)]}function c(e){return e.map(t=>(...a)=>{let[o,l,r,...n]=a;return r==null&&(r={}),r.suggest=!1,t(o,l,r,...n)})}function s(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>we(l,a,o)).flat(1/0))]}var Ee=(e,t)=>`Found multiple elements with the role of: ${t}`,xe=(e,t)=>`Unable to find an element with the role of: ${t}`,[p,A,E,x,P]=c(h(s,Ee,xe));function m(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>ye(l,a,o)).flat(1/0))]}var Pe=(e,t)=>`Found multiple elements with the label text of: ${t}`,Le=(e,t)=>`Unable to find an element with the label text of: ${t}`,[L,R,q,g,Q]=c(h(m,Pe,Le));function i(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>Te(l,a,o)).flat(1/0))]}var Re=(e,t)=>`Found multiple elements with the placeholder text of: ${t}`,qe=(e,t)=>`Unable to find an element with the placeholder text of: ${t}`,[b,H,D,I,O]=c(h(i,Re,qe));function S(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>fe(l,a,o)).flat(1/0))]}var ge=(e,t)=>`Found multiple elements with the text of: ${t}`,Qe=(e,t)=>`Unable to find an element with the text of: ${t}`,[V,_,$,F,U]=c(h(S,ge,Qe));function w(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>Me(l,a,o)).flat(1/0))]}var be=(e,t)=>`Found multiple elements with the display value of: ${t}`,He=(e,t)=>`Unable to find an element with the display value of: ${t}`,[C,N,j,k,v]=c(h(w,be,He));function y(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>Be(l,a,o)).flat(1/0))]}var De=(e,t)=>`Found multiple elements with the alt text of: ${t}`,Ie=(e,t)=>`Unable to find an element with the alt text of: ${t}`,[J,W,Y,z,G]=c(h(y,De,Ie));function T(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>pe(l,a,o)).flat(1/0))]}var Oe=(e,t)=>`Found multiple elements with the title of: ${t}`,Ve=(e,t)=>`Unable to find an element with the title of: ${t}`,[K,X,Z,ee,te]=c(h(T,Oe,Ve));function f(...e){let[t,a,o]=e;return o==null&&(o={}),o.suggest=!1,[...new Set(d(t,o).map(l=>Ae(l,a,o)).flat(1/0))]}var _e=(e,t)=>`Found multiple elements with the test id of: ${t}`,$e=(e,t)=>`Unable to find an element with the test id of: ${t}`,[oe,ae,le,ne,re]=c(h(f,_e,$e));import{logDOM as Ne}from"@testing-library/dom";import{prettyDOM as Fe}from"@testing-library/dom";function Ue(...e){let[t,a,o]=e;return Fe(de(t),a,o)}function de(e){e==null&&(e=document.documentElement);let t="";"outerHTML"in e&&(t=e.outerHTML),t=Ce(e,t),t=t.replace(/<!--.*?-->/g,""),t=t.replace(/>\s+</g,"><");let o=new DOMParser().parseFromString(t,"text/html");return e instanceof Document||e instanceof HTMLHtmlElement||e instanceof HTMLBodyElement?o.body:o.body.firstElementChild}function Ce(e,t="",a=Array.from(e.children)){for(("shadowRoot"in e)&&e.shadowRoot!=null&&a.unshift(e.shadowRoot),a.unshift(e);a.length>0;){let o=a.shift();if(o&&"shadowRoot"in o&&o.shadowRoot!=null){let l=o.outerHTML,r=document.createElement("shadow-root");r.innerHTML=o.shadowRoot.innerHTML;let n=o.cloneNode(!0);n.insertAdjacentElement("afterbegin",r),t=t.replace(l,n.outerHTML),t=t.replace(l,o.outerHTML),a.push(...Array.from(o.shadowRoot.children))}a.push(...Array.from(o.children))}return t}function B(...e){let[t,a,o]=e;Ne(de(t),a,o)}function he(...e){let[t,a,o]=e;Array.isArray(t)?t.forEach(l=>B(l,a,o)):B(t,a,o)}import{screen as je}from"@testing-library/dom";var ke={...je,debug:he,queryAllByShadowRole:(...e)=>s(document.documentElement,e[0],e[1]),queryByShadowRole:(...e)=>p(document.documentElement,e[0],e[1]),getAllByShadowRole:(...e)=>A(document.documentElement,e[0],e[1]),getByShadowRole:(...e)=>E(document.documentElement,e[0],e[1]),findAllByShadowRole:(...e)=>x(document.documentElement,e[0],e[1],e[2]),findByShadowRole:(...e)=>P(document.documentElement,e[0],e[1],e[2]),queryAllByShadowLabelText:(...e)=>m(document.documentElement,e[0],e[1]),queryByShadowLabelText:(...e)=>L(document.documentElement,e[0],e[1]),getAllByShadowLabelText:(...e)=>R(document.documentElement,e[0],e[1]),getByShadowLabelText:(...e)=>q(document.documentElement,e[0],e[1]),findAllByShadowLabelText:(...e)=>g(document.documentElement,e[0],e[1],e[2]),findByShadowLabelText:(...e)=>Q(document.documentElement,e[0],e[1],e[2]),queryAllByShadowPlaceholderText:(...e)=>i(document.documentElement,e[0],e[1]),queryByShadowPlaceholderText:(...e)=>b(document.documentElement,e[0],e[1]),getAllByShadowPlaceholderText:(...e)=>H(document.documentElement,e[0],e[1]),getByShadowPlaceholderText:(...e)=>D(document.documentElement,e[0],e[1]),findAllByShadowPlaceholderText:(...e)=>I(document.documentElement,e[0],e[1],e[2]),findByShadowPlaceholderText:(...e)=>O(document.documentElement,e[0],e[1],e[2]),queryAllByShadowText:(...e)=>S(document.documentElement,e[0],e[1]),queryByShadowText:(...e)=>V(document.documentElement,e[0],e[1]),getAllByShadowText:(...e)=>_(document.documentElement,e[0],e[1]),getByShadowText:(...e)=>$(document.documentElement,e[0],e[1]),findAllByShadowText:(...e)=>F(document.documentElement,e[0],e[1],e[2]),findByShadowText:(...e)=>U(document.documentElement,e[0],e[1],e[2]),queryAllByShadowDisplayValue:(...e)=>w(document.documentElement,e[0],e[1]),queryByShadowDisplayValue:(...e)=>C(document.documentElement,e[0],e[1]),getAllByShadowDisplayValue:(...e)=>N(document.documentElement,e[0],e[1]),getByShadowDisplayValue:(...e)=>j(document.documentElement,e[0],e[1]),findAllByShadowDisplayValue:(...e)=>k(document.documentElement,e[0],e[1],e[2]),findByShadowDisplayValue:(...e)=>v(document.documentElement,e[0],e[1],e[2]),queryAllByShadowAltText:(...e)=>y(document.documentElement,e[0],e[1]),queryByShadowAltText:(...e)=>J(document.documentElement,e[0],e[1]),getAllByShadowAltText:(...e)=>W(document.documentElement,e[0],e[1]),getByShadowAltText:(...e)=>Y(document.documentElement,e[0],e[1]),findAllByShadowAltText:(...e)=>z(document.documentElement,e[0],e[1],e[2]),findByShadowAltText:(...e)=>G(document.documentElement,e[0],e[1],e[2]),queryAllByShadowTitle:(...e)=>T(document.documentElement,e[0],e[1]),queryByShadowTitle:(...e)=>K(document.documentElement,e[0],e[1]),getAllByShadowTitle:(...e)=>X(document.documentElement,e[0],e[1]),getByShadowTitle:(...e)=>Z(document.documentElement,e[0],e[1]),findAllByShadowTitle:(...e)=>ee(document.documentElement,e[0],e[1],e[2]),findByShadowTitle:(...e)=>te(document.documentElement,e[0],e[1],e[2]),queryAllByShadowTestId:(...e)=>f(document.documentElement,e[0],e[1]),queryByShadowTestId:(...e)=>oe(document.documentElement,e[0],e[1]),getAllByShadowTestId:(...e)=>ae(document.documentElement,e[0],e[1]),getByShadowTestId:(...e)=>le(document.documentElement,e[0],e[1]),findAllByShadowTestId:(...e)=>ne(document.documentElement,e[0],e[1],e[2]),findByShadowTestId:(...e)=>re(document.documentElement,e[0],e[1],e[2])};function se(){if(typeof ShadowRoot>"u")throw"Your environment does not support shadow roots.";ShadowRoot.prototype.matches==null&&Object.defineProperties(ShadowRoot.prototype,{matches:{get(){return function(e){return e.trim()==="*"?!0:this.querySelector(e)!=null}}}}),ShadowRoot.prototype.outerHTML==null&&Object.defineProperties(ShadowRoot.prototype,{outerHTML:{get(){return this.innerHTML}}})}se();var We={...ve,...M};function Tt(e){return Je(e,We)}export{he as debug,Se as deepQuerySelector,ce as deepQuerySelectorAll,z as findAllByShadowAltText,k as findAllByShadowDisplayValue,g as findAllByShadowLabelText,I as findAllByShadowPlaceholderText,x as findAllByShadowRole,ne as findAllByShadowTestId,F as findAllByShadowText,ee as findAllByShadowTitle,G as findByShadowAltText,v as findByShadowDisplayValue,Q as findByShadowLabelText,O as findByShadowPlaceholderText,P as findByShadowRole,re as findByShadowTestId,U as findByShadowText,te as findByShadowTitle,W as getAllByShadowAltText,N as getAllByShadowDisplayValue,R as getAllByShadowLabelText,H as getAllByShadowPlaceholderText,A as getAllByShadowRole,ae as getAllByShadowTestId,_ as getAllByShadowText,X as getAllByShadowTitle,d as getAllElementsAndShadowRoots,Y as getByShadowAltText,j as getByShadowDisplayValue,q as getByShadowLabelText,D as getByShadowPlaceholderText,E as getByShadowRole,le as getByShadowTestId,$ as getByShadowText,Z as getByShadowTitle,B as logShadowDOM,Ue as prettyShadowDOM,y as queryAllByShadowAltText,w as queryAllByShadowDisplayValue,m as queryAllByShadowLabelText,i as queryAllByShadowPlaceholderText,s as queryAllByShadowRole,f as queryAllByShadowTestId,S as queryAllByShadowText,T as queryAllByShadowTitle,J as queryByShadowAltText,C as queryByShadowDisplayValue,L as queryByShadowLabelText,b as queryByShadowPlaceholderText,p as queryByShadowRole,oe as queryByShadowTestId,V as queryByShadowText,K as queryByShadowTitle,ke as screen,Tt as within};
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"inputs":{"src/deep-query-selectors.ts":{"bytes":3494,"imports":[]},"src/shadow-queries.ts":{"bytes":10219,"imports":[{"path":"src/deep-query-selectors.ts","kind":"import-statement"}]},"src/pretty-shadow-dom.ts":{"bytes":2216,"imports":[]},"src/log-shadow-dom.ts":{"bytes":282,"imports":[{"path":"src/pretty-shadow-dom.ts","kind":"import-statement"}]},"src/debug.ts":{"bytes":407,"imports":[{"path":"src/log-shadow-dom.ts","kind":"import-statement"}]},"src/shadow-screen.ts":{"bytes":9324,"imports":[{"path":"src/debug.ts","kind":"import-statement"},{"path":"src/shadow-queries.ts","kind":"import-statement"}]},"src/trick-dom-testing-library.ts":{"bytes":1227,"imports":[]},"src/types.ts":{"bytes":2196,"imports":[]},"src/index.ts":{"bytes":825,"imports":[{"path":"src/shadow-queries.ts","kind":"import-statement"},{"path":"src/debug.ts","kind":"import-statement"},{"path":"src/log-shadow-dom.ts","kind":"import-statement"},{"path":"src/pretty-shadow-dom.ts","kind":"import-statement"},{"path":"src/shadow-screen.ts","kind":"import-statement"},{"path":"src/trick-dom-testing-library.ts","kind":"import-statement"},{"path":"src/types.ts","kind":"import-statement"},{"path":"src/shadow-queries.ts","kind":"import-statement"},{"path":"src/deep-query-selectors.ts","kind":"import-statement"}]}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":47063},"dist/index.cjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":1688},"src/shadow-queries.ts":{"bytesInOutput":4034},"src/deep-query-selectors.ts":{"bytesInOutput":809},"src/log-shadow-dom.ts":{"bytesInOutput":94},"src/pretty-shadow-dom.ts":{"bytesInOutput":936},"src/debug.ts":{"bytesInOutput":80},"src/shadow-screen.ts":{"bytesInOutput":3432},"src/trick-dom-testing-library.ts":{"bytesInOutput":395}},"bytes":13115}}}
{"inputs":{"src/deep-query-selectors.ts":{"bytes":3554,"imports":[]},"src/shadow-queries.ts":{"bytes":10219,"imports":[{"path":"src/deep-query-selectors.ts","kind":"import-statement"}]},"src/pretty-shadow-dom.ts":{"bytes":2216,"imports":[]},"src/log-shadow-dom.ts":{"bytes":282,"imports":[{"path":"src/pretty-shadow-dom.ts","kind":"import-statement"}]},"src/debug.ts":{"bytes":407,"imports":[{"path":"src/log-shadow-dom.ts","kind":"import-statement"}]},"src/shadow-screen.ts":{"bytes":9324,"imports":[{"path":"src/debug.ts","kind":"import-statement"},{"path":"src/shadow-queries.ts","kind":"import-statement"}]},"src/trick-dom-testing-library.ts":{"bytes":1227,"imports":[]},"src/types.ts":{"bytes":2196,"imports":[]},"src/index.ts":{"bytes":825,"imports":[{"path":"src/shadow-queries.ts","kind":"import-statement"},{"path":"src/debug.ts","kind":"import-statement"},{"path":"src/log-shadow-dom.ts","kind":"import-statement"},{"path":"src/pretty-shadow-dom.ts","kind":"import-statement"},{"path":"src/shadow-screen.ts","kind":"import-statement"},{"path":"src/trick-dom-testing-library.ts","kind":"import-statement"},{"path":"src/types.ts","kind":"import-statement"},{"path":"src/shadow-queries.ts","kind":"import-statement"},{"path":"src/deep-query-selectors.ts","kind":"import-statement"}]}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":47152},"dist/index.cjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":1688},"src/shadow-queries.ts":{"bytesInOutput":4034},"src/deep-query-selectors.ts":{"bytesInOutput":832},"src/log-shadow-dom.ts":{"bytesInOutput":94},"src/pretty-shadow-dom.ts":{"bytesInOutput":936},"src/debug.ts":{"bytesInOutput":80},"src/shadow-screen.ts":{"bytesInOutput":3432},"src/trick-dom-testing-library.ts":{"bytesInOutput":395}},"bytes":13138}}}

@@ -1,1 +0,1 @@

{"inputs":{"src/deep-query-selectors.ts":{"bytes":3494,"imports":[]},"src/shadow-queries.ts":{"bytes":10219,"imports":[{"path":"src/deep-query-selectors.ts","kind":"import-statement"}]},"src/pretty-shadow-dom.ts":{"bytes":2216,"imports":[]},"src/log-shadow-dom.ts":{"bytes":282,"imports":[{"path":"src/pretty-shadow-dom.ts","kind":"import-statement"}]},"src/debug.ts":{"bytes":407,"imports":[{"path":"src/log-shadow-dom.ts","kind":"import-statement"}]},"src/shadow-screen.ts":{"bytes":9324,"imports":[{"path":"src/debug.ts","kind":"import-statement"},{"path":"src/shadow-queries.ts","kind":"import-statement"}]},"src/trick-dom-testing-library.ts":{"bytes":1227,"imports":[]},"src/types.ts":{"bytes":2196,"imports":[]},"src/index.ts":{"bytes":825,"imports":[{"path":"src/shadow-queries.ts","kind":"import-statement"},{"path":"src/debug.ts","kind":"import-statement"},{"path":"src/log-shadow-dom.ts","kind":"import-statement"},{"path":"src/pretty-shadow-dom.ts","kind":"import-statement"},{"path":"src/shadow-screen.ts","kind":"import-statement"},{"path":"src/trick-dom-testing-library.ts","kind":"import-statement"},{"path":"src/types.ts","kind":"import-statement"},{"path":"src/shadow-queries.ts","kind":"import-statement"},{"path":"src/deep-query-selectors.ts","kind":"import-statement"}]}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":45497},"dist/index.js":{"imports":[],"exports":["debug","deepQuerySelector","deepQuerySelectorAll","findAllByShadowAltText","findAllByShadowDisplayValue","findAllByShadowLabelText","findAllByShadowPlaceholderText","findAllByShadowRole","findAllByShadowTestId","findAllByShadowText","findAllByShadowTitle","findByShadowAltText","findByShadowDisplayValue","findByShadowLabelText","findByShadowPlaceholderText","findByShadowRole","findByShadowTestId","findByShadowText","findByShadowTitle","getAllByShadowAltText","getAllByShadowDisplayValue","getAllByShadowLabelText","getAllByShadowPlaceholderText","getAllByShadowRole","getAllByShadowTestId","getAllByShadowText","getAllByShadowTitle","getAllElementsAndShadowRoots","getByShadowAltText","getByShadowDisplayValue","getByShadowLabelText","getByShadowPlaceholderText","getByShadowRole","getByShadowTestId","getByShadowText","getByShadowTitle","logShadowDOM","prettyShadowDOM","queryAllByShadowAltText","queryAllByShadowDisplayValue","queryAllByShadowLabelText","queryAllByShadowPlaceholderText","queryAllByShadowRole","queryAllByShadowTestId","queryAllByShadowText","queryAllByShadowTitle","queryByShadowAltText","queryByShadowDisplayValue","queryByShadowLabelText","queryByShadowPlaceholderText","queryByShadowRole","queryByShadowTestId","queryByShadowText","queryByShadowTitle","screen","within"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":117},"src/shadow-queries.ts":{"bytesInOutput":3936},"src/deep-query-selectors.ts":{"bytesInOutput":809},"src/log-shadow-dom.ts":{"bytesInOutput":91},"src/pretty-shadow-dom.ts":{"bytesInOutput":934},"src/debug.ts":{"bytesInOutput":80},"src/shadow-screen.ts":{"bytesInOutput":3434},"src/trick-dom-testing-library.ts":{"bytesInOutput":395}},"bytes":11376}}}
{"inputs":{"src/deep-query-selectors.ts":{"bytes":3554,"imports":[]},"src/shadow-queries.ts":{"bytes":10219,"imports":[{"path":"src/deep-query-selectors.ts","kind":"import-statement"}]},"src/pretty-shadow-dom.ts":{"bytes":2216,"imports":[]},"src/log-shadow-dom.ts":{"bytes":282,"imports":[{"path":"src/pretty-shadow-dom.ts","kind":"import-statement"}]},"src/debug.ts":{"bytes":407,"imports":[{"path":"src/log-shadow-dom.ts","kind":"import-statement"}]},"src/shadow-screen.ts":{"bytes":9324,"imports":[{"path":"src/debug.ts","kind":"import-statement"},{"path":"src/shadow-queries.ts","kind":"import-statement"}]},"src/trick-dom-testing-library.ts":{"bytes":1227,"imports":[]},"src/types.ts":{"bytes":2196,"imports":[]},"src/index.ts":{"bytes":825,"imports":[{"path":"src/shadow-queries.ts","kind":"import-statement"},{"path":"src/debug.ts","kind":"import-statement"},{"path":"src/log-shadow-dom.ts","kind":"import-statement"},{"path":"src/pretty-shadow-dom.ts","kind":"import-statement"},{"path":"src/shadow-screen.ts","kind":"import-statement"},{"path":"src/trick-dom-testing-library.ts","kind":"import-statement"},{"path":"src/types.ts","kind":"import-statement"},{"path":"src/shadow-queries.ts","kind":"import-statement"},{"path":"src/deep-query-selectors.ts","kind":"import-statement"}]}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":45586},"dist/index.js":{"imports":[],"exports":["debug","deepQuerySelector","deepQuerySelectorAll","findAllByShadowAltText","findAllByShadowDisplayValue","findAllByShadowLabelText","findAllByShadowPlaceholderText","findAllByShadowRole","findAllByShadowTestId","findAllByShadowText","findAllByShadowTitle","findByShadowAltText","findByShadowDisplayValue","findByShadowLabelText","findByShadowPlaceholderText","findByShadowRole","findByShadowTestId","findByShadowText","findByShadowTitle","getAllByShadowAltText","getAllByShadowDisplayValue","getAllByShadowLabelText","getAllByShadowPlaceholderText","getAllByShadowRole","getAllByShadowTestId","getAllByShadowText","getAllByShadowTitle","getAllElementsAndShadowRoots","getByShadowAltText","getByShadowDisplayValue","getByShadowLabelText","getByShadowPlaceholderText","getByShadowRole","getByShadowTestId","getByShadowText","getByShadowTitle","logShadowDOM","prettyShadowDOM","queryAllByShadowAltText","queryAllByShadowDisplayValue","queryAllByShadowLabelText","queryAllByShadowPlaceholderText","queryAllByShadowRole","queryAllByShadowTestId","queryAllByShadowText","queryAllByShadowTitle","queryByShadowAltText","queryByShadowDisplayValue","queryByShadowLabelText","queryByShadowPlaceholderText","queryByShadowRole","queryByShadowTestId","queryByShadowText","queryByShadowTitle","screen","within"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":117},"src/shadow-queries.ts":{"bytesInOutput":3936},"src/deep-query-selectors.ts":{"bytesInOutput":832},"src/log-shadow-dom.ts":{"bytesInOutput":91},"src/pretty-shadow-dom.ts":{"bytesInOutput":934},"src/debug.ts":{"bytesInOutput":80},"src/shadow-screen.ts":{"bytesInOutput":3434},"src/trick-dom-testing-library.ts":{"bytesInOutput":395}},"bytes":11399}}}
{
"name": "shadow-dom-testing-library",
"version": "1.7.0",
"version": "1.7.1",
"description": "An extension of DOM-testing-library to provide hooks into the shadow dom",

@@ -5,0 +5,0 @@ "type": "module",

import { Container, ShadowOptions } from "./types";
export function deepQuerySelector(
export function deepQuerySelector<T extends HTMLElement>(
container: Container,
selector: string,
options: ShadowOptions = { shallow: false }
): Element | null {
): T | null {
const els = deepQuerySelectorAll(container, selector, options);
if (Array.isArray(els) && els.length > 0) {
return els[0] as Element | null;
return els[0] as T | null;
}

@@ -77,2 +77,3 @@

elements.push(container.shadowRoot);
elementsToProcess.push(container.shadowRoot)
}

@@ -79,0 +80,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc