diff --git a/src/components/form/checkbox/__snapshots__/checkbox.test.js.snap b/src/components/form/checkbox/__snapshots__/checkbox.test.js.snap
index f0d62804b81..05f6257c3a1 100644
--- a/src/components/form/checkbox/__snapshots__/checkbox.test.js.snap
+++ b/src/components/form/checkbox/__snapshots__/checkbox.test.js.snap
@@ -20,3 +20,89 @@ exports[`EuiCheckbox is rendered 1`] = `
`;
+
+exports[`EuiCheckbox props check is rendered 1`] = `
+
+`;
+
+exports[`EuiCheckbox props disabled disabled is rendered 1`] = `
+
+`;
+
+exports[`EuiCheckbox props label is rendered 1`] = `
+
+`;
+
+exports[`EuiCheckbox props type inList is rendered 1`] = `
+
+`;
diff --git a/src/components/form/checkbox/__snapshots__/checkbox_group.test.js.snap b/src/components/form/checkbox/__snapshots__/checkbox_group.test.js.snap
index 0453538b7f0..1270cd98c95 100644
--- a/src/components/form/checkbox/__snapshots__/checkbox_group.test.js.snap
+++ b/src/components/form/checkbox/__snapshots__/checkbox_group.test.js.snap
@@ -1,9 +1,58 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`EuiCheckboxGroup is rendered 1`] = `
+exports[`EuiCheckboxGroup (mocked checkbox) disabled is rendered 1`] = `
+
+
+
+
+`;
+
+exports[`EuiCheckboxGroup (mocked checkbox) idToSelectedMap is rendered 1`] = `
+
+
+
+
+`;
+
+exports[`EuiCheckboxGroup (mocked checkbox) is rendered 1`] = `
`;
+
+exports[`EuiCheckboxGroup (mocked checkbox) options are rendered 1`] = `
+
+
+
+
+`;
diff --git a/src/components/form/checkbox/checkbox.test.js b/src/components/form/checkbox/checkbox.test.js
index ed1e433d212..6787e34dc9b 100644
--- a/src/components/form/checkbox/checkbox.test.js
+++ b/src/components/form/checkbox/checkbox.test.js
@@ -1,16 +1,103 @@
import React from 'react';
import { render } from 'enzyme';
-import { requiredProps } from '../../../test/required_props';
+import {
+ requiredProps,
+ startThrowingReactWarnings,
+ stopThrowingReactWarnings,
+} from '../../../test';
-import { EuiCheckbox } from './checkbox';
+import {
+ EuiCheckbox,
+ TYPES,
+} from './checkbox';
+
+beforeAll(startThrowingReactWarnings);
+afterAll(stopThrowingReactWarnings);
+
+const checkboxRequiredProps = {
+ id: 'id',
+ onChange: () => {},
+};
describe('EuiCheckbox', () => {
test('is rendered', () => {
const component = render(
- {}} {...requiredProps} />
+ {}}
+ {...requiredProps}
+ />
);
expect(component)
.toMatchSnapshot();
});
+
+ describe('props', () => {
+ test('id is required', () => {
+ expect(
+ () => {}}/>
+ ).toThrow();
+ });
+
+ test('onChange is required', () => {
+ expect(
+ () =>
+ ).toThrow();
+ });
+
+ test('check is rendered', () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test('label is rendered', () => {
+ const component = render(
+ Label}
+ />
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ describe('type', () => {
+ TYPES.forEach(value => {
+ test(`${value} is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
+ });
+
+ describe('disabled', () => {
+ test(`disabled is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
+ });
});
diff --git a/src/components/form/checkbox/checkbox_group.behavior.test.js b/src/components/form/checkbox/checkbox_group.behavior.test.js
new file mode 100644
index 00000000000..38aaeea080f
--- /dev/null
+++ b/src/components/form/checkbox/checkbox_group.behavior.test.js
@@ -0,0 +1,28 @@
+import React from 'react';
+import { mount } from 'enzyme';
+import sinon from 'sinon';
+
+import { EuiCheckboxGroup } from './checkbox_group';
+
+// This exists because we need to run the following tests
+// without mocking the Checkbox component, such as testing
+// an interaction that is handled by the Checkbox component.
+describe('EuiCheckboxGroup behavior', () => {
+ test('id is bound to onChange', () => {
+ const onChangeHandler = sinon.stub();
+ const component = mount(
+
+ );
+
+ component.find('input[type="checkbox"]').simulate('change');
+ sinon.assert.calledWith(onChangeHandler, '1');
+ });
+});
diff --git a/src/components/form/checkbox/checkbox_group.test.js b/src/components/form/checkbox/checkbox_group.test.js
index c00a38b780d..6d47be307bb 100644
--- a/src/components/form/checkbox/checkbox_group.test.js
+++ b/src/components/form/checkbox/checkbox_group.test.js
@@ -4,7 +4,9 @@ import { requiredProps } from '../../../test/required_props';
import { EuiCheckboxGroup } from './checkbox_group';
-describe('EuiCheckboxGroup', () => {
+jest.mock('./checkbox', () => ({ EuiCheckbox: 'eui_checkbox' }));
+
+describe('EuiCheckboxGroup (mocked checkbox)', () => {
test('is rendered', () => {
const component = render(
{}} {...requiredProps} />
@@ -13,4 +15,58 @@ describe('EuiCheckboxGroup', () => {
expect(component)
.toMatchSnapshot();
});
+
+ test('options are rendered', () => {
+ const component = render(
+ {}}
+ />
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test('idToSelectedMap is rendered', () => {
+ const component = render(
+ {}}
+ />
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test('disabled is rendered', () => {
+ const component = render(
+ {}}
+ disabled
+ />
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
});
diff --git a/src/components/form/field_number/__snapshots__/field_number.test.js.snap b/src/components/form/field_number/__snapshots__/field_number.test.js.snap
index 87f0196b7f1..85337149ed3 100644
--- a/src/components/form/field_number/__snapshots__/field_number.test.js.snap
+++ b/src/components/form/field_number/__snapshots__/field_number.test.js.snap
@@ -1,14 +1,68 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EuiFieldNumber is rendered 1`] = `
-
-
-
+
+
+
+
+
+`;
+
+exports[`EuiFieldNumber props fullWidth is rendered 1`] = `
+
+
+
+
+
+`;
+
+exports[`EuiFieldNumber props isInvalid is rendered 1`] = `
+
+
+
+
+
+`;
+
+exports[`EuiFieldNumber props isLoading is rendered 1`] = `
+
+
+
+
+
`;
diff --git a/src/components/form/field_number/field_number.test.js b/src/components/form/field_number/field_number.test.js
index 7ac53adfd1a..a04f63ffabd 100644
--- a/src/components/form/field_number/field_number.test.js
+++ b/src/components/form/field_number/field_number.test.js
@@ -4,13 +4,61 @@ import { requiredProps } from '../../../test/required_props';
import { EuiFieldNumber } from './field_number';
+jest.mock('../form_control_layout', () => ({ EuiFormControlLayout: 'eui-form-control-layout' }));
+jest.mock('../validatable_control', () => ({ EuiValidatableControl: 'eui-validatable-control' }));
+
describe('EuiFieldNumber', () => {
test('is rendered', () => {
const component = render(
-
+ {}}
+ {...requiredProps}
+ />
);
expect(component)
.toMatchSnapshot();
});
+
+ describe('props', () => {
+ test(`isInvalid is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test(`fullWidth is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test(`isLoading is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
});
diff --git a/src/components/form/field_password/__snapshots__/field_password.test.js.snap b/src/components/form/field_password/__snapshots__/field_password.test.js.snap
index 9ed50b52ebe..c5b96967abe 100644
--- a/src/components/form/field_password/__snapshots__/field_password.test.js.snap
+++ b/src/components/form/field_password/__snapshots__/field_password.test.js.snap
@@ -1,33 +1,69 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EuiFieldPassword is rendered 1`] = `
-
+
+
`;
diff --git a/src/components/form/field_password/field_password.test.js b/src/components/form/field_password/field_password.test.js
index 945edb3714b..6b48a2af52d 100644
--- a/src/components/form/field_password/field_password.test.js
+++ b/src/components/form/field_password/field_password.test.js
@@ -4,13 +4,58 @@ import { requiredProps } from '../../../test/required_props';
import { EuiFieldPassword } from './field_password';
+jest.mock('../form_control_layout', () => ({ EuiFormControlLayout: 'eui-form-control-layout' }));
+jest.mock('../validatable_control', () => ({ EuiValidatableControl: 'eui-validatable-control' }));
+
describe('EuiFieldPassword', () => {
test('is rendered', () => {
const component = render(
-
+ {}}
+ {...requiredProps}
+ />
);
expect(component)
.toMatchSnapshot();
});
+
+ describe('props', () => {
+ test(`isInvalid is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test(`fullWidth is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test(`isLoading is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
});
diff --git a/src/components/form/field_search/__snapshots__/field_search.test.js.snap b/src/components/form/field_search/__snapshots__/field_search.test.js.snap
index 218a04bb91d..33abb3ed725 100644
--- a/src/components/form/field_search/__snapshots__/field_search.test.js.snap
+++ b/src/components/form/field_search/__snapshots__/field_search.test.js.snap
@@ -1,32 +1,69 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EuiFieldSearch is rendered 1`] = `
-
+
+
`;
diff --git a/src/components/form/field_search/field_search.test.js b/src/components/form/field_search/field_search.test.js
index f9f9c19f39b..57e32f3b321 100644
--- a/src/components/form/field_search/field_search.test.js
+++ b/src/components/form/field_search/field_search.test.js
@@ -4,13 +4,58 @@ import { requiredProps } from '../../../test/required_props';
import { EuiFieldSearch } from './field_search';
+jest.mock('../form_control_layout', () => ({ EuiFormControlLayout: 'eui-form-control-layout' }));
+jest.mock('../validatable_control', () => ({ EuiValidatableControl: 'eui-validatable-control' }));
+
describe('EuiFieldSearch', () => {
test('is rendered', () => {
const component = render(
-
+ {}}
+ {...requiredProps}
+ />
);
expect(component)
.toMatchSnapshot();
});
+
+ describe('props', () => {
+ test(`isInvalid is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test(`fullWidth is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test(`isLoading is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
});
diff --git a/src/components/form/field_text/__snapshots__/field_text.test.js.snap b/src/components/form/field_text/__snapshots__/field_text.test.js.snap
index 522109273e7..ae3364c5838 100644
--- a/src/components/form/field_text/__snapshots__/field_text.test.js.snap
+++ b/src/components/form/field_text/__snapshots__/field_text.test.js.snap
@@ -1,14 +1,66 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EuiFieldText is rendered 1`] = `
-
-
-
+
+
+
+
+
+`;
+
+exports[`EuiFieldText props fullWidth is rendered 1`] = `
+
+
+
+
+
+`;
+
+exports[`EuiFieldText props isInvalid is rendered 1`] = `
+
+
+
+
+
+`;
+
+exports[`EuiFieldText props isLoading is rendered 1`] = `
+
+
+
+
+
`;
diff --git a/src/components/form/field_text/field_text.test.js b/src/components/form/field_text/field_text.test.js
index d97ccf2f76f..d0b7367c851 100644
--- a/src/components/form/field_text/field_text.test.js
+++ b/src/components/form/field_text/field_text.test.js
@@ -4,13 +4,61 @@ import { requiredProps } from '../../../test/required_props';
import { EuiFieldText } from './field_text';
+jest.mock('../form_control_layout', () => ({ EuiFormControlLayout: 'eui-form-control-layout' }));
+jest.mock('../validatable_control', () => ({ EuiValidatableControl: 'eui-validatable-control' }));
+
describe('EuiFieldText', () => {
test('is rendered', () => {
const component = render(
-
+ {}}
+ onChange={() => {}}
+ {...requiredProps}
+ />
);
expect(component)
.toMatchSnapshot();
});
+
+ describe('props', () => {
+ test(`isInvalid is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test(`fullWidth is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ test(`isLoading is rendered`, () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
});
+