MCPcopy
hub / github.com/callstack/react-native-testing-library / toBeEnabled

Function toBeEnabled

src/matchers/to-be-disabled.ts:28–45  ·  view source on GitHub ↗
(this: jest.MatcherContext, instance: TestInstance)

Source from the content-addressed store, hash-verified

26}
27
28export function toBeEnabled(this: jest.MatcherContext, instance: TestInstance) {
29 checkHostElement(instance, toBeEnabled, this);
30
31 const isEnabled = !computeAriaDisabled(instance) && !isAncestorDisabled(instance);
32
33 return {
34 pass: isEnabled,
35 message: () => {
36 const is = this.isNot ? 'is' : 'is not';
37 return [
38 matcherHint(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'instance', ''),
39 '',
40 `Received instance ${is} enabled:`,
41 redent(formatElement(instance), 2),
42 ].join('\n');
43 },
44 };
45}
46
47function isAncestorDisabled(instance: TestInstance): boolean {
48 const parent = instance.parent;

Callers

nothing calls this directly

Calls 4

checkHostElementFunction · 0.90
computeAriaDisabledFunction · 0.90
formatElementFunction · 0.90
isAncestorDisabledFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…