diff --git a/spec/pivotal-ui-react/text-filter/text-filter_spec.js b/spec/pivotal-ui-react/text-filter/text-filter_spec.js
index a39947f26..dc0ccb590 100644
--- a/spec/pivotal-ui-react/text-filter/text-filter_spec.js
+++ b/spec/pivotal-ui-react/text-filter/text-filter_spec.js
@@ -2,17 +2,17 @@ import '../spec_helper';
import {TextFilter} from '../../../src/react/text-filter';
describe('TextFilter', () => {
- let data, filter, onFilter;
+ let data, filter, renderFilteredData;
beforeEach(() => {
data = ['apple', 'banana', 'actuator'];
filter = jasmine.createSpy('filter').and.returnValue(data);
- onFilter = jasmine.createSpy('onFilter')
+ renderFilteredData = jasmine.createSpy('renderFilteredData')
.and.returnValue(
{data.map((v, i) => - {v}
)}
);
ReactDOM.render(, root);
});
@@ -43,8 +43,8 @@ describe('TextFilter', () => {
expect('.text-filter > .grid .col:eq(2) .filtered-count').toHaveText(data.length);
});
- it('calls the onFilter callback', () => {
- expect(onFilter).toHaveBeenCalledWith(data);
+ it('calls the renderFilteredData callback', () => {
+ expect(renderFilteredData).toHaveBeenCalledWith(data);
});
it('renders the filtered object', () => {
@@ -60,7 +60,7 @@ describe('TextFilter', () => {
beforeEach(() => {
filtered = ['apple', 'actuator'];
filter.and.returnValue(filtered);
- onFilter.and.returnValue({filtered.map((v, i) => - {v}
)}
);
+ renderFilteredData.and.returnValue({filtered.map((v, i) => - {v}
)}
);
$('input').val('a').simulate('change');
});
@@ -77,8 +77,8 @@ describe('TextFilter', () => {
expect('.text-filter > .grid .col:eq(2)').toHaveText(`${filtered.length} / ${data.length}`);
});
- it('calls the onFilter callback', () => {
- expect(onFilter).toHaveBeenCalledWith(filtered);
+ it('calls the renderFilteredData callback', () => {
+ expect(renderFilteredData).toHaveBeenCalledWith(filtered);
});
it('renders the filtered object', () => {
diff --git a/src/react/text-filter/text-filter.js b/src/react/text-filter/text-filter.js
index 52e4253f9..48ba8c179 100644
--- a/src/react/text-filter/text-filter.js
+++ b/src/react/text-filter/text-filter.js
@@ -8,13 +8,13 @@ export class TextFilter extends React.Component {
static propTypes = {
data: PropTypes.array.isRequired,
filter: PropTypes.func.isRequired,
- onFilter: PropTypes.func.isRequired
+ renderFilteredData: PropTypes.func.isRequired
};
static defaultProps = {
data: [],
filter: data => data,
- onFilter: () => null
+ renderFilteredData: () => null
};
constructor(props) {
@@ -29,7 +29,7 @@ export class TextFilter extends React.Component {
}
render() {
- const {data, filter, onFilter, className} = this.props;
+ const {data, filter, renderFilteredData, className} = this.props;
const {filterText} = this.state;
const filteredData = filter(data, filterText);
@@ -47,7 +47,7 @@ export class TextFilter extends React.Component {
/ {data.length}
- {onFilter(filteredData)}
+ {renderFilteredData(filteredData)}
);
}