mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-05-03 02:03:00 +03:00
Moved DateInput from common to utils
This commit is contained in:
parent
756e0c637e
commit
cccf57a35a
6 changed files with 9 additions and 9 deletions
test/utils
41
test/utils/DateInput.test.js
Normal file
41
test/utils/DateInput.test.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
|
||||
import moment from 'moment';
|
||||
import DateInput from '../../src/utils/DateInput';
|
||||
|
||||
describe('<DateInput />', () => {
|
||||
let wrapped;
|
||||
|
||||
const createComponent = (props = {}) => {
|
||||
wrapped = shallow(<DateInput {...props} />);
|
||||
|
||||
return wrapped;
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
if (wrapped !== undefined) {
|
||||
wrapped.unmount();
|
||||
wrapped = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
it('wrapps a DatePicker', () => {
|
||||
wrapped = createComponent();
|
||||
});
|
||||
|
||||
it('shows calendar icon when input is not clearable', () => {
|
||||
wrapped = createComponent({ isClearable: false });
|
||||
expect(wrapped.find(FontAwesomeIcon)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('shows calendar icon when input is clearable but selected value is nil', () => {
|
||||
wrapped = createComponent({ isClearable: true, selected: null });
|
||||
expect(wrapped.find(FontAwesomeIcon)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('does not show calendar icon when input is clearable', () => {
|
||||
wrapped = createComponent({ isClearable: true, selected: moment() });
|
||||
expect(wrapped.find(FontAwesomeIcon)).toHaveLength(0);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue