fixes for bugs in #3689 (#3692)

This commit is contained in:
Jeff Niu
2017-10-24 14:58:15 -07:00
committed by Maxime Beauchemin
parent 1d06495629
commit efae14592e
4 changed files with 179 additions and 19 deletions

View File

@@ -88,4 +88,28 @@ describe('Filter', () => {
const regexWrapper = shallow(<Filter {...props} />);
expect(regexWrapper.find('input')).to.have.lengthOf(1);
});
it('renders `input` for text filters', () => {
const props = Object.assign({}, defaultProps);
['>=', '>', '<=', '<'].forEach((op) => {
props.filter = {
col: 'col1',
op,
value: 'val',
};
wrapper = shallow(<Filter {...props} />);
expect(wrapper.find('input')).to.have.lengthOf(1);
});
});
it('replaces null filter values with empty string in `input`', () => {
const props = Object.assign({}, defaultProps);
props.filter = {
col: 'col1',
op: '>=',
value: null,
};
wrapper = shallow(<Filter {...props} />);
expect(wrapper.find('input').props().value).to.equal('');
});
});