Skip to content

bug: *ByA11yState query ignores default state values of false #1165

Closed
@mdjastrzebski

Description

@mdjastrzebski

Describe the bug

When using *ByA11yState queries they perform match given element only when given option has the exact values as passed.

Current behavior

  • getByA11yState({ disabled: true }) will match <View accessibilityState={{ disabled: true }} /> (OK)
  • getByA11yState({ disabled: false }) will match <View accessibilityState={{ disabled: false }} /> (OK)
  • getByA11yState({ disabled: false }) will NOT match <View accessibilityState={{}} /> (NOT OK)

Expected behavior

  • getByA11yState({ disabled: false }) should match <View />
  • similarly for other state options we should assume the each of them has a default value of false if not specified otherwise.

Versions

11.2.0 and below

Related issues

#1161 - issue where we discovered the bug

CC: @thymikee @AugustinLF @pierrezimmermannbam

Metadata

Metadata

Assignees

Labels

a11ybugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions