@@ -1625,10 +1625,15 @@ describe('Reactable', function() {
16251625 describe ( 'filtering' , function ( ) {
16261626 describe ( 'filtering with javascript objects for data' , function ( ) {
16271627 var data = [ { name :"Lee SomeoneElse" , age :18 } , { name :"Lee Salminen" , age :23 } , { name :"No Age" , age :null } ]
1628+ var filterBy
1629+ var onFilter = function ( filter ) {
1630+ filterBy = filter
1631+ }
16281632 before ( function ( ) {
16291633 ReactDOM . render (
16301634 < Reactable . Table className = "table" id = "table"
1631- filterable = { [ 'Name' , 'Age' ] } >
1635+ filterable = { [ 'Name' , 'Age' ] }
1636+ onFilter = { onFilter } >
16321637 < Reactable . Tr >
16331638 < Reactable . Td column = "Name" data = { data [ 0 ] . name } />
16341639 < Reactable . Td column = "Age" data = { data [ 0 ] . age } />
@@ -1657,6 +1662,15 @@ describe('Reactable', function() {
16571662 ReactableTestUtils . expectRowText ( 0 , [ 'Lee SomeoneElse' , '18' ] ) ;
16581663 ReactableTestUtils . expectRowText ( 1 , [ 'Lee Salminen' , '23' ] ) ;
16591664 } ) ;
1665+ it ( 'calls onFilter event handler' , function ( ) {
1666+ var $filter = $ ( '#table thead tr.reactable-filterer input.reactable-filter-input' ) ;
1667+ var textToSearch = 'lee'
1668+
1669+ $filter . val ( textToSearch ) ;
1670+ React . addons . TestUtils . Simulate . keyUp ( $filter [ 0 ] ) ;
1671+
1672+ expect ( filterBy ) . to . equal ( textToSearch ) ;
1673+ } ) ;
16601674 } ) ;
16611675
16621676 describe ( 'basic case-insensitive filtering' , function ( ) {
0 commit comments