diff --git a/.eslintignore b/.eslintignore
index eeb9dac6..aae58789 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -4,3 +4,4 @@ dist
myparcel_js_sdk
node_modules
public
+**/*.snap
diff --git a/tests/unit/sandbox/__snapshots__/formComponents.spec.js.snap b/tests/unit/sandbox/__snapshots__/formComponents.spec.js.snap
new file mode 100644
index 00000000..46be783c
--- /dev/null
+++ b/tests/unit/sandbox/__snapshots__/formComponents.spec.js.snap
@@ -0,0 +1,175 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Sandbox form components @/sandbox/components/form/CCheckboxGroup 1`] = `
+
+`;
+
+exports[`Sandbox form components @/sandbox/components/form/CNumber 1`] = `
+
+ step="1"
+ type="number"
+/>
+`;
+
+exports[`Sandbox form components @/sandbox/components/form/CRadioGroup 1`] = `
+
+`;
+
+exports[`Sandbox form components @/sandbox/components/form/CSelect 1`] = `
+
+`;
+
+exports[`Sandbox form components @/sandbox/components/form/CTextInput 1`] = `
+
+ type="text"
+/>
+`;
+
+exports[`Sandbox form components @/sandbox/components/form/CTextarea 1`] = `
+
+`;
+
+exports[`Sandbox form components @/sandbox/components/form/CTimepicker 1`] = `
+
+`;
+
+exports[`Sandbox form components @/sandbox/components/form/CToggle 1`] = `
+
+
+
+
+`;
diff --git a/tests/unit/sandbox/formComponents.spec.js b/tests/unit/sandbox/formComponents.spec.js
index 94a8c80c..e7c6da61 100644
--- a/tests/unit/sandbox/formComponents.spec.js
+++ b/tests/unit/sandbox/formComponents.spec.js
@@ -1,17 +1,15 @@
import { mockSandbox, shallowMockSandbox } from './mockSandbox';
-import CCheckboxGroup from '@/sandbox/components/form/CCheckboxGroup';
import CCodeEditor from '@/sandbox/components/form/CCodeEditor';
import CCountrySelect from '@/sandbox/components/form/CCountrySelect';
import CCurrency from '@/sandbox/components/form/CCurrency';
-import CNumber from '@/sandbox/components/form/CNumber';
-import CRadioGroup from '@/sandbox/components/form/CRadioGroup';
-import CSelect from '@/sandbox/components/form/CSelect';
-import CTextInput from '@/sandbox/components/form/CTextInput';
-import CTextarea from '@/sandbox/components/form/CTextarea';
-import CTimepicker from '@/sandbox/components/form/CTimepicker';
-import CToggle from '@/sandbox/components/form/CToggle';
import { i18n } from '@/sandbox/services/vue-i18n';
+// Test options.
+const options = [
+ { text: 'Option A', value: 'a' },
+ { text: 'Option B', value: 'b' },
+];
+
describe('Sandbox form components', () => {
test('CCodeEditor', async() => {
expect.assertions(9);
@@ -82,111 +80,20 @@ describe('Sandbox form components', () => {
expect(wrapper.find('input').element).toHaveValue(2.36);
});
- /**
- * Simple test for components without complex logic.
- */
- test('Other components', () => {
- const wrapper = mockSandbox(null, null, {
- template: `
-
-
-
-
-
-
-
-
-
-
- `,
- components: {
- CCheckboxGroup,
- CNumber,
- CRadioGroup,
- CSelect,
- CTextInput,
- CTextarea,
- CTimepicker,
- CToggle,
- },
- });
+ test.each([
+ ['@/sandbox/components/form/CCheckboxGroup', { options }],
+ ['@/sandbox/components/form/CNumber'],
+ ['@/sandbox/components/form/CRadioGroup', { options }],
+ ['@/sandbox/components/form/CSelect', { options }],
+ ['@/sandbox/components/form/CTextInput'],
+ ['@/sandbox/components/form/CTextarea'],
+ ['@/sandbox/components/form/CTimepicker'],
+ ['@/sandbox/components/form/CToggle'],
+ ])('%s', async(componentPath, propsData = {}) => {
+ expect.assertions(1);
+ const component = (await import(componentPath)).default;
+ const wrapper = mockSandbox(null, { propsData }, component);
- expect(wrapper.vm.$el).toMatchInlineSnapshot(`
-
-
-
-
- step="1"
- type="number"
- />
-
-
-
-
-
-
- type="text"
- />
-
-
-
-
-
-
-
-
-
-
- `);
+ expect(wrapper.vm.$el).toMatchSnapshot();
});
});