Skip to content

Commit 7138b68

Browse files
committed
fix test cases
1 parent e6e7d6f commit 7138b68

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

packages/react-bootstrap-table2/test/header-cell.test.js

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('HeaderCell', () => {
148148
it('should call custom headerFormatter correctly', () => {
149149
expect(formatter.callCount).toBe(1);
150150
expect(formatter.calledWith(
151-
column, index, { sortElement: undefined })).toBe(true);
151+
column, index, { sortElement: undefined, filterElement: undefined })).toBe(true);
152152
});
153153
});
154154

@@ -729,7 +729,13 @@ describe('HeaderCell', () => {
729729
}
730730
};
731731
wrapper = shallow(
732-
<HeaderCell column={ column } index={ index } onFilter={ onFilter } currFilters={ {} } />
732+
<HeaderCell
733+
column={ column }
734+
index={ index }
735+
onFilter={ onFilter }
736+
currFilters={ {} }
737+
filterPosition="inline"
738+
/>
733739
);
734740
});
735741

@@ -738,14 +744,14 @@ describe('HeaderCell', () => {
738744
expect(wrapper.find('th').length).toBe(1);
739745
});
740746

741-
// it('should render filter correctly', () => {
742-
// expect(wrapper.find(Filter).length).toBe(1);
743-
// expect(wrapper.find(Filter).props()).toEqual({
744-
// column,
745-
// onFilter,
746-
// ...filterProps
747-
// });
748-
// });
747+
it('should render filter correctly', () => {
748+
expect(wrapper.find(Filter).length).toBe(1);
749+
expect(wrapper.find(Filter).props()).toEqual({
750+
column,
751+
onFilter,
752+
...filterProps
753+
});
754+
});
749755
});
750756

751757
describe('when column.filter and column.filterRenderer is defined', () => {
@@ -767,20 +773,25 @@ describe('HeaderCell', () => {
767773
filterRenderer
768774
};
769775
wrapper = shallow(
770-
<HeaderCell column={ column } index={ index } onExternalFilter={ onExternalFilter } />);
776+
<HeaderCell
777+
column={ column }
778+
index={ index }
779+
filterPosition="inline"
780+
onExternalFilter={ onExternalFilter }
781+
/>);
771782
});
772783

773784
it('should render successfully', () => {
774785
expect(wrapper.length).toBe(1);
775786
expect(wrapper.find('th').length).toBe(1);
776787
});
777788

778-
// it('should render filter correctly', () => {
779-
// expect(wrapper.find(Filter).length).toBe(1);
780-
// });
781-
//
782-
// it('should call filterRenderer function correctly', () => {
783-
// expect(filterRenderer).toHaveBeenCalledTimes(1);
784-
// });
789+
it('should render filter correctly', () => {
790+
expect(wrapper.find(Filter).length).toBe(1);
791+
});
792+
793+
it('should call filterRenderer function correctly', () => {
794+
expect(filterRenderer).toHaveBeenCalledTimes(1);
795+
});
785796
});
786797
});

0 commit comments

Comments
 (0)