/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/src/private/__tests__/utilities/commonPropsSuite.js
40 строк
858 B
Ruslan Shestopalyuk
Factor out "common props" testing and add testID test for Text (#53292)
15 авг 2025, 19:35
15 авг 2025, 19:35
c23e84a
Код
Авторство
О чём код?
/** * 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 */ import type {Root} from '@react-native/fantom'; import * as Fantom from '@react-native/fantom'; import * as React from 'react'; export function testIDPropSuite( Component: component(...{testID?: ?string}), ): void { let root: Root; beforeEach(() => { root = Fantom.createRoot(); }); afterEach(() => { root.destroy(); }); describe('testID', () => { it('can be set', () => { Fantom.runTask(() => { root.render(<Component testID="test" />); }); expect( root.getRenderedOutput({props: ['testID']}).toJSONObject().props.testID, ).toEqual('test'); }); }); }