Conversation
SbsCruz
left a comment
There was a problem hiding this comment.
Great work Juandi!
I just left some comments for you to review, thanks for working on this 🚀
| }; | ||
|
|
||
| /** | ||
| * Normalizes text by collapsing whitespace and trimming. |
There was a problem hiding this comment.
thanks for the description of this function, but i think it would be better if we keep this file with no comments, wdyt
There was a problem hiding this comment.
Yes, I think it would be better to keep this file with no comments!
| * @param text - The text to normalize. | ||
| * @returns The normalized text. | ||
| */ | ||
| export function normalizeText(text: string): string { |
There was a problem hiding this comment.
do we need the export for here
There was a problem hiding this comment.
You're right! We don't need the exporthere. Thanks!
| * @param expectedDescription | ||
| * - Optional expected description (string or RegExp). |
There was a problem hiding this comment.
could you put this in one line please so it has same structure as the other matchers please
There was a problem hiding this comment.
I have to put like that because of the lenght of the line due to linter configuration!
| const ariaDescribedBy = actual.getAttribute("aria-describedby") || ""; | ||
| const descriptionIDs = ariaDescribedBy | ||
| .split(/\s+/) | ||
| .filter(Boolean); |
There was a problem hiding this comment.
what is this line doing?
There was a problem hiding this comment.
These lines parse the IDs into a clean array by splitting the string and filtering out extra whitespace, so we can get the descriptions from differents elements at the same time.
|
|
||
| export function getAccessibleDescription(actual: Element): string { | ||
| const ariaDescribedBy = actual.getAttribute("aria-describedby") || ""; | ||
| const descriptionIDs = ariaDescribedBy |
There was a problem hiding this comment.
maybe keep the naming in camel case just as descriptionIds
…ds in getAccessibleDescription function
Added toHaveDescription matcher.