|
| 1 | +/** |
| 2 | + * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | + * |
| 4 | + * This source code is licensed under the MIT license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + * |
| 7 | + * @flow strict-local |
| 8 | + * @format |
| 9 | + * @oncall react_native |
| 10 | + */ |
| 11 | + |
| 12 | +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; |
| 13 | + |
| 14 | +import * as Fantom from '@react-native/fantom'; |
| 15 | +import * as React from 'react'; |
| 16 | +import {Text} from 'react-native'; |
| 17 | + |
| 18 | +describe('<Text>', () => { |
| 19 | + describe('props', () => { |
| 20 | + describe('style', () => { |
| 21 | + describe('writingDirection', () => { |
| 22 | + it('propagates to mounting layer', () => { |
| 23 | + const root = Fantom.createRoot(); |
| 24 | + |
| 25 | + Fantom.runTask(() => { |
| 26 | + root.render( |
| 27 | + <Text style={{writingDirection: 'rtl'}}>dummy text</Text>, |
| 28 | + ); |
| 29 | + }); |
| 30 | + |
| 31 | + expect( |
| 32 | + root.getRenderedOutput({props: ['writingDirection']}).toJSX(), |
| 33 | + ).toEqual( |
| 34 | + <rn-paragraph writingDirection="rtl">dummy text</rn-paragraph>, |
| 35 | + ); |
| 36 | + |
| 37 | + Fantom.runTask(() => { |
| 38 | + root.render( |
| 39 | + <Text style={{writingDirection: 'ltr'}}>dummy text</Text>, |
| 40 | + ); |
| 41 | + }); |
| 42 | + |
| 43 | + expect( |
| 44 | + root.getRenderedOutput({props: ['writingDirection']}).toJSX(), |
| 45 | + ).toEqual( |
| 46 | + <rn-paragraph writingDirection="ltr">dummy text</rn-paragraph>, |
| 47 | + ); |
| 48 | + |
| 49 | + Fantom.runTask(() => { |
| 50 | + root.render( |
| 51 | + <Text style={{writingDirection: 'auto'}}>dummy text</Text>, |
| 52 | + ); |
| 53 | + }); |
| 54 | + |
| 55 | + expect( |
| 56 | + root.getRenderedOutput({props: ['writingDirection']}).toJSX(), |
| 57 | + ).toEqual( |
| 58 | + <rn-paragraph writingDirection="auto">dummy text</rn-paragraph>, |
| 59 | + ); |
| 60 | + }); |
| 61 | + }); |
| 62 | + }); |
| 63 | + }); |
| 64 | +}); |
0 commit comments