File tree 2 files changed +27
-0
lines changed 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 34
34
"lolex" : " ^1.3.2" ,
35
35
"nodeunit" : " ^0.9.1" ,
36
36
"react" : " ^0.14.0-rc1" ,
37
+ "react-addons-pure-render-mixin" : " ^0.14.2" ,
37
38
"react-addons-test-utils" : " ^0.14.0-rc1" ,
38
39
"react-dom" : " ^0.14.0-rc1" ,
39
40
"sinon" : " ^1.17.1" ,
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import TestUtils from 'react-addons-test-utils' ;
3
+ import PureRenderMixin from 'react-addons-pure-render-mixin' ;
4
+ import sinon from 'sinon' ;
3
5
4
6
import Formsy from './..' ;
5
7
import TestInput , { InputFactory } from './utils/TestInput' ;
@@ -537,6 +539,30 @@ export default {
537
539
538
540
test . done ( ) ;
539
541
542
+ } ,
543
+
544
+ 'input should rendered once with PureRenderMixin' : function ( test ) {
545
+
546
+ var renderSpy = sinon . spy ( ) ;
547
+
548
+ const Input = InputFactory ( {
549
+ mixins : [ Formsy . Mixin , PureRenderMixin ] ,
550
+ render ( ) {
551
+ renderSpy ( ) ;
552
+ return < input type = { this . props . type } value = { this . getValue ( ) } onChange = { this . updateValue } /> ;
553
+ }
554
+ } ) ;
555
+
556
+ const form = TestUtils . renderIntoDocument (
557
+ < Formsy . Form >
558
+ < Input name = "foo" value = "foo" />
559
+ </ Formsy . Form >
560
+ ) ;
561
+
562
+ test . equal ( renderSpy . calledOnce , true ) ;
563
+
564
+ test . done ( ) ;
565
+
540
566
}
541
567
542
568
} ;
You can’t perform that action at this time.
0 commit comments