Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

test-drive-react

Package Overview
Dependencies
Maintainers
3
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-drive-react - npm Package Compare versions

Comparing version 1.1.2 to 1.3.0

2

cjs/client-renderer.js

@@ -21,3 +21,3 @@ "use strict";

react_dom_1.default.render(element, container);
const select = test_drive_1.selectDom(container);
const select = (0, test_drive_1.selectDom)(container);
return {

@@ -24,0 +24,0 @@ container,

@@ -24,3 +24,3 @@ "use strict";

}
return test_drive_1.selectDom(root)(...selectors);
return (0, test_drive_1.selectDom)(root)(...selectors);
}

@@ -27,0 +27,0 @@ ensuredSelect(...selectors) {

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

export { Simulate, EventSimulator, SyntheticEventData } from 'react-dom/test-utils';
export { Simulate } from 'react-dom/test-utils';
export * from 'test-drive';

@@ -3,0 +3,0 @@ export * from './client-renderer';

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

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

export { Simulate, EventSimulator, SyntheticEventData } from 'react-dom/test-utils';
export { Simulate } from 'react-dom/test-utils';
export * from 'test-drive';

@@ -3,0 +3,0 @@ export * from './client-renderer';

{
"name": "test-drive-react",
"version": "1.1.2",
"version": "1.3.0",
"description": "Opinionated library for Test-Driven Development of React Components.",

@@ -15,3 +15,3 @@ "main": "./cjs/index.js",

"typecheck": "tsc --noEmit",
"lint": "eslint . -f codeframe",
"lint": "eslint .",
"pretest": "npm run typecheck && npm run lint",

@@ -25,28 +25,27 @@ "test": "mocha-play \"./test/**/*.ts?(x)\""

"dependencies": {
"test-drive": "^1.1.3"
"test-drive": "^1.3.0"
},
"devDependencies": {
"@ts-tools/webpack-loader": "^2.1.1",
"@types/chai": "^4.2.18",
"@types/chai-dom": "^0.0.10",
"@types/mocha": "^8.2.2",
"@types/react": "^17.0.8",
"@types/react-dom": "^17.0.5",
"@types/sinon": "^10.0.1",
"@types/sinon-chai": "^3.2.5",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.23.2",
"html-webpack-plugin": "^5.3.1",
"mocha": "^8.4.0",
"mocha-play": "^1.0.1",
"playwright-chromium": "^1.11.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"@ts-tools/webpack-loader": "^4.0.0",
"@types/chai": "^4.3.4",
"@types/chai-dom": "^1.11.0",
"@types/mocha": "^10.0.1",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@types/sinon": "^10.0.13",
"@types/sinon-chai": "^3.2.9",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-react": "^7.31.11",
"mocha": "^10.1.0",
"mocha-play": "^4.0.0",
"playwright-chromium": "^1.28.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"typescript": "~4.3.2",
"util": "^0.12.3",
"webpack": "^5.38.1"
"typescript": "~4.9.3",
"util": "^0.12.5",
"webpack": "^5.75.0"
},

@@ -53,0 +52,0 @@ "files": [

# test-drive-react
[![npm version](https://badge.fury.io/js/test-drive-react.svg)](https://www.npmjs.com/package/test-drive-react)

@@ -15,3 +16,2 @@ [![Build Status](https://github.com/wixplosives/test-drive-react/workflows/tests/badge.svg)](https://github.com/wixplosives/test-drive-react/actions)

# ClientRenderer

@@ -33,6 +33,6 @@

- `container`
- `result` - rendered root component (either DOM Element or React component instance)
- `select` - [DOM selector](https://github.com/wix/test-drive#locating-your-dom-parts-selectdom)
pre-bound to the container
- `container`
- `result` - rendered root component (either DOM Element or React component instance)
- `select` - [DOM selector](https://github.com/wix/test-drive#locating-your-dom-parts-selectdom)
pre-bound to the container

@@ -50,3 +50,3 @@ ## `cleanup()`

All drivers should extend the `DriverBase` class. The basic (and recommended) way of creating drivers is to use
All drivers should extend the `DriverBase` class. The basic (and recommended) way of creating drivers is to use
`.withDriver(DriverClass)` method which is part of the `RenderingContext` interface.

@@ -59,12 +59,11 @@

export class TestComponentDriver extends DriverBase<HTMLElement> {
static ComponentClass = TestComponent;
static ComponentClass = TestComponent;
get samplePart() {
return this.ensuredSelect('SAMPLE_PART') as HTMLDivElement;
}
get samplePart() {
return this.ensuredSelect('SAMPLE_PART') as HTMLDivElement;
}
doAction() {
this.root.click();
}
doAction() {
this.root.click();
}
}

@@ -78,3 +77,3 @@ ```

The getter `.samplePart` provides access (via `data-automation-id`) to specific parts of
the component's shadow DOM, while keeping this detail encapsulated. Similarly,
the component's shadow DOM, while keeping this detail encapsulated. Similarly,
the `.doAction()` method represents specific methods, while keeping the technicalities (event type)

@@ -86,3 +85,3 @@ private.

```tsx
const {driver} = clientRenderer.render(<TestComponent />).withDriver(TestComponentDriver);
const { driver } = clientRenderer.render(<TestComponent />).withDriver(TestComponentDriver);
expect(driver.samplePart).to.be.present();

@@ -94,6 +93,10 @@ ```

- `driver` - instance of the component driver
- `driver` - instance of the component driver
In the case of composite components, the drivers should mirror their structure as well. `.samplePart` in
the above example should, therefore, reference another (relevant) component driver, rather than plain DOM Element,
if it corresponds to custom component.
if it corresponds to custom component.
# License
MIT

@@ -21,3 +21,3 @@ import React from 'react';

}
return root!;
return root;
}

@@ -24,0 +24,0 @@

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

export { Simulate, EventSimulator, SyntheticEventData } from 'react-dom/test-utils';
export { Simulate } from 'react-dom/test-utils';
export * from 'test-drive';
export * from './client-renderer';
export * from './driver-base';

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

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

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