@atlaskit/form 8.9.0 → 8.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/form
2
2
 
3
+ ## 8.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c71b0ac8222`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c71b0ac8222) - Added testId prop to the Field component for better testing.
8
+
9
+ ## 8.9.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`eb179f0c089`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eb179f0c089) - Migrates unit tests from enzyme to RTL.
14
+
3
15
  ## 8.9.0
4
16
 
5
17
  ### Minor Changes
package/dist/cjs/field.js CHANGED
@@ -255,10 +255,12 @@ function Field(props) {
255
255
  id: fieldId
256
256
  });
257
257
  return (0, _react2.jsx)("div", {
258
- css: fieldWrapperStyles
258
+ css: fieldWrapperStyles,
259
+ "data-testid": props.testId
259
260
  }, props.label && (0, _react2.jsx)(_label.default, {
260
261
  htmlFor: fieldId,
261
- id: "".concat(fieldId, "-label")
262
+ id: "".concat(fieldId, "-label"),
263
+ testId: props.testId && "".concat(props.testId, "--label")
262
264
  }, props.label, props.isRequired && (0, _react2.jsx)(_requiredAsterisk.default, null), props.elementAfterLabel), (0, _react2.jsx)(FieldId.Provider, {
263
265
  value: fieldId
264
266
  }, props.children({
package/dist/cjs/label.js CHANGED
@@ -55,13 +55,15 @@ var darkH200Styles = getFieldsetLabelDynamicStyles('dark');
55
55
  var Label = function Label(_ref) {
56
56
  var children = _ref.children,
57
57
  htmlFor = _ref.htmlFor,
58
- id = _ref.id;
58
+ id = _ref.id,
59
+ testId = _ref.testId;
59
60
  var _useGlobalTheme = (0, _components.useGlobalTheme)(),
60
61
  mode = _useGlobalTheme.mode;
61
62
  return (0, _react.jsx)("label", {
62
63
  css: [mode === 'light' ? lightH200Styles : darkH200Styles, labelStyles],
63
64
  id: id,
64
- htmlFor: htmlFor
65
+ htmlFor: htmlFor,
66
+ "data-testid": testId
65
67
  }, children);
66
68
  };
67
69
  var _default = Label;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.9.0",
3
+ "version": "8.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -238,10 +238,12 @@ export default function Field(props) {
238
238
  id: fieldId
239
239
  };
240
240
  return jsx("div", {
241
- css: fieldWrapperStyles
241
+ css: fieldWrapperStyles,
242
+ "data-testid": props.testId
242
243
  }, props.label && jsx(Label, {
243
244
  htmlFor: fieldId,
244
- id: `${fieldId}-label`
245
+ id: `${fieldId}-label`,
246
+ testId: props.testId && `${props.testId}--label`
245
247
  }, props.label, props.isRequired && jsx(RequiredAsterisk, null), props.elementAfterLabel), jsx(FieldId.Provider, {
246
248
  value: fieldId
247
249
  }, props.children({
@@ -47,7 +47,8 @@ const darkH200Styles = getFieldsetLabelDynamicStyles('dark');
47
47
  const Label = ({
48
48
  children,
49
49
  htmlFor,
50
- id
50
+ id,
51
+ testId
51
52
  }) => {
52
53
  const {
53
54
  mode
@@ -55,7 +56,8 @@ const Label = ({
55
56
  return jsx("label", {
56
57
  css: [mode === 'light' ? lightH200Styles : darkH200Styles, labelStyles],
57
58
  id: id,
58
- htmlFor: htmlFor
59
+ htmlFor: htmlFor,
60
+ "data-testid": testId
59
61
  }, children);
60
62
  };
61
63
  export default Label;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.9.0",
3
+ "version": "8.10.0",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/field.js CHANGED
@@ -247,10 +247,12 @@ export default function Field(props) {
247
247
  id: fieldId
248
248
  });
249
249
  return jsx("div", {
250
- css: fieldWrapperStyles
250
+ css: fieldWrapperStyles,
251
+ "data-testid": props.testId
251
252
  }, props.label && jsx(Label, {
252
253
  htmlFor: fieldId,
253
- id: "".concat(fieldId, "-label")
254
+ id: "".concat(fieldId, "-label"),
255
+ testId: props.testId && "".concat(props.testId, "--label")
254
256
  }, props.label, props.isRequired && jsx(RequiredAsterisk, null), props.elementAfterLabel), jsx(FieldId.Provider, {
255
257
  value: fieldId
256
258
  }, props.children({
package/dist/esm/label.js CHANGED
@@ -49,13 +49,15 @@ var darkH200Styles = getFieldsetLabelDynamicStyles('dark');
49
49
  var Label = function Label(_ref) {
50
50
  var children = _ref.children,
51
51
  htmlFor = _ref.htmlFor,
52
- id = _ref.id;
52
+ id = _ref.id,
53
+ testId = _ref.testId;
53
54
  var _useGlobalTheme = useGlobalTheme(),
54
55
  mode = _useGlobalTheme.mode;
55
56
  return jsx("label", {
56
57
  css: [mode === 'light' ? lightH200Styles : darkH200Styles, labelStyles],
57
58
  id: id,
58
- htmlFor: htmlFor
59
+ htmlFor: htmlFor,
60
+ "data-testid": testId
59
61
  }, children);
60
62
  };
61
63
  export default Label;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.9.0",
3
+ "version": "8.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -72,6 +72,10 @@ export interface FieldComponentProps<FieldValue, Element extends SupportedElemen
72
72
  * Checks whether the field input is valid. This is usually used to display a message relevant to the current value using `ErrorMessage`, `HelperMessage` or `ValidMessage`.
73
73
  */
74
74
  validate?: (value: FieldValue | undefined, formState: Object, fieldState: Meta) => string | void | Promise<string | void>;
75
+ /**
76
+ * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
77
+ */
78
+ testId?: string;
75
79
  }
76
80
  /**
77
81
  * __Field id__
@@ -4,6 +4,7 @@ export interface LabelProps {
4
4
  id?: string;
5
5
  htmlFor: string;
6
6
  children: ReactNode;
7
+ testId?: string;
7
8
  }
8
9
  /**
9
10
  * __Label__
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.9.0",
3
+ "version": "8.10.0",
4
4
  "description": "A form allows users to input information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -75,8 +75,8 @@
75
75
  "@atlaskit/webdriver-runner": "*",
76
76
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
77
77
  "@testing-library/react": "^12.1.5",
78
+ "@testing-library/user-event": "^14.4.3",
78
79
  "@types/final-form-focus": "^1.1.1",
79
- "enzyme": "^3.10.0",
80
80
  "react-dom": "^16.8.0",
81
81
  "react-router": "^4.2.0",
82
82
  "react-router-dom": "^4.2.2",