mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[@commercetools/enzyme-extensions] Add types
This commit is contained in:
parent
f8721b6253
commit
6f37c19a96
@ -0,0 +1,30 @@
|
||||
import React = require('react');
|
||||
import enzyme = require('enzyme');
|
||||
import configureExtensions = require('@commercetools/enzyme-extensions');
|
||||
|
||||
configureExtensions(enzyme.ShallowWrapper);
|
||||
|
||||
function App() {
|
||||
return <Child cb={() => 'Hello world'} />;
|
||||
}
|
||||
|
||||
interface ChildProps {
|
||||
cb: () => string;
|
||||
}
|
||||
|
||||
function Child(props: ChildProps) {
|
||||
return <div>{props.cb()}</div>;
|
||||
}
|
||||
|
||||
enzyme.shallow(<App />)
|
||||
.find(App)
|
||||
.renderProp('render');
|
||||
enzyme.shallow(<App />)
|
||||
.find(Child)
|
||||
.renderProp('render', 1, 2);
|
||||
|
||||
enzyme.shallow(<App />)
|
||||
.find(Child)
|
||||
.drill(props => props.cb());
|
||||
|
||||
enzyme.shallow(<App />).until(Child);
|
||||
22
types/commercetools__enzyme-extensions/index.d.ts
vendored
Normal file
22
types/commercetools__enzyme-extensions/index.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// Type definitions for @commercetools/enzyme-extensions 3.0
|
||||
// Project: https://github.com/commercetools/enzyme-extensions
|
||||
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as enzyme from 'enzyme';
|
||||
|
||||
declare module 'enzyme' {
|
||||
interface UntilOptions {
|
||||
maxDepth: number;
|
||||
}
|
||||
interface ShallowWrapper<P = {}> {
|
||||
renderProp(propName: string, ...args: any[]): ShallowWrapper<P>;
|
||||
drill(expander: (props: any) => ShallowWrapper): ShallowWrapper<P>;
|
||||
until(selector: EnzymeSelector, options?: UntilOptions): ShallowWrapper<P>;
|
||||
}
|
||||
}
|
||||
|
||||
declare function monkeyPatchShallowWrapper(s: typeof enzyme.ShallowWrapper): void;
|
||||
|
||||
export = monkeyPatchShallowWrapper;
|
||||
27
types/commercetools__enzyme-extensions/tsconfig.json
Normal file
27
types/commercetools__enzyme-extensions/tsconfig.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"paths": {
|
||||
"@commercetools/enzyme-extensions": ["commercetools__enzyme-extensions"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"commercetools__enzyme-extensions-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/commercetools__enzyme-extensions/tslint.json
Normal file
1
types/commercetools__enzyme-extensions/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user