/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/Libraries/Components/Touchable/__tests__/TouchableOpacity-test.js
52 строки
1 KB
Tim Yung
RN: Flowify `packages/react-native` Mocks & Tests (#51794)
04 июн 2025, 22:03
04 июн 2025, 22:03
5ce99e7
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format */ 'use strict'; const {create} = require('../../../../jest/renderer'); const Text = require('../../../Text/Text').default; const TouchableOpacity = require('../TouchableOpacity').default; const React = require('react'); describe('TouchableOpacity', () => { it('renders correctly', async () => { const instance = await create( <TouchableOpacity> <Text>Touchable</Text> </TouchableOpacity>, ); expect(instance.toJSON()).toMatchSnapshot(); }); it('renders in disabled state when a disabled prop is passed', async () => { const instance = await create( <TouchableOpacity disabled={true}> <Text>Touchable</Text> </TouchableOpacity>, ); expect(instance.toJSON()).toMatchSnapshot(); }); it('renders in disabled state when a key disabled in accessibilityState is passed', async () => { const instance = await create( <TouchableOpacity accessibilityState={{disabled: true}}> <Text>Touchable</Text> </TouchableOpacity>, ); expect(instance.toJSON()).toMatchSnapshot(); }); it('has displayName', () => { expect(TouchableOpacity.displayName).toEqual('TouchableOpacity'); }); });