{
- /**
- * Find every node in the render tree that matches the provided selector.
- * @param selector The selector to match.
- */
- find {
* Returns whether or not all the given react elements exists in the shallow render tree
* @param nodes
*/
- containsAllMatchingElements(nodes: ReactElement {
*/
not(selector: EnzymeSelector): this;
- /**
- * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector
- * can be provided and it will filter the children by this selector.
- * @param [selector]
- */
- children {
* @param [key]
*/
state(): S;
- state(key: string): any;
+ state {
* NOTE: can only be called on a wrapper of a single node.
* @param key
*/
- prop(key: string): any;
+ prop {
* @param state
* @param [callback]
*/
- setState(state: S, callback?: () => void): this;
+ setState {
* @param props
* @param [callback]
*/
- setProps(props: P, callback?: () => void): this;
+ setProps ): this;
/**
* A method that sets the context of the root component, and re-renders. Useful for when you are wanting to
@@ -284,7 +225,7 @@ interface CommonWrapper {
* NOTE: can only be called on a wrapper instance that is also the root instance.
* @param state
*/
- setContext(context: Object): this;
+ setContext(context: any): this;
/**
* Gets the instance of the component being rendered as the root node passed into shallow().
@@ -308,14 +249,6 @@ interface CommonWrapper {
*/
debug(): string;
- /**
- * Returns the type of the current node of this wrapper. If it's a composite component, this will be the
- * component constructor. If it's native DOM node, it will be a string of the tag name.
- *
- * Note: can only be called on a wrapper of a single node.
- */
- type(): string | Function;
-
/**
* Returns the name of the current node of the wrapper.
*/
@@ -381,12 +314,29 @@ interface CommonWrapper {
*/
everyWhere(fn: (wrapper: this) => boolean): boolean;
+ /**
+ * Returns true if renderer returned null
+ */
+ isEmptyRender(): boolean;
+
+ /**
+ * Renders the component to static markup and returns a Cheerio wrapper around the result.
+ */
+ render(): Cheerio;
+
+ /**
+ * Returns the type of the current node of this wrapper. If it's a composite component, this will be the
+ * component constructor. If it's native DOM node, it will be a string of the tag name.
+ *
+ * Note: can only be called on a wrapper of a single node.
+ */
+ type(): string | ComponentClass | StatelessComponent ;
+
length: number;
}
export interface ShallowWrapper extends CommonWrapper {
shallow(): ShallowWrapper ;
- render(): CheerioWrapper ;
unmount(): ShallowWrapper extends CommonWrapper {
* @param selector The selector to match.
*/
find extends CommonWrapper {
* @param selector The selector to match.
*/
filter extends CommonWrapper {
* Finds every node in the render tree that returns true for the provided predicate function.
* @param predicate
*/
- findWhere(predicate: (wrapper: CommonWrapper extends CommonWrapper {
* @param [selector]
*/
children extends CommonWrapper {
childAt extends CommonWrapper {
* @param [selector]
*/
parents extends CommonWrapper {
* @param selector
*/
closest extends CommonWrapper {
* Returns a wrapper with the direct parent of the node in the current wrapper.
*/
parent(): ShallowWrapper extends CommonWrapper {
unmount(): ReactWrapper ;
/**
* Returns a wrapper of the node that matches the provided reference name.
@@ -503,7 +445,7 @@ export interface ReactWrapper extends CommonWrapper {
* @param selector The selector to match.
*/
find, callback?: () => void): this;
/**
* A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test
@@ -274,7 +215,7 @@ interface CommonWrapper