TouchableWithoutFeedback-test: use act-wrapping abstraction for create

Summary:
Migrate TouchableWithoutFeedback-test to `act`-wrapping abstraction for `react-test-renderer` `create` in preparation for React 19.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D58653765

fbshipit-source-id: 901ea10ec5dd72f8403a84cfd9f9e8ed55dbe04c
This commit is contained in:
Rob Hogan 2024-06-16 21:38:01 -07:00 коммит произвёл Facebook GitHub Bot
Родитель a6e4e3aad2
Коммит cf6df4392f
1 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -10,15 +10,15 @@
'use strict';
import {create} from '../../../../jest/renderer';
import Text from '../../../Text/Text';
import View from '../../View/View';
import TouchableWithoutFeedback from '../TouchableWithoutFeedback';
import * as React from 'react';
import ReactTestRenderer from 'react-test-renderer';
describe('TouchableWithoutFeedback', () => {
it('renders correctly', () => {
const instance = ReactTestRenderer.create(
it('renders correctly', async () => {
const instance = await create(
<TouchableWithoutFeedback style={{}}>
<Text>Touchable</Text>
</TouchableWithoutFeedback>,
@ -29,9 +29,9 @@ describe('TouchableWithoutFeedback', () => {
});
describe('TouchableWithoutFeedback with disabled state', () => {
it('should be disabled when disabled is true', () => {
it('should be disabled when disabled is true', async () => {
expect(
ReactTestRenderer.create(
await create(
<TouchableWithoutFeedback disabled={true}>
<View />
</TouchableWithoutFeedback>,
@ -39,9 +39,9 @@ describe('TouchableWithoutFeedback with disabled state', () => {
).toMatchSnapshot();
});
it('should be disabled when disabled is true and accessibilityState is empty', () => {
it('should be disabled when disabled is true and accessibilityState is empty', async () => {
expect(
ReactTestRenderer.create(
await create(
<TouchableWithoutFeedback disabled={true} accessibilityState={{}}>
<View />
</TouchableWithoutFeedback>,
@ -49,9 +49,9 @@ describe('TouchableWithoutFeedback with disabled state', () => {
).toMatchSnapshot();
});
it('should keep accessibilityState when disabled is true', () => {
it('should keep accessibilityState when disabled is true', async () => {
expect(
ReactTestRenderer.create(
await create(
<TouchableWithoutFeedback
disabled={true}
accessibilityState={{checked: true}}>
@ -61,9 +61,9 @@ describe('TouchableWithoutFeedback with disabled state', () => {
).toMatchSnapshot();
});
it('should overwrite accessibilityState with value of disabled prop', () => {
it('should overwrite accessibilityState with value of disabled prop', async () => {
expect(
ReactTestRenderer.create(
await create(
<TouchableWithoutFeedback
disabled={true}
accessibilityState={{disabled: false}}>
@ -73,9 +73,9 @@ describe('TouchableWithoutFeedback with disabled state', () => {
).toMatchSnapshot();
});
it('should disable button when accessibilityState is disabled', () => {
it('should disable button when accessibilityState is disabled', async () => {
expect(
ReactTestRenderer.create(
await create(
<TouchableWithoutFeedback accessibilityState={{disabled: true}}>
<View />
</TouchableWithoutFeedback>,