Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fresh_testing_library/mod.ts>queries.ByRoleOptions

Utilities for testing fresh apps
Latest
interface queries.ByRoleOptions
implements MatcherOptions
import { type queries } from "https://deno.land/x/fresh_testing_library@0.13.1/mod.ts";
const { ByRoleOptions } = queries;

Properties

optional
hidden: boolean

If true includes elements in the query set that are usually excluded from the accessibility tree. role="none" or role="presentation" are included in either case.

optional
selected: boolean

If true only includes elements in the query set that are marked as selected in the accessibility tree, i.e., aria-selected="true"

optional
checked: boolean

If true only includes elements in the query set that are marked as checked in the accessibility tree, i.e., aria-checked="true"

optional
pressed: boolean

If true only includes elements in the query set that are marked as pressed in the accessibility tree, i.e., aria-pressed="true"

optional
current: boolean | string

Filters elements by their aria-current state. true and false match aria-current="true" and aria-current="false" (as well as a missing aria-current attribute) respectively.

optional
expanded: boolean

If true only includes elements in the query set that are marked as expanded in the accessibility tree, i.e., aria-expanded="true"

optional
level: number

Includes elements with the "heading" role matching the indicated level, either by the semantic HTML heading elements <h1>-<h6> or matching the aria-level attribute.

optional
queryFallbacks: boolean

Includes every role used in the role attribute For example *ByRole('progressbar', {queryFallbacks: true}) will find <div role="meter progressbar">.

optional
name: RegExp | string | ((accessibleName: string, element: Element) => boolean)

Only considers elements with the specified accessible name.

optional
description: RegExp | string | ((accessibleDescription: string, element: Element) => boolean)

Only considers elements with the specified accessible description.