mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #12098 from NoHomey/enzyme-2.5.1
Fixes #12097 [enzyme] enzyme.d.ts need to be updated to match latest released version
This commit is contained in:
+14
-2
@@ -96,6 +96,18 @@ namespace ShallowWrapperTest {
|
||||
boolVal = shallowWrapper.containsAnyMatchingElements([<div className="foo bar"/>]);
|
||||
}
|
||||
|
||||
function test_dive() {
|
||||
interface TmpProps {
|
||||
foo: any
|
||||
}
|
||||
|
||||
interface TmpState {
|
||||
bar: any
|
||||
}
|
||||
|
||||
const diveWrapper: ShallowWrapper<TmpProps, TmpState> = shallowWrapper.dive<TmpProps, TmpState>({ context: { foobar: 'barfoo' }});
|
||||
}
|
||||
|
||||
function test_equals() {
|
||||
boolVal = shallowWrapper.equals(<div className="foo bar"/>);
|
||||
}
|
||||
@@ -222,11 +234,11 @@ namespace ShallowWrapperTest {
|
||||
}
|
||||
|
||||
function test_setState() {
|
||||
shallowWrapper = shallowWrapper.setState({ stateProperty: 'state' });
|
||||
shallowWrapper = shallowWrapper.setState({ stateProperty: 'state' }, () => console.log('state updated'));
|
||||
}
|
||||
|
||||
function test_setProps() {
|
||||
shallowWrapper = shallowWrapper.setProps({ propsProperty: 'foo' });
|
||||
shallowWrapper = shallowWrapper.setProps({ propsProperty: 'foo' }, () => console.log('props updated'));
|
||||
}
|
||||
|
||||
function test_setContext() {
|
||||
|
||||
Vendored
+14
-5
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Enzyme v2.4.1
|
||||
// Type definitions for Enzyme v2.5.1
|
||||
// Project: https://github.com/airbnb/enzyme
|
||||
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>
|
||||
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>, Ivo Stratev <https://github.com/NoHomey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path="../react/react.d.ts" />
|
||||
@@ -253,8 +253,9 @@ declare module "enzyme" {
|
||||
*
|
||||
* NOTE: can only be called on a wrapper instance that is also the root instance.
|
||||
* @param state
|
||||
* @param [callback]
|
||||
*/
|
||||
setState(state: S): this;
|
||||
setState(state: S, callback?: () => void): this;
|
||||
|
||||
/**
|
||||
* A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test
|
||||
@@ -265,9 +266,10 @@ declare module "enzyme" {
|
||||
* Returns itself.
|
||||
*
|
||||
* NOTE: can only be called on a wrapper instance that is also the root instance.
|
||||
* @param state
|
||||
* @param props
|
||||
* @param [callback]
|
||||
*/
|
||||
setProps(props: P): this;
|
||||
setProps(props: P, callback?: () => void): this;
|
||||
|
||||
/**
|
||||
* A method that sets the context of the root component, and re-renders. Useful for when you are wanting to
|
||||
@@ -424,6 +426,13 @@ declare module "enzyme" {
|
||||
childAt(index: number): ShallowWrapper<any, any>;
|
||||
childAt<P2, S2>(index: number): ShallowWrapper<P2, S2>;
|
||||
|
||||
/**
|
||||
* Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result.
|
||||
* NOTE: can only be called on wrapper of a single non-DOM component element node.
|
||||
* @param [options]
|
||||
*/
|
||||
dive<P2, S2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2>;
|
||||
|
||||
/**
|
||||
* Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the
|
||||
* current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.
|
||||
|
||||
Reference in New Issue
Block a user