From 1d3831e86afeaa4bf0a23dac0cceb86d01e158f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Jastrze=CC=A8bski?= Date: Tue, 12 Sep 2023 10:09:41 +0200 Subject: [PATCH] refactor: clean up --- src/helpers/accessiblity.ts | 4 -- src/matchers/__tests__/to-be-busy.test.tsx | 54 ++++------------------ 2 files changed, 10 insertions(+), 48 deletions(-) diff --git a/src/helpers/accessiblity.ts b/src/helpers/accessiblity.ts index 32db7cf76..67f464698 100644 --- a/src/helpers/accessiblity.ts +++ b/src/helpers/accessiblity.ts @@ -216,10 +216,6 @@ export function getAccessibilityValue( export function isElementBusy( element: ReactTestInstance ): NonNullable { - if (!isAccessibilityElement(element)) { - return false; - } - const { accessibilityState, 'aria-busy': ariaBusy } = element.props; return ariaBusy ?? accessibilityState?.busy ?? false; } diff --git a/src/matchers/__tests__/to-be-busy.test.tsx b/src/matchers/__tests__/to-be-busy.test.tsx index febda7b6e..235558fba 100644 --- a/src/matchers/__tests__/to-be-busy.test.tsx +++ b/src/matchers/__tests__/to-be-busy.test.tsx @@ -6,11 +6,11 @@ import '../extend-expect'; test('toBeBusy() basic case', () => { render( <> - - - - - + + + + + ); @@ -24,11 +24,11 @@ test('toBeBusy() basic case', () => { test('toBeBusy() error messages', () => { render( <> - - - - - + + + + + ); @@ -43,7 +43,6 @@ test('toBeBusy() error messages', () => { "busy": true, } } - accessible={true} testID="busy" />" `); @@ -54,7 +53,6 @@ test('toBeBusy() error messages', () => { Received element is busy: " @@ -71,7 +69,6 @@ test('toBeBusy() error messages', () => { "busy": false, } } - accessible={true} testID="not-busy" />" `); @@ -82,7 +79,6 @@ test('toBeBusy() error messages', () => { Received element is not busy: " @@ -94,37 +90,7 @@ test('toBeBusy() error messages', () => { Received element is not busy: " `); }); - -test('toBeBusy() requires accessibility elements', () => { - render( - <> - - - - - ); - - expect(() => expect(screen.getByTestId('busy-aria')).toBeBusy()) - .toThrowErrorMatchingInlineSnapshot(` - "expect(element).toBeBusy() - - Received element is not busy: - " - `); - - expect(() => - expect(screen.getByTestId('not-busy-aria')).not.toBeBusy() - ).toThrowErrorMatchingInlineSnapshot(); - - expect(() => - expect(screen.getByTestId('default')).not.toBeBusy() - ).toThrowErrorMatchingInlineSnapshot(); -});