From 136b36d0967a80dccb7fb634bbc29d2899d2c6ed Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 22 Nov 2016 15:16:23 +0900 Subject: [PATCH] enzyme: Fix errors on element props --- enzyme/enzyme-tests.tsx | 5 +++++ enzyme/index.d.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx index 815131f355..a97c33051e 100644 --- a/enzyme/enzyme-tests.tsx +++ b/enzyme/enzyme-tests.tsx @@ -38,6 +38,7 @@ namespace ShallowWrapperTest { objectVal: Object, boolVal: Boolean, stringVal: String, + numOrStringVal: number | string, elementWrapper: ShallowWrapper, {}> function test_shallow_options() { @@ -306,6 +307,10 @@ namespace ShallowWrapperTest { function test_isEmptyRender() { boolVal = shallowWrapper.isEmptyRender(); } + + function test_svg() { + numOrStringVal = shallowWrapper.find('svg').props().strokeWidth; + } } diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts index d531d12f03..63907a5c58 100644 --- a/enzyme/index.d.ts +++ b/enzyme/index.d.ts @@ -3,9 +3,9 @@ // Definitions by: Marian Palkus , Cap3 , Ivo Stratev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { ReactElement, Component, StatelessComponent, ComponentClass, HTMLAttributes as ReactHTMLAttributes } from "react"; +import { ReactElement, Component, StatelessComponent, ComponentClass, HTMLAttributes as ReactHTMLAttributes, SVGAttributes as ReactSVGAttributes } from "react"; -type HTMLAttributes = ReactHTMLAttributes<{}>; +type HTMLAttributes = ReactHTMLAttributes<{}> & ReactSVGAttributes<{}>; export class ElementClass extends Component { }