From 02b44d18b9d5e7cfaf25427a4c9ea56c2ced1b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Po=C5=9Bpiech?= Date: Thu, 15 Feb 2024 07:53:07 +0100 Subject: [PATCH] refactor --- packages/uniforms/__suites__/ListField.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/uniforms/__suites__/ListField.tsx b/packages/uniforms/__suites__/ListField.tsx index 5940f5491..3c534102d 100644 --- a/packages/uniforms/__suites__/ListField.tsx +++ b/packages/uniforms/__suites__/ListField.tsx @@ -43,15 +43,20 @@ export function testListField( test(' - renders correct error style', () => { const error = new Error(); - const { container } = render( - , + render( + , { x: Array, 'x.$': String, }, ); - expect(container.getElementsByClassName('ant-list')[0]).toHaveStyle( + expect(screen.getByTestId('field')).toHaveStyle( 'borderColor: rgb(255, 85, 0)', ); }); @@ -59,12 +64,13 @@ export function testListField( test(' - renders correct error style (with specified style prop)', () => { const error = new Error(); - const { container } = render( + render( , { x: Array, @@ -72,9 +78,7 @@ export function testListField( }, ); - expect(container.getElementsByClassName('ant-list')[0]).toHaveStyle( - 'marginLeft: 8px', - ); + expect(screen.getByTestId('field')).toHaveStyle('marginLeft: 8px'); }); } @@ -141,7 +145,7 @@ export function testListField( }); test(' - renders children with correct name (children)', () => { - const Child = jest.fn(() =>
) as FC; + const Child = jest.fn(() =>
) as FC; render(