@@ -4,6 +4,7 @@ import * as td from 'testdouble';
44import { mount , shallow , ReactWrapper } from 'enzyme' ;
55import { Radio , NativeRadioControl , RadioProps } from '../../../packages/radio/index' ;
66import { coerceForTesting } from '../helpers/types' ;
7+ import { MDCRadioFoundation } from '@material/radio' ;
78
89const NativeControlUpdate : React . FunctionComponent < React . HTMLProps < HTMLInputElement > > = ( {
910 disabled, id, // eslint-disable-line react/prop-types
@@ -83,13 +84,13 @@ test('initializes foundation', () => {
8384} ) ;
8485
8586test ( 'calls foundation.setDisabled if child.props.disabled is true' , ( ) => {
86- const setDisabled = td . func ( ) ;
87+ const setDisabled = td . func < ( disabled : boolean ) => void > ( ) ;
8788 const wrapper = mount < Radio > (
8889 < Radio >
8990 < NativeRadioControl disabled />
9091 </ Radio >
9192 ) ;
92- wrapper . instance ( ) . foundation = { init : ( ) => { } , setDisabled} ;
93+ wrapper . instance ( ) . foundation = { init : ( ) => { } , setDisabled} as MDCRadioFoundation ;
9394 wrapper . instance ( ) . componentDidMount ( ) ;
9495 td . verify ( setDisabled ( true ) , { times : 1 } ) ;
9596} ) ;
@@ -134,7 +135,7 @@ test('renders label with for attribute tied to native control id', () => {
134135test ( 'calls foundation.setDisabled if children.props.disabled updates' , ( ) => {
135136 const wrapper = mount ( < NativeControlUpdate /> ) ;
136137 coerceForTesting < ReactWrapper < RadioProps , { } , Radio > > (
137- wrapper . children ( ) ) . instance ( ) . foundation . setDisabled = td . func ( ) ;
138+ wrapper . children ( ) ) . instance ( ) . foundation . setDisabled = td . func < ( disabled : boolean ) => null > ( ) ;
138139 wrapper . setProps ( { disabled : true } ) ;
139140 td . verify (
140141 coerceForTesting < ReactWrapper < RadioProps , { } , Radio > > ( wrapper . children ( ) )
@@ -147,7 +148,7 @@ test('calls foundation.setDisabled if children.props.disabled updates', () => {
147148test ( 'calls foundation.setDisabled if children.props.disabled updates to false' , ( ) => {
148149 const wrapper = mount ( < NativeControlUpdate disabled /> ) ;
149150 coerceForTesting < ReactWrapper < RadioProps , { } , Radio > > (
150- wrapper . children ( ) ) . instance ( ) . foundation . setDisabled = td . func ( ) ;
151+ wrapper . children ( ) ) . instance ( ) . foundation . setDisabled = td . func < ( disabled : boolean ) => null > ( ) ;
151152 wrapper . setProps ( { disabled : false } ) ;
152153 td . verify (
153154 coerceForTesting < ReactWrapper < RadioProps , { } , Radio > > ( wrapper . children ( ) )
@@ -234,7 +235,7 @@ test('#componentWillUnmount destroys foundation', () => {
234235 </ Radio >
235236 ) ;
236237 const foundation = wrapper . instance ( ) . foundation ;
237- foundation . destroy = td . func ( ) ;
238+ foundation . destroy = td . func < ( ) => void > ( ) ;
238239 wrapper . unmount ( ) ;
239240 td . verify ( foundation . destroy ( ) , { times : 1 } ) ;
240241} ) ;
0 commit comments