Skip to content

Commit

Permalink
refactor: code tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjastrzebski committed Nov 10, 2022
1 parent c0c04bb commit aa8922a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/to-have-accessibility-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ export function toHaveAccessibilityState(
};
}

export const accessibilityStateKeys: (keyof AccessibilityState)[] = [
'disabled',
'selected',
'checked',
'busy',
'expanded',
];

/**
* Default accessibility state values based on experiments using accessibility
* inspector/screen reader on iOS and Android.
Expand All @@ -57,7 +49,15 @@ const getAccessibilityState = (element: ReactTestInstance) => {
};
};

export function matchAccessibilityState(element: ReactTestInstance, matcher: AccessibilityState) {
const accessibilityStateKeys: (keyof AccessibilityState)[] = [
'disabled',
'selected',
'checked',
'busy',
'expanded',
];

function matchAccessibilityState(element: ReactTestInstance, matcher: AccessibilityState) {
const state = getAccessibilityState(element);
return accessibilityStateKeys.every((key) => matchStateEntry(state, matcher, key));
}
Expand Down

0 comments on commit aa8922a

Please sign in to comment.