diff --git a/__mocks__/JSXFragmentMock.js b/__mocks__/JSXFragmentMock.js new file mode 100644 index 00000000..d126d5d1 --- /dev/null +++ b/__mocks__/JSXFragmentMock.js @@ -0,0 +1,17 @@ +/** + * @flow + */ + +export type JSXFragmentMockType = { + type: 'JSXFragment', + children: Array, +}; + +export default function JSXFragmentMock( + children?: Array = [], +): JSXFragmentMockType { + return { + type: 'JSXFragment', + children, + }; +} diff --git a/__tests__/src/rules/label-has-associated-control-test.js b/__tests__/src/rules/label-has-associated-control-test.js index 01d02e06..ad82c424 100644 --- a/__tests__/src/rules/label-has-associated-control-test.js +++ b/__tests__/src/rules/label-has-associated-control-test.js @@ -27,6 +27,7 @@ const errorMessages = { nesting: 'A form label must have an associated control as a descendant.', either: 'A form label must either have a valid htmlFor attribute or a control as a descendant.', both: 'A form label must have a valid htmlFor attribute and a control as a descendant.', + htmlForShouldMatchId: 'A form label must have a htmlFor attribute that matches the id of the associated control.', }; const expectedErrors = {}; Object.keys(errorMessages).forEach((key) => { @@ -58,6 +59,7 @@ const htmlForValid = [ { code: '