New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

test-drive

Package Overview
Dependencies
Maintainers
2
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-drive - npm Package Compare versions

Comparing version 0.0.33 to 0.0.34

2

dist/src/select-dom.d.ts

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

export declare function selectDom<T extends Element>(container: T, attrName?: string): (...selectors: string[]) => T | null;
export declare function selectDom(container: Element, attrName?: string): <T extends Element>(...selectors: string[]) => T | null;
{
"name": "test-drive",
"version": "0.0.33",
"version": "0.0.34",
"description": "Opinionated library for writing web component tests",

@@ -43,3 +43,3 @@ "main": "./dist/src/index.js",

"mocha-loader": "1.1.1",
"npminject": "1.0.224",
"npminject": "1.0.226",
"rimraf": "2.6.1",

@@ -46,0 +46,0 @@ "typescript": "2.1.6",

@@ -171,1 +171,2 @@ # Test Drive

```

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

export function selectDom<T extends Element>(container: T, attrName: string = 'data-automation-id'): (...selectors: string[]) => T | null {
export function selectDom(container: Element, attrName: string = 'data-automation-id') {
function select(parentElement: T, ...selectors: string[]): T | null {
function select<T extends Element>(parentElement: Element, ...selectors: string[]): T | null {
const [selector, ...rest] = selectors;
const elementList = parentElement.querySelectorAll(`[${attrName}~="${selector}"]`) as NodeListOf<T>;
if(elementList.length === 0) {
const elementList = parentElement.querySelectorAll(`[${attrName}~="${selector}"]`);
if (elementList.length === 0) {
return null;
} else if(elementList.length === 1) {
} else if (elementList.length === 1) {
const element = elementList[0];
if(rest.length>0) {
return select(element, ...rest);
if (rest.length > 0) {
return select<T>(element, ...rest);
} else {
return element;
return element as T;
}

@@ -20,5 +20,5 @@ } else {

return function (...selectors: string[]): T | null {
return select(container, ...selectors);
return function <T extends Element>(...selectors: string[]) {
return select<T>(container, ...selectors);
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc