(this: jest.MatcherContext, instance: TestInstance)
| 26 | } |
| 27 | |
| 28 | export 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 | |
| 47 | function isAncestorDisabled(instance: TestInstance): boolean { |
| 48 | const parent = instance.parent; |
nothing calls this directly
no test coverage detected
searching dependent graphs…