From 16e355bb06df6f48a7e81427830200708ea610c5 Mon Sep 17 00:00:00 2001 From: LB Date: Wed, 23 Oct 2024 13:27:41 +1000 Subject: [PATCH] [feature] Add `labelComponents` glob checks in `label-has-associated-control` Add ability for `labelComponents` within the `label-has-associated-control` to use the same glob checking mechanism as `controlComponents`. - Ensure existing tests pass and update unit tests for new behaviour - Add extra tests for documented `???Foo` syntax for component glob matching - Update documentation to have appropriate examples for label/control glob usage Closes #972 --- __tests__/src/rules/label-has-associated-control-test.js | 5 +++++ docs/rules/label-has-associated-control.md | 4 ++-- src/rules/label-has-associated-control.js | 9 +++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/__tests__/src/rules/label-has-associated-control-test.js b/__tests__/src/rules/label-has-associated-control-test.js index 6db06739..d3e6a464 100644 --- a/__tests__/src/rules/label-has-associated-control-test.js +++ b/__tests__/src/rules/label-has-associated-control-test.js @@ -61,6 +61,8 @@ const htmlForValid = [ { code: '', options: [{ labelComponents: ['CustomLabel'] }] }, { code: '', options: [{ labelAttributes: ['label'], labelComponents: ['CustomLabel'] }] }, { code: '', settings: componentsSettings }, + { code: '', options: [{ labelComponents: ['*Label'] }] }, + { code: '', options: [{ labelAttributes: ['label'], labelComponents: ['Label*'] }] }, // Custom label attributes. { code: '