File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,15 +19,15 @@ const copyProps = (src, target) => {
1919 . filter ( prop => typeof target [ prop ] === 'undefined' )
2020 . reduce ( ( result , prop ) => ( {
2121 ...result ,
22- [ prop ] : Object . getOwnPropertyDescriptor ( src , prop )
22+ [ prop ] : Object . getOwnPropertyDescriptor ( src , prop ) ,
2323 } ) , { } ) ;
2424 Object . defineProperties ( target , props ) ;
2525} ;
2626
2727global . window = window ;
2828global . document = window . document ;
2929global . navigator = {
30- userAgent : 'node.js'
30+ userAgent : 'node.js' ,
3131} ;
3232
3333copyProps ( window , global ) ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { mount } from 'enzyme' ;
3+ import sinon from 'sinon' ;
14import { test } from 'tap' ;
25import '../setupTests' ;
6+ import Repeatable from '../src' ;
37
4- test ( 'noop' , ( t ) => {
8+ test ( '<Repeatable />' , ( t ) => {
9+ const wrapper = mount ( (
10+ < Repeatable >
11+ < button type = "button" > </ button >
12+ </ Repeatable >
13+ ) ) ;
14+ t . equal ( wrapper . find ( Repeatable ) . length , 1 , 'should render <Repeatable /> component' ) ;
15+ t . end ( ) ;
16+ } ) ;
17+
18+ test ( 'simulates click event' , ( t ) => {
19+ const onClick = sinon . spy ( ) ;
20+ const wrapper = mount ( < Repeatable onClick = { onClick } /> ) ;
21+ wrapper . find ( Repeatable ) . simulate ( 'click' ) ;
22+ t . ok ( onClick . calledOnce , 'should be called once' ) ;
523 t . end ( ) ;
624} ) ;
You can’t perform that action at this time.
0 commit comments