Skip to content

Commit

Permalink
Add select to the list of default control elements in label-has-assoc…
Browse files Browse the repository at this point in the history
…iated-control
  • Loading branch information
jessebeach committed Nov 18, 2018
1 parent c0ca0b8 commit 6c33bcb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions __tests__/src/rules/label-has-associated-control-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const bothValid = [
{ code: '<CustomLabel htmlFor="js_id" label="A label"><input /></CustomLabel>', options: [{ labelAttributes: ['label'], labelComponents: ['CustomLabel'] }] },
// Custom label attributes.
{ code: '<label htmlFor="js_id" label="A label"><input /></label>', options: [{ labelAttributes: ['label'] }] },
{ code: '<label htmlFor="selectInput">Some text<select id="selectInput" /></label>' },
];

const alwaysValid = [
Expand Down
2 changes: 1 addition & 1 deletion src/rules/label-has-associated-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = {
if (componentNames.indexOf(elementType(node.openingElement)) === -1) {
return;
}
const controlComponents = ['input', 'textarea'].concat((options.controlComponents || []));
const controlComponents = ['input', 'select', 'textarea'].concat((options.controlComponents || []));
// Prevent crazy recursion.
const recursionDepth = Math.min(
options.depth === undefined ? 2 : options.depth,
Expand Down

0 comments on commit 6c33bcb

Please sign in to comment.