Socket
Socket
Sign inDemoInstall

shadow-dom-testing-library

Package Overview
Dependencies
122
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.3.1

2

dist/index.js

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

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

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

{"inputs":{"src/jsdom-setup.ts":{"bytes":150,"imports":[]},"src/prettyShadowDOM.ts":{"bytes":2134,"imports":[{"path":"src/jsdom-setup.ts","kind":"import-statement"}]},"src/debug.ts":{"bytes":367,"imports":[{"path":"src/prettyShadowDOM.ts","kind":"import-statement"}]},"src/index.ts":{"bytes":23306,"imports":[{"path":"src/debug.ts","kind":"import-statement"}]}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":40707},"dist/index.cjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":9555},"src/jsdom-setup.ts":{"bytesInOutput":88},"src/prettyShadowDOM.ts":{"bytesInOutput":721},"src/debug.ts":{"bytesInOutput":79}},"bytes":12028}}}
{"inputs":{"src/jsdom-setup.ts":{"bytes":150,"imports":[]},"src/prettyShadowDOM.ts":{"bytes":2461,"imports":[{"path":"src/jsdom-setup.ts","kind":"import-statement"}]},"src/debug.ts":{"bytes":367,"imports":[{"path":"src/prettyShadowDOM.ts","kind":"import-statement"}]},"src/index.ts":{"bytes":23249,"imports":[{"path":"src/debug.ts","kind":"import-statement"}]}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":41186},"dist/index.cjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":9540},"src/jsdom-setup.ts":{"bytesInOutput":88},"src/prettyShadowDOM.ts":{"bytesInOutput":843},"src/debug.ts":{"bytesInOutput":79}},"bytes":12135}}}

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

{"inputs":{"src/jsdom-setup.ts":{"bytes":150,"imports":[]},"src/prettyShadowDOM.ts":{"bytes":2134,"imports":[{"path":"src/jsdom-setup.ts","kind":"import-statement"}]},"src/debug.ts":{"bytes":367,"imports":[{"path":"src/prettyShadowDOM.ts","kind":"import-statement"}]},"src/index.ts":{"bytes":23306,"imports":[{"path":"src/debug.ts","kind":"import-statement"}]}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":39322},"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","getByShadowAltText","getByShadowDisplayValue","getByShadowLabelText","getByShadowPlaceholderText","getByShadowRole","getByShadowTestId","getByShadowText","getByShadowTitle","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":7977},"src/jsdom-setup.ts":{"bytesInOutput":98},"src/prettyShadowDOM.ts":{"bytesInOutput":717},"src/debug.ts":{"bytesInOutput":79}},"bytes":10284}}}
{"inputs":{"src/jsdom-setup.ts":{"bytes":150,"imports":[]},"src/prettyShadowDOM.ts":{"bytes":2461,"imports":[{"path":"src/jsdom-setup.ts","kind":"import-statement"}]},"src/debug.ts":{"bytes":367,"imports":[{"path":"src/prettyShadowDOM.ts","kind":"import-statement"}]},"src/index.ts":{"bytes":23249,"imports":[{"path":"src/debug.ts","kind":"import-statement"}]}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":39801},"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","getByShadowAltText","getByShadowDisplayValue","getByShadowLabelText","getByShadowPlaceholderText","getByShadowRole","getByShadowTestId","getByShadowText","getByShadowTitle","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":7961},"src/jsdom-setup.ts":{"bytesInOutput":98},"src/prettyShadowDOM.ts":{"bytesInOutput":842},"src/debug.ts":{"bytesInOutput":79}},"bytes":10390}}}
{
"name": "shadow-dom-testing-library",
"version": "1.3.0",
"version": "1.3.1",
"description": "An extension of DOM-testing-library to provide hooks into the shadow dom",

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

@@ -182,4 +182,3 @@ import {

// Prevent duplicate elements by using ":scope *"
const scopeQuery = ":scope *";
const scopeQuery = "*";

@@ -186,0 +185,0 @@ // Role

import "./jsdom-setup"
import { logDOM, prettyDOM } from "@testing-library/dom";
import { JSDOM } from "jsdom";
import { deepQuerySelectorAll } from ".";

@@ -12,3 +13,3 @@ /**

let htmlString = "";
let htmlString: string = "";

@@ -19,20 +20,4 @@ if ("outerHTML" in element) {

const nodesToProcess = Array.from(element.children);
htmlString = processNodes(element, htmlString, Array.from(element.children))
while (nodesToProcess.length > 0) {
const node = nodesToProcess.shift()!;
if (node.shadowRoot !== null) {
const tempNode = document.createElement("div");
tempNode.innerHTML = node.outerHTML;
const shadowRootPseudoNode = document.createElement("shadow-root");
shadowRootPseudoNode.innerHTML = node.shadowRoot.innerHTML;
tempNode.firstElementChild!.insertBefore(
shadowRootPseudoNode,
tempNode.firstElementChild!.firstChild
);
htmlString = htmlString.replace(node.outerHTML, tempNode.innerHTML);
}
nodesToProcess.push(...Array.from(node.children));
}
// Remove Comment nodes

@@ -60,1 +45,23 @@ htmlString = htmlString.replace(/<!--.*?-->/g, "");

}
function processNodes (element: Element | Document | ShadowRoot, stringBuffer: string = "", nodes: Array<Element | ShadowRoot> = Array.from(element.children)) {
while (nodes.length > 0) {
const node = nodes.shift()!;
if (node && "shadowRoot" in node && node.shadowRoot != null) {
const tempNode = document.createElement("div");
tempNode.innerHTML = node.outerHTML;
const shadowRootPseudoNode = document.createElement("shadow-root");
shadowRootPseudoNode.innerHTML = node.shadowRoot.innerHTML;
tempNode.firstElementChild!.insertBefore(
shadowRootPseudoNode,
tempNode.firstElementChild!.firstChild
);
stringBuffer = stringBuffer.replace(node.outerHTML, tempNode.innerHTML);
nodes.push(...Array.from(node.shadowRoot.children));
}
nodes.push(...Array.from(node.children));
}
return stringBuffer
}

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