Commit 53a1c634 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Use boolean values for aria-selected in JSX

parent 45a2719f
...@@ -72,7 +72,7 @@ export default function AutocompleteList<Item>({ ...@@ -72,7 +72,7 @@ export default function AutocompleteList<Item>({
<li <li
key={`AutocompleteList-${index}`} key={`AutocompleteList-${index}`}
role="option" role="option"
aria-selected={(activeItem === index).toString()} aria-selected={activeItem === index}
className={classnames( className={classnames(
'flex items-center', 'flex items-center',
'border-l-4 py-1 px-3 cursor-pointer hover:bg-grey-2', 'border-l-4 py-1 px-3 cursor-pointer hover:bg-grey-2',
......
...@@ -54,8 +54,8 @@ describe('AutocompleteList', () => { ...@@ -54,8 +54,8 @@ describe('AutocompleteList', () => {
it('sets `aria-selected` on the <li> at the matching index to `activeItem`', () => { it('sets `aria-selected` on the <li> at the matching index to `activeItem`', () => {
const wrapper = createComponent({ open: true, activeItem: 0 }); const wrapper = createComponent({ open: true, activeItem: 0 });
assert.equal(wrapper.find('li').at(0).prop('aria-selected'), 'true'); assert.equal(wrapper.find('li').at(0).prop('aria-selected'), true);
assert.equal(wrapper.find('li').at(1).prop('aria-selected'), 'false'); assert.equal(wrapper.find('li').at(1).prop('aria-selected'), false);
}); });
it('calls `onSelect` when an <li> is clicked with the corresponding item', () => { it('calls `onSelect` when an <li> is clicked with the corresponding item', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment