Procházet zdrojové kódy

test and minor fix on mapping row

Peter Holmberg před 7 roky
rodič
revize
58094faa12

+ 26 - 0
packages/grafana-ui/src/components/FormGroup/FormGroup.test.tsx

@@ -0,0 +1,26 @@
+import React from 'react';
+import { shallow } from 'enzyme';
+import { FormGroup, Props } from './FormGroup';
+
+const setup = (propOverrides?: object) => {
+  const props: Props = {
+    label: 'Test',
+    labelWidth: 11,
+    inputProps: {
+      value: 10,
+      onChange: jest.fn(),
+    },
+  };
+
+  Object.assign(props, propOverrides);
+
+  return shallow(<FormGroup {...props} />);
+};
+
+describe('Render', () => {
+  it('should render component', () => {
+    const wrapper = setup();
+
+    expect(wrapper).toMatchSnapshot();
+  });
+});

+ 19 - 0
packages/grafana-ui/src/components/FormGroup/__snapshots__/FormGroup.test.tsx.snap

@@ -0,0 +1,19 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Render should render component 1`] = `
+<div
+  className="gf-form"
+>
+  <Component
+    width={11}
+  >
+    Test
+  </Component>
+  <input
+    className="gf-form-input width-12"
+    onChange={[MockFunction]}
+    type="text"
+    value={10}
+  />
+</div>
+`;