File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -2580,4 +2580,35 @@ describe('Reactable', function() {
25802580 } ) ;
25812581 } ) ;
25822582 } )
2583+
2584+ describe ( 'receive props with no currentPage' , ( ) => {
2585+ let parent ;
2586+
2587+ before ( function ( ) {
2588+ //create a wrapper component so we can update its state and trigger componentWillReceiveProps in the table
2589+ var TestParent = React . createFactory ( React . createClass ( {
2590+ render ( ) {
2591+ return ( < Reactable . Table className = "table" id = "table" ref = "table" >
2592+ < Reactable . Tr >
2593+ < Reactable . Td column = "Name" >
2594+ < b > Griffin Smith</ b >
2595+ </ Reactable . Td >
2596+ </ Reactable . Tr >
2597+ </ Reactable . Table > ) ;
2598+ }
2599+ } ) ) ;
2600+
2601+ parent = ReactDOM . render ( TestParent ( ) , ReactableTestUtils . testNode ( ) ) ;
2602+ } ) ;
2603+
2604+ after ( ReactableTestUtils . resetTestEnvironment ) ;
2605+
2606+ it ( 'keeps the same currentPage and does not set it to undefined' , function ( ) {
2607+ const preUpdateCurrentPage = parent . refs . table . state . currentPage ;
2608+ parent . setState ( { testState : "this state update will trigger componentWillReceiveProps in the Reactable.Table" } ) ;
2609+ const postUpdateCurrentPage = parent . refs . table . state . currentPage ;
2610+ expect ( postUpdateCurrentPage ) . to . not . eq ( undefined ) ;
2611+ expect ( postUpdateCurrentPage ) . to . eq ( preUpdateCurrentPage ) ;
2612+ } ) ;
2613+ } ) ;
25832614} ) ;
You can’t perform that action at this time.
0 commit comments