/* eslint-env mocha, jest */

import getDefault from '../../shared/testUtils';
import NewTaskDialog from '../NewTaskDialog';

const defaultProps = {
  open: false,
  onRequestClose() {},
  onRequestAdd() {},
};
const getActualDialog = getDefault(NewTaskDialog, defaultProps);

it('should render', () => {
  getActualDialog();
});
it('should be a <div />', () => {
  const wrapper = getActualDialog();
  expect(wrapper.is('div.NewTaskDialog')).toBe(true);
});
it('should have a <Dialog />', () => {
  const wrapper = getActualDialog();
  expect(wrapper.find('Dialog').length).toBe(1);
});
it('should react to close request', (done) => {
  const wrapper = getActualDialog({
    onRequestClose() {
      done();
    },
  });
  wrapper.instance().props.onRequestClose();
});
it('should react to add request', (done) => {
  const wrapper = getActualDialog({
    onRequestAdd() {
      done();
    },
  });
  wrapper.instance().props.onRequestAdd();
});

@@ -933,16 +933,2427 @@
 questAdd();%0A%7D);%0A
+%0Ait('should set FlatButton disabled based on state', () =%3E %7B%0A  const wrapper = getActualDialog();%0A  const now = new Date();%0A  wrapper.find('TextField').at(0).props().onChange(%7B target: %7B value: 'a cool task' %7D %7D);%0A  wrapper.find('TextField').at(1).props().onChange(%7B target: %7B value: '10' %7D %7D);%0A  wrapper.find('DatePicker').at(0).props().onChange(null, now);%0A  wrapper.find('DatePicker').at(1).props().onChange(null, now);%0A  expect(wrapper.find('Dialog').prop('actions')%5B0%5D.props.disabled).toBe(false);%0A  expect(wrapper.find('Dialog').prop('actions')%5B1%5D.props.disabled).toBe(false);%0A%7D);%0Ait('should set task TextField value based on state', () =%3E %7B%0A  const wrapper = getActualDialog();%0A  wrapper.find('TextField').at(0).props().onChange(%7B target: %7B value: 'a cool task' %7D %7D);%0A  expect(wrapper.find('TextField').at(0).prop('value')).toBe('a cool task');%0A%7D);%0Ait('should set estimation TextField value based on state', () =%3E %7B%0A  const wrapper = getActualDialog();%0A  wrapper.find('TextField').at(1).props().onChange(%7B target: %7B value: '10' %7D %7D);%0A  expect(wrapper.find('TextField').at(1).prop('value')).toBe('10');%0A%7D);%0Ait('should set estimation TextField errorText based on state', () =%3E %7B%0A  const wrapper = getActualDialog();%0A  wrapper.find('TextField').at(1).props().onChange(%7B target: %7B value: '10a' %7D %7D);%0A  expect(wrapper.find('TextField').at(1).prop('errorText')).not.toBe('');%0A%7D);%0Ait('should set repetition TextField value based on state', () =%3E %7B%0A  const wrapper = getActualDialog();%0A  wrapper.find('TextField').at(2).props().onChange(%7B target: %7B value: '7' %7D %7D);%0A  expect(wrapper.find('TextField').at(2).prop('value')).toBe('7');%0A%7D);%0Ait('should set repetition TextField errorText based on state', () =%3E %7B%0A  const wrapper = getActualDialog();%0A  wrapper.find('TextField').at(2).props().onChange(%7B target: %7B value: '7a' %7D %7D);%0A  expect(wrapper.find('TextField').at(2).prop('errorText')).not.toBe('');%0A%7D);%0Ait('should set estimation DropDownMenu value based on state', () =%3E %7B%0A  const wrapper = getActualDialog();%0A  wrapper.find('DropDownMenu').at(0).props().onChange(null, null, '60');%0A  expect(wrapper.find('DropDownMenu').at(0).prop('value')).toBe('60');%0A%7D);%0Ait('should set repetition DropDownMenu value based on state', () =%3E %7B%0A  const wrapper = getActualDialog();%0A  wrapper.find('DropDownMenu').at(1).props().onChange(null, null, '7');%0A  expect(wrapper.find('DropDownMenu').at(1).prop('value')).toBe('7');%0A%7D);%0A

Add NewTaskDialog state unit tests